inventory
[localhost]
127.0.0.1 ansible_connection=local
ansible.cfg
[defaults]
inventory = inventory
playbook.yml
---
- hosts: localhost
tasks:
- name: .....
Reference: ansible/ansible#33132 (comment)
inventory
[localhost]
127.0.0.1 ansible_connection=local
ansible.cfg
[defaults]
inventory = inventory
playbook.yml
---
- hosts: localhost
tasks:
- name: .....
Reference: ansible/ansible#33132 (comment)
I'm not sure if this is recommendable. For me, it leads to a new warning with:
I believe the reasons is that the "implicit" localhost sets both
ansible_connection
andansible_python_interpreter
. Looking forward, it seems dangerous to try and override the implicit localhost because who knows what you might miss? The implicit localhost has the canonical behavior (which is very much preferred, see the python interpreter issue).As crazy as it sounds, the best way to run without errors against localhost would seem to modify your inventory file to be
That is, make an inventory with an arbitrary invalid host. The playbook will then only target the true implicit localhost.