You can use those variables in conjunction with Ansible conditionals <http://docs.ansible.com/ansible/playbooks_conditionals.html> and blocks <http://docs.ansible.com/ansible/playbooks_blocks.html>
On Tuesday, April 19, 2016 at 7:44:24 AM UTC-4, Rafał Radecki wrote: > > Hi All :) > > I am using ansible 2.0.1 on both aws and openstack kilo. I would like to > run the same playbook with appropriate conditions so that part of it would > be run when iaas is aws and another part when iaas is openstack. I checked > with the setup module that: > - for aws vm: > > $ ansible -m setup 127.0.0.1 | egrep -i > 'aws|amazon|openstack|virtualization' > "ansible_bios_version": "4.2.amazon", > "ansible_product_version": "4.2.amazon", > "ansible_virtualization_role": "guest", > "ansible_virtualization_type": "xen", > > - for openstack vm: > > ansible -m setup 127.0.0.1 | egrep -i > 'aws|amazon|openstack|virtualization' > "ansible_product_name": "OpenStack Nova", > "ansible_system_vendor": "OpenStack Foundation", > "ansible_virtualization_role": "host", > "ansible_virtualization_type": "kvm", > > so I can differentiate/divide tasks based on for example regex on > "ansible_product_name". Is there a better way to build playbooks for aws > and openstack? > > BR, > Rafal. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7b85654b-d8d4-4549-bba2-d0f2a1a3d86b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
