你仍然需要告诉Ansible它需要运行什么主机,只需它在本地运行.
所以相反你的site.yml
文件应该是这样的:
- hosts: 127.0.0.1 connection: local tasks: # Basic user creation example - name: Create two new IAM users with API keys iam: iam_type: user name: "{{ item }}" state: present password: "{{ temp_pass }}" access_key_state: create with_items: - jcleese - mpython