Red Hat Training

A Red Hat training course is available for RHEL 8

85.4. 使用 Ansible playbook 确保在没有 DNS 的 IdM 客户端上存在 HTTP 服务

按照以下流程,使用 Ansible playbook 确保运行在没有 DNS 条目的 IdM 客户端上的 HTTP 服务器存在。场景表示,如果使用 IPv6 而不是 IPv4,IdM 主机没有可用的 DNS A 条目 - 或没有 DNS AAAA 条目。

先决条件

流程

  1. 创建一个清单文件,如 inventory.file

    $ touch inventory.file
  2. 打开 inventory.file,并在 [ipaserver] 部分中定义您要配置的 IdM 服务器。例如,要指示 Ansible 配置 server.idm.example.com,请输入:

    [ipaserver]
    server.idm.example.com
  3. 生成 /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-with-host-force.yml Ansible playbook 文件的副本。例如:

    $ cp /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-with-host-force.yml /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-with-host-force-copy.yml
  4. 打开复制的文件 /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-with-host-force-copy.yml,以进行编辑。在 ipaservice 任务中找到 ipaadmin_passwordname 变量:

    ---
    - name: Playbook to manage IPA service.
      hosts: ipaserver
      gather_facts: false
    
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      # Ensure service is present
      - ipaservice:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: HTTP/ihavenodns.info
          force: yes
  5. 调整文件:

    • ipaadmin_password 变量设置为 IdM 管理员密码。
    • name 变量设置为运行 HTTP 服务的主机的名称。
  6. 保存并退出文件。
  7. 运行 Ansible playbook。指定 playbook 文件、存储密码的文件保护 secret.yml 文件以及清单文件:

    $ ansible-playbook --vault-password-file=password_file -v -i path_to_inventory_directory/inventory.file /usr/share/doc/ansible-freeipa/playbooks/service/service-is-present-with-host-force-copy.yml

验证步骤

  1. 以 IdM 管理员身份登录 IdM Web UI。
  2. 导航到 IdentityServices

现在,您可以看到 Services 列表中列出的 HTTP/client.idm.example.com@IDM.EXAMPLE.COM

其它资源