--- - name: Set a fact to ensure Ansible uses the python interpreter in the virtualenv set_fact: ansible_python_interpreter: "{{ nova_flavors_venv }}/bin/python" - name: Ensure nova flavors exist os_nova_flavor: auth_type: "{{ nova_flavors_auth_type }}" auth: "{{ nova_flavors_auth }}" name: "{{ item.name }}" ram: "{{ item.ram }}" vcpus: "{{ item.vcpus }}" disk: "{{ item.disk }}" ephemeral: "{{ item.ephemeral | default(omit) }}" swap: "{{ item.swap | default(omit) }}" state: present with_items: "{{ nova_flavors }}" # This variable is unset before we set it, and it does not appear to be # possible to unset a variable in Ansible. - name: Set a fact to reset the Ansible python interpreter set_fact: ansible_python_interpreter: /usr/bin/python