| 123456789101112131415161718192021222324252627282930313233343536373839 |
- Add reports
- #group variables
- group_vars:
- preprod-group:
- report_file: "/path/to/preprod_report.txt"
- infrastructure-group:
- report_file: "/path/to/infrastructure_report.txt"
- production-group:
- report_file: "/path/to/production_report.txt"
- #playbook
- - name: Generate update report
- shell: echo "Server: {{ inventory_hostname }} - Update status: {{ update_result.changed | ternary('Success', 'Failure') }}" >> "{{ hostvars[inventory_hostname]['report_file'] }}"
- delegate_to: localhost
- run_once: true
- - name: Generate installation report
- shell: echo "Server: {{ inventory_hostname }} - Installation status: {{ install_result.changed | ternary('Success', 'Failure') }}" >> "{{ hostvars[inventory_hostname]['report_file'] }}"
- delegate_to: localhost
- run_once: true
- Email reports
- #playbook
- - name: Email report files
- command: "echo | mail -s 'Server Update Report' -a {{ hostvars[inventory_hostname]['report_file'] }} your-email@example.com"
- delegate_to: localhost
- run_once: true
- #reporting
- Patching started
- list time and date
- List machines that patches where installed
-
|