O'Reilly logo

OpenStack Administration with Ansible 2 - Second Edition by Walter Bentley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reviewing playbook and role

Let's jump right into examining the role we created, named instance-migrate. The completed role and file, named main.yml, located in the instance-migrate/tasks directory, looks like this:

--- - name: Retrieve hypervisor list shell: openstack --os-cloud="{{ CLOUD_NAME }}" hypervisor list | awk 'NR > 3' | awk '$4 != "{{ desthype }}" { print $4 }' register: hypelist - name: Collect pre-migration instance details shell: openstack --os-cloud="{{ CLOUD_NAME }}" server list --name "{{ instance }}" --long | awk 'NR > 3' | awk '{ print $16 }' register: preinststat - name: Disable unselected hypervisors command: nova "{{ AUTH_S }}" service-disable "{{ item }}" nova-compute --reason '{{ migreason }}' with_items: "{{hypelist.stdout_lines}}" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required