December 2016
Intermediate to advanced
230 pages
4h 48m
English
Let's jump right into examining the role we created, named create-snapshot. The completed role and file, named main.yml, located in the create-snapshot/tasks directory, looks like this:
--- - name: Retrieve tenantID shell: openstack --os-cloud="{{ CLOUD_NAME }}" project list | awk '/ "{{tenantname}}" / { print $2 }' register: tenantid - name: Retrieve instance id from tenant shell: openstack --os-cloud="{{ CLOUD_NAME }}" server list --all-projects --project "{{ tenantid.stdout }}" | awk 'NR > 3 { print $2 }' register: instid - name: Create instance snapshot command: openstack --os-cloud="{{ CLOUD_NAME }}" server image create --name="{{ tenantname }}"-snap-"{{ item }}" "{{ item }}" with_items: "{{instid.stdout_lines}}" ...Read now
Unlock full access