Hi fellows!

I'm trying to build a playbook for my infrastructure but I would like to be 
able to do something like this:
ansible-playbook -i hosts site.yml
This playbook is quite simple, just some lines like this:
- import_playbook: glados.yml
- import_playbook: skynet.yml
- import_playbook: brainiac.yml
No big deal until now. The problem is: I also want to use ansible-pull so 
the machines (glados, skynet, brainiac, and so on) also be able to git 
clone and execute their respective playbook by themselves.

The problem is all around what I should put on "hosts:" line. If I just put 
"localhost" or "127.0.0.1" just the ansible-pull will work. and if put the 
hostname just the ansible-playbook with the site.yml will work (because I 
have entries on the inventory file).

I quite resolved that creating a script to automate the installation (just 
execute the script into the machine and the magic happens) which generates 
a for-locally-use-only inventory:
echo "glados ansible_host=127.0.0.1 ansible_connection=local 
ansible_python_interpreter=/usr/bin/python3" | sudo tee /etc/ansible/hosts

This allows me to use this host-only inventory to execute the ansible-pull 
and a broder inventory with the correct IPs to execute site.yml.

THere is a better, more elegant solution available?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/36c1c392-cb9c-49fe-9b82-eee486ed4700n%40googlegroups.com.

Reply via email to