Natrium2
Natrium2

Reputation: 85

Add Ansible-Server where Ansible is hosted to hosts

Is there a possibility to add the server, where Ansible is running to the hostfile and maintain it also through Ansible playbooks?

Thanks in advance.

Upvotes: 1

Views: 185

Answers (1)

Zeitounator
Zeitounator

Reputation: 44685

The implicit localhost using the local connection plugin is available by default. Meanwhile it does not match the all group (nor any other actually).

So you can either:

  • target it explicitly in your play, e.g. hosts: host_a:group_b:localhost
  • define it explicitly in your inventory so it matches the all group if you use it, e.g. (ini format) localhost ansible_connection=local

Note that the second option can work with any symbolic name you decide to use e.g. my.host.local ansible_connection=local

Upvotes: 1

Related Questions