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.