我一直在尝试使用 Ansible 剧本将主机名添加到我的主机文件中。我的 Ansible 游戏如下所示,我的主机文件位于/etc/ansible/hosts
:
- name: adding host playbook
hosts: localhost
connection: local
tasks:
- name: add host to ansible host file
add_host:
name: myvm.cloud.azure.com
groups: mymasters
Playbook 成功执行,但新主机名未添加到 Ansible hosts 文件中。有人可以帮我吗?