can github.com/ansible/ansible-examples/tree/master/lamp_haproxy be executed simply, using dynamic inventory?

Hey,

It feels like that all-important beginner’s Ansible example github.com/ansible/ansible-examples/tree/master/lamp_haproxy can only be used, as written, with static inventory.

For example, I modified the example’s site.yml to use the ec2.py tag_ option for all named hosts, but the example already chokes on a Jinja template where the following expression is used: {% if (inventory_hostname in groups[‘webservers’]) or (inventory_hostname in groups[‘monitoring’]) %}. My suspicion is that this will only be a first conflict that users of dynamic inventory will face when attempting to execute the example.

So, is there some simple modification or approach to executing lamp_haproxy with dynamic inventory?

Thanks, G

So this is true, but it’s also ok, since it’s just an example.

If you wanted to use it on a ec2 dynamic inventory, you could just do ec2_tag_webservers instead of webservers in both places.