17.3. 确保尽管拥有最后一个 IdM 服务器角色,也不存在 IdM 服务器


您可以使用 Ansible 来确保没有身份管理(IdM)服务器,即使最后一个 IdM 服务实例正在服务器上运行。证书颁发机构(CA)、密钥恢复机构(KRA)或 DNS 服务器都是 IdM 服务的示例。

警告

如果您删除了作为 CA、KRA 或 DNS 服务器的最后一台服务器,会严重破坏 IdM 功能。您可以使用 ipa service-find 命令手动检查哪些服务运行在哪些 IdM 服务器上。CA 服务器的主要名称为 dogtag/server_name/REALM_NAME

ansible-freeipa ipaserver 角色不同,此 playbook 中使用的 ipaserver 模块不会从服务器卸载 IdM 服务。

先决条件

  • 在控制节点上:

    • 您在使用 Ansible 版本 2.15 或更高版本。
    • 已安装 freeipa.ansible_freeipa 集合。
    • 示例假定在 ~/MyPlaybooks/ 目录中,您已创建了一个具有 IdM 服务器的完全限定域名(FQDN)的 Ansible 清单文件
    • 示例假定 secret.yml Ansible vault 存储了 ipaadmin_password
  • 目标节点(这是执行 freeipa.ansible_freeipa 模块的节点)是作为 IdM 客户端、服务器或副本的 IdM 域的一部分。
  • 清单文件中定义的从控制节点到 IdM 服务器的 SSH 连接工作正常。

流程

  1. 进入您的 ~/MyPlaybooks/ 目录:

    $ cd ~/MyPlaybooks/
    Copy to Clipboard Toggle word wrap
  2. 复制位于 /usr/share/ansible/collections/ansible_collections/ansible_freeipa/ansible_freeipa/server/ 目录中的 server -absent-ignore-last-of-role.yml Ansible playbook 文件:

    $ cp /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/server/server-absent-ignore-last-of-role.yml server-absent-ignore-last-of-role-copy.yml
    Copy to Clipboard Toggle word wrap
  3. 打开 server-absent-ignore-last-of-role-copy.yml 文件进行编辑。
  4. 通过在 ipaserver 任务部分中设置以下变量来调整文件,并保存文件:

    • ipaadmin_password 变量设为 IdM admin 的密码。
    • name 变量设为服务器的 FQDN。示例服务器的 FQDNserver123.idm.example.com
    • 确保 ignore_last_of_role 变量被设为 true
    • state 变量设置为 absent
    ---
    - name: Server absent with last of role skip example
      hosts: ipaserver
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      - name: Ensure server "server123.idm.example.com” is absent with last of role skip
        freeipa.ansible_freeipa.ipaserver:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: server123.idm.example.com
          ignore_last_of_role: true
          state: absent
    Copy to Clipboard Toggle word wrap
  5. 运行 Ansible playbook ,并指定 playbook 文件和清单文件:

    $ ansible-playbook --vault-password-file=password_file -v -i inventory server-absent-ignore-last-of-role-copy.yml
    Copy to Clipboard Toggle word wrap
  6. 确保指向 server123.idm.example.com 的所有名称服务器(NS)DNS 记录已从 DNS 区域中删除。无论您使用由 IdM 还是外部 DNS 管理的集成 DNS,这个均适用。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat