87.9. 使用 Ansible playbook 确保 IdM 中缺少 HTTP 服务
按照以下流程从 IdM 中取消一个服务的注册。更具体地说,它描述了如何使用 Ansible playbook 来确保 IdM 中缺少名为 HTTP/client.idm.example.com 的 HTTP 服务器。
先决条件
- 您有 IdM 管理员密码。
流程
创建一个清单文件,如
inventory.file:$ touch inventory.file打开
inventory.file,并在[ipaserver]部分中定义您要配置的 IdM 服务器。例如,要指示 Ansible 配置 server.idm.example.com,请输入:[ipaserver] server.idm.example.com生成
/usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent.ymlAnsible playbook 文件的副本。例如:$ cp /usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent.yml /usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent-copy.yml-
打开
/usr/share/doc/ansible-freeipa/playbooks/service/service-is-absent-copy.ymlAnsible playbook 文件进行编辑。 通过更改以下内容来调整文件:
-
由
ipaadmin_password变量定义的 IdM 管理员密码。 HTTP 服务的 Kerberos 主体,由
ipaservice任务的名称变量定义。在适应当前示例后,复制的文件类似如下:
--- - name: Playbook to manage IPA service. hosts: ipaserver gather_facts: false vars_files: - /home/user_name/MyPlaybooks/secret.yml tasks: # Ensure service is absent - ipaservice: ipaadmin_password: "{{ ipaadmin_password }}" name: HTTP/client.idm.example.com state: absent-
由
- 保存并退出文件。
运行 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-absent-copy.yml
验证
- 以 IdM 管理员身份登录 IdM Web UI。
-
导航到
IdentityServices。
如果您无法在 Services 列表中看到 HTTP/client.idm.example.com@IDM.EXAMPLE.COM 服务,则已成功确保了在 IdM 中缺少 HTTP/client.idm.example.com@IDM.EXAMPLE.COM 服务。