Reviewing playbooks and roles
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 like this:
--- name: Create working directory file: path="{{ REPORT_DIR }}" state=directory ignore_errors: yes name: Copy the cloud_report script copy: src=cloud_report.sql dest=/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={{ ...
Get OpenStack Administration with Ansible 2 - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.