I have workflow with 2 templates. First I add new host to my hosts.ini file:
- name: Add to host file
blockinfile:
path: /var/lib/awx/projects/_52__glusterfs/hosts.ini
block: |
gluster1 ansible_user=<user> ansible_host=<ip>
And second I wait for host up:
---
- name: Weit befor all hosts ssh up
hosts: localhost
tasks:
- name: Test 1
shell: cat hosts.ini
- name: Test 2
shell: cat /var/lib/awx/projects/_52__glusterfs/hosts.ini
- name: Test 3
shell: cat ansible.cfg
- name: Wait for hosts up
wait_for:
host: gluster1
port: 22
But i get eror:
[WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match 'all'
So output from tests in template 2 is (pseudocode output):
shell: cat hosts.ini
>>>
[gluster]
shell: cat /var/lib/awx/projects/_52__glusterfs/hosts.ini
>>>
[gluster]
gluster1 ansible_user=<user> ansible_host=<ip>
shell: cat ansible.cfg
>>>
[defaults]
inventory = /var/lib/awx/projects/_52__glusterfs/hosts.ini
host_key_checking = false
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null
[inventory]
enable_plugins = host_list, script, auto, yaml, ini, toml
Why I have empty hosts.ini in my execute directory and why ansible use it instead of /var/lib/awx/projects/_52__glusterfs/hosts.ini in my ansible.cfg file?