O'Reilly logo

OpenStack Administration with Ansible 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

Playbook and role review

Let's jump right into examining the roles we created.

The completed role and file named main.yml located in the cloud-inventory/tasks directory looks similar to this:

--- - name: Create working directory shell: mkdir {{ REPORT_DIR }} ignore_errors: yes - name: Copy the cloud_report script copy: src=cloud_report.sqldest=/usr/share mode=0755 - name: Add report header shell: ( echo "+------------------------------------+"; echo "| {{ COMPANY }} Cloud Report |"; echo "| Created at {{ lookup('pipe', 'date +%Y-%m-%d%t%X') }} |"; echo "+------------------------------------+"; ) >> {{ REPORT_DIR }}/os_report_{{ lookup('pipe', 'date +%Y%m%d') }}.log - name: Execute cloud report shell: chdir=/usr/bin mysql -u root --password={{ MYSQLPASS ...

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