├── .gitignore ├── roles ├── retrieve_common_info │ ├── defaults │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── template │ ├── files │ │ ├── aws.png │ │ ├── router.png │ │ ├── webpage_logo.png │ │ └── redhat-ansible-logo.svg │ ├── README.md │ ├── vars │ │ └── main.yml │ ├── templates │ │ ├── header.j2 │ │ ├── ansible.j2 │ │ ├── report.j2 │ │ └── vpc.j2 │ └── tasks │ │ └── main.yml ├── build_report_s3 │ ├── vars │ │ └── main.yml │ ├── README.md │ ├── templates │ │ └── policy.json │ └── tasks │ │ └── main.yml ├── build_report_tags │ ├── files │ │ ├── aws.png │ │ ├── report.png │ │ ├── router.png │ │ ├── webpage_logo.png │ │ └── ansible-logo.svg │ ├── templates │ │ ├── header.j2 │ │ ├── footer.j2 │ │ ├── landing_page.j2 │ │ └── tags_report.j2 │ ├── defaults │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── build_report_linux │ ├── files │ │ ├── aws.png │ │ ├── router.png │ │ ├── webpage_logo.png │ │ └── redhat-ansible-logo.svg │ ├── README.md │ ├── vars │ │ └── main.yml │ ├── templates │ │ ├── header.j2 │ │ ├── ansible.j2 │ │ ├── vpc.backup │ │ ├── vpc.backupApril172023 │ │ ├── report.j2 │ │ └── vpc.j2 │ └── tasks │ │ └── main.yml ├── retrieve_info │ ├── defaults │ │ └── main.yml │ └── tasks │ │ ├── main.yml │ │ └── retrieve_info.yml └── retrieve_aws_instances_info │ └── tasks │ └── main.yml ├── collections └── ansible_collections │ └── demo │ └── patching │ ├── roles │ ├── build_report_network │ │ ├── vars │ │ │ └── main.yml │ │ ├── files │ │ │ ├── router.png │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── new.css │ │ ├── example_results │ │ │ └── Ansible Network Automation Report.png │ │ ├── templates │ │ │ ├── header.j2 │ │ │ ├── summary.j2 │ │ │ ├── ospf.j2 │ │ │ ├── lacp.j2 │ │ │ ├── bgp.j2 │ │ │ ├── vlans.j2 │ │ │ ├── lldp_interfaces.j2 │ │ │ ├── interfaces.j2 │ │ │ ├── l2_interfaces.j2 │ │ │ ├── l3_interfaces.j2 │ │ │ └── report.j2 │ │ ├── tasks │ │ │ └── main.yml │ │ └── README.md │ ├── build_report_windows │ │ ├── vars │ │ │ └── main.yml │ │ ├── defaults │ │ │ └── main.yml │ │ ├── files │ │ │ ├── server.png │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── new.css │ │ ├── example_results │ │ │ └── Ansible Windows Automation Report.png │ │ ├── templates │ │ │ ├── header.j2 │ │ │ ├── packages.j2 │ │ │ ├── services.j2 │ │ │ └── report.j2 │ │ ├── tasks │ │ │ └── main.yml │ │ └── README.md │ ├── report_linux │ │ ├── defaults │ │ │ └── main.yml │ │ ├── vars │ │ │ └── main.yml │ │ ├── files │ │ │ ├── server.png │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── new.css │ │ ├── example_results │ │ │ └── Ansible Linux Automation Report.png │ │ ├── templates │ │ │ ├── header.j2 │ │ │ ├── packages.j2 │ │ │ ├── services.j2 │ │ │ └── report.j2 │ │ ├── README.md │ │ └── tasks │ │ │ └── main.yml │ ├── report_windows │ │ ├── defaults │ │ │ └── main.yml │ │ ├── vars │ │ │ └── main.yml │ │ ├── files │ │ │ ├── server.png │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── new.css │ │ ├── example_results │ │ │ └── Ansible Windows Automation Report.png │ │ ├── templates │ │ │ ├── header.j2 │ │ │ ├── packages.j2 │ │ │ ├── services.j2 │ │ │ └── report.j2 │ │ ├── README.md │ │ └── tasks │ │ │ └── main.yml │ ├── build_report_windows_patch │ │ ├── vars │ │ │ └── main.yml │ │ ├── defaults │ │ │ └── main.yml │ │ ├── files │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── main.css │ │ ├── example_results │ │ │ └── Full_Report.png │ │ ├── README.md │ │ ├── tasks │ │ │ └── main.yml │ │ └── templates │ │ │ └── report.j2 │ ├── report_linux_patching │ │ ├── vars │ │ │ └── main.yml │ │ ├── defaults │ │ │ └── main.yml │ │ ├── files │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── main.css │ │ ├── example_results │ │ │ ├── Full_Report.png │ │ │ └── Splunk Patching Aggregated RHEL 8.png │ │ ├── README.md │ │ ├── tasks │ │ │ └── main.yml │ │ └── templates │ │ │ └── report.j2 │ ├── report_windows_patching │ │ ├── vars │ │ │ └── main.yml │ │ ├── defaults │ │ │ └── main.yml │ │ ├── files │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── main.css │ │ ├── example_results │ │ │ └── Full_Report.png │ │ ├── tasks │ │ │ └── main.yml │ │ ├── README.md │ │ └── templates │ │ │ └── report.j2 │ ├── patch_linux │ │ ├── defaults │ │ │ └── main.yml │ │ └── tasks │ │ │ └── main.yml │ ├── report_server │ │ ├── vars │ │ │ ├── Linux.yml │ │ │ └── Win32NT.yml │ │ ├── files │ │ │ ├── report.png │ │ │ ├── webpage_logo.png │ │ │ └── css │ │ │ │ └── new.css │ │ ├── tasks │ │ │ ├── main.yml │ │ │ ├── apache.yml │ │ │ ├── iis.yml │ │ │ ├── linux_landing_page.yml │ │ │ └── windows_landing_page.yml │ │ └── templates │ │ │ ├── header.j2 │ │ │ ├── linux_report.j2 │ │ │ └── windows_report.j2 │ └── patch_windows │ │ ├── defaults │ │ └── main.yml │ │ └── tasks │ │ └── main.yml │ └── plugins │ └── modules │ ├── win_scan_packages.py │ ├── win_scan_services.py │ ├── win_scan_services.ps1 │ ├── win_scan_packages.ps1 │ └── scan_packages.py ├── ansible.cfg ├── .vscode └── settings.json ├── playbooks ├── cloud_report_tags.yml ├── info_vpcs.yml ├── info_igws.yml ├── info_instances.yml ├── stop_aws_ec2_instances.yml ├── lab2-patching.yml ├── aws_ssm.yml ├── info_combined.yml ├── lab2-deploy-application.yml ├── templates │ └── display.j2 ├── cloud_report.yml ├── lab2-ec2-info.yml ├── tag_info_aws.yml ├── lab3-challenge2.yml ├── aws_ssm_assume.yml ├── aws_instances.yml └── aws_resources.yml └── 1dRHEL ├── 1dwf2-Create-VPC.yml ├── 1dwf1-Create-ssh-key-pair.yml ├── 1dwf4-Create-internet-gateway.yml ├── 1dwf3-Create-security-group.yml ├── 1dwf5-Create-RHEL-server.yml └── 1d-Teardown-all-AWS-WF-resources.yml /.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | *.DS_Store 3 | -------------------------------------------------------------------------------- /roles/retrieve_common_info/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ec2_region: 'us-east-1' 3 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | detailedreport: True -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html/reports -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | detailedreport: True -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | detailedreport: True -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: C:\Inetpub\wwwroot\reports -------------------------------------------------------------------------------- /roles/template/files/aws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/template/files/aws.png -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | deprecation_warnings = False 3 | stdout_callback = yaml 4 | collections_paths=./collections 5 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html/reports -------------------------------------------------------------------------------- /roles/template/files/router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/template/files/router.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: C:\Inetpub\wwwroot\reports -------------------------------------------------------------------------------- /roles/build_report_s3/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | reports_aws_bucket_name: "aws-cloud-report" 3 | reports_aws_region: "us-west-1" 4 | -------------------------------------------------------------------------------- /roles/build_report_tags/files/aws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_tags/files/aws.png -------------------------------------------------------------------------------- /roles/template/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/template/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/patch_linux/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_packages: [] 3 | allow_reboot: true 4 | -------------------------------------------------------------------------------- /roles/build_report_linux/files/aws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_linux/files/aws.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/vars/Linux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | doc_root: /var/www/html 3 | reports_dir: reports 4 | -------------------------------------------------------------------------------- /roles/build_report_linux/files/router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_linux/files/router.png -------------------------------------------------------------------------------- /roles/build_report_tags/files/report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_tags/files/report.png -------------------------------------------------------------------------------- /roles/build_report_tags/files/router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_tags/files/router.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/vars/Win32NT.yml: -------------------------------------------------------------------------------- 1 | --- 2 | doc_root: C:\Inetpub\wwwroot 3 | reports_dir: reports 4 | -------------------------------------------------------------------------------- /roles/build_report_linux/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_linux/files/webpage_logo.png -------------------------------------------------------------------------------- /roles/build_report_tags/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/roles/build_report_tags/files/webpage_logo.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "githubPullRequests.ignoredPullRequestBranches": [ 3 | "master" 4 | ], 5 | "ansible.python.interpreterPath": "/usr/local/bin/python3" 6 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/files/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux/files/server.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/defaults/main.yml: -------------------------------------------------------------------------------- 1 | EMAIL_FROM: tower@shadowman.dev 2 | to_emails: alex@shadowman.dev,tower@shadowman.dev 3 | EMAIL_TO: "{{ to_emails.split(',') }}" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/files/report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_server/files/report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/defaults/main.yml: -------------------------------------------------------------------------------- 1 | EMAIL_FROM: tower@shadowman.dev 2 | to_emails: alex@shadowman.dev,tower@shadowman.dev 3 | EMAIL_TO: "{{ to_emails.split(',') }}" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/defaults/main.yml: -------------------------------------------------------------------------------- 1 | EMAIL_FROM: tower@shadowman.dev 2 | to_emails: alex@shadowman.dev,tower@shadowman.dev 3 | EMAIL_TO: "{{ to_emails.split(',') }}" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/files/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_windows/files/server.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_tasks: apache.yml 3 | when: ansible_system == 'Linux' 4 | 5 | - include_tasks: iis.yml 6 | when: ansible_system == 'Win32NT' 7 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/files/router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_network/files/router.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/files/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_windows/files/server.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_server/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_windows/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_network/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_windows/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux_patching/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_windows_patching/files/webpage_logo.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/files/webpage_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_windows_patch/files/webpage_logo.png -------------------------------------------------------------------------------- /roles/template/README.md: -------------------------------------------------------------------------------- 1 | # network.toolkit.build_report 2 | 3 | To use this multi-platform network automation build_report role: 4 | 5 | ## Task example: 6 | 7 | ``` 8 | - name: build a report 9 | include_role: 10 | name: build_report 11 | ``` 12 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/example_results/Full_Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux_patching/example_results/Full_Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/example_results/Full_Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_windows_patching/example_results/Full_Report.png -------------------------------------------------------------------------------- /roles/build_report_s3/README.md: -------------------------------------------------------------------------------- 1 | # network.toolkit.build_report 2 | 3 | To use this multi-platform network automation build_report role: 4 | 5 | ## Task example: 6 | 7 | ``` 8 | - name: build a report 9 | include_role: 10 | name: build_report 11 | ``` 12 | -------------------------------------------------------------------------------- /roles/build_report_linux/README.md: -------------------------------------------------------------------------------- 1 | # network.toolkit.build_report 2 | 3 | To use this multi-platform network automation build_report role: 4 | 5 | ## Task example: 6 | 7 | ``` 8 | - name: build a report 9 | include_role: 10 | name: build_report 11 | ``` 12 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/example_results/Full_Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_windows_patch/example_results/Full_Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/example_results/Ansible Linux Automation Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux/example_results/Ansible Linux Automation Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/example_results/Ansible Windows Automation Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_windows/example_results/Ansible Windows Automation Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/example_results/Ansible Windows Automation Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/build_report_windows/example_results/Ansible Windows Automation Report.png -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/example_results/Splunk Patching Aggregated RHEL 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansible-cloud/aws_demos/HEAD/collections/ansible_collections/demo/patching/roles/report_linux_patching/example_results/Splunk Patching Aggregated RHEL 8.png -------------------------------------------------------------------------------- /roles/build_report_s3/templates/policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": "*", 7 | "Action": "s3:GetObject", 8 | "Resource": "arn:aws:s3:::{{ reports_aws_bucket_name }}/*" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /playbooks/cloud_report_tags.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create and publish AWS cloud reports 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | vars: 7 | reports_aws_report: tags 8 | tasks: 9 | - name: Include reports role 10 | ansible.builtin.include_role: 11 | name: "../roles/build_report_tags" 12 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/patch_windows/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | win_update_categories: 3 | - Application 4 | - Connectors 5 | - CriticalUpdates 6 | - DefinitionUpdates 7 | - DeveloperKits 8 | - FeaturePacks Guidance 9 | - SecurityUpdates 10 | - ServicePacks 11 | - Tools 12 | - UpdateRollups 13 | - Updates 14 | allow_reboot: true -------------------------------------------------------------------------------- /roles/template/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html/ 2 | web_host: ansible-1 3 | web_port: 8088 4 | # multi key, same value lookup for cisco 5 | vendor: 6 | ios: &my_value 'Cisco' 7 | nxos: *my_value 8 | iosxr: *my_value 9 | junos: "Juniper" 10 | eos: "Arista" 11 | transport: 12 | cliconf: "network_cli" 13 | netconf: "netconf" 14 | httpapi: "httpapi" 15 | -------------------------------------------------------------------------------- /roles/build_report_linux/vars/main.yml: -------------------------------------------------------------------------------- 1 | file_path: /var/www/html/ 2 | web_host: ansible-1 3 | web_port: 8088 4 | # multi key, same value lookup for cisco 5 | vendor: 6 | ios: &my_value 'Cisco' 7 | nxos: *my_value 8 | iosxr: *my_value 9 | junos: "Juniper" 10 | eos: "Arista" 11 | transport: 12 | cliconf: "network_cli" 13 | netconf: "netconf" 14 | httpapi: "httpapi" 15 | -------------------------------------------------------------------------------- /roles/build_report_tags/templates/header.j2: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 11 | 12 |
13 |
-------------------------------------------------------------------------------- /roles/template/templates/header.j2: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /roles/build_report_linux/templates/header.j2: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /playbooks/info_vpcs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create AWS resources 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | - name: retrieve vpc information 8 | amazon.aws.ec2_vpc_net_info: 9 | region: "{{ ec2_region | default('us-east-1') }}" 10 | register: vpc_info 11 | 12 | - name: print vpc info to terminal 13 | ansible.builtin.debug: 14 | msg: "{{ vpc_info }}" 15 | -------------------------------------------------------------------------------- /playbooks/info_igws.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create AWS resources 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | - name: Gather information about Internet Gateways IGWs 8 | amazon.aws.ec2_vpc_igw_info: 9 | region: "{{ ec2_region | default('us-east-1') }}" 10 | register: igw_info 11 | 12 | - name: print out igw info 13 | ansible.builtin.debug: 14 | msg: "{{ igw_info }}" 15 | -------------------------------------------------------------------------------- /roles/template/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Template HTML report 3 | ansible.builtin.template: 4 | src: report.j2 5 | dest: "{{ playbook_dir }}/index.html" 6 | delegate_to: localhost 7 | run_once: true 8 | 9 | - name: Copy CSS and pictures 10 | ansible.builtin.copy: 11 | src: "{{ role_path }}/files" 12 | dest: "{{ playbook_dir }}" 13 | directory_mode: '0755' 14 | remote_src: yes 15 | delegate_to: localhost 16 | run_once: true 17 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/templates/header.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/templates/header.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/templates/header.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/header.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/templates/header.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /playbooks/info_instances.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create AWS resources 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | - name: retrieve information about all instances 8 | amazon.aws.ec2_instance_info: 9 | region: "{{ ec2_region | default('us-east-1') }}" 10 | register: ec2_instance_info 11 | 12 | - name: print instance info to terminal 13 | ansible.builtin.debug: 14 | msg: "{{ ec2_instance_info }}" 15 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/patch_windows/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scan packages 3 | demo.patching.win_scan_packages: 4 | check_mode: no 5 | 6 | - name: Scan Services 7 | demo.patching.win_scan_services: 8 | check_mode: no 9 | 10 | - name: Install Windows Updates 11 | ansible.windows.win_updates: 12 | category_names: "{{ win_update_categories | default(omit) }}" 13 | reboot: "{{ allow_reboot }}" 14 | state: installed 15 | register: patchingresult 16 | -------------------------------------------------------------------------------- /playbooks/stop_aws_ec2_instances.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: this Ansible Playbook will stop instances instances 3 | hosts: localhost 4 | gather_facts: false 5 | vars: 6 | ec2_region: "{{ your_region | default('us-east-1') }}" 7 | tasks: 8 | - name: stop every un-tagged running instance in a region. 9 | amazon.aws.ec2_instance: 10 | region: "{{ ec2_region }}" 11 | state: stopped 12 | instance_ids: "{{ identified_instances }}" 13 | when: identified_instances | length > 0 14 | -------------------------------------------------------------------------------- /roles/build_report_tags/defaults/main.yml: -------------------------------------------------------------------------------- 1 | reports_aws_region: us-east-1 2 | reports_aws_bucket_prefix: "{{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY_ID')[1:5] | lower }}" 3 | reports_aws_bucket_name: "{{ reports_aws_bucket_prefix }}-reports" 4 | reports_aws_bucket_permissions: public-read 5 | reports_aws_public_access: 6 | block_public_acls: false 7 | block_public_policy: false 8 | ignore_public_acls: false 9 | restrict_public_buckets: false 10 | reports_aws_report: vpc 11 | reports_aws_instance_filters: "{{ omit }}" -------------------------------------------------------------------------------- /roles/build_report_tags/templates/footer.j2: -------------------------------------------------------------------------------- 1 |
2 |

This report was created by the Ansible Cloud GitHub organization

3 | If you are new to Ansible Automation check out the following links:
4 | 🖱️ Interactive labs for Red Hat Ansible Automation Platform
5 | 🎬 Ansible Official YouTube
6 |

7 |
-------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/tasks/apache.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_vars: "{{ ansible_system }}.yml" 3 | 4 | - yum: 5 | name: httpd 6 | state: latest 7 | check_mode: no 8 | 9 | - file: 10 | path: "{{ doc_root }}/{{ reports_dir }}" 11 | state: directory 12 | check_mode: no 13 | 14 | - copy: 15 | dest: "{{ doc_root }}/{{ reports_dir }}/.htaccess" 16 | content: Options +Indexes 17 | check_mode: no 18 | 19 | - service: 20 | name: httpd 21 | state: started 22 | check_mode: no 23 | -------------------------------------------------------------------------------- /roles/retrieve_common_info/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: grab information about AWS user 3 | amazon.aws.aws_caller_info: 4 | region: "{{ ec2_region }}" 5 | register: whoami 6 | delegate_to: localhost 7 | 8 | - name: print whoami 9 | debug: 10 | var: whoami 11 | delegate_to: localhost 12 | 13 | - name: save username of AWS user 14 | set_fact: 15 | aws_user: '{{ whoami.arn.split("/")[-1] }}' 16 | py_cmd: >- 17 | {{ lookup('pipe', ansible_playbook_python ~ ' -c "import boto3; print(boto3.__version__)"') }} 18 | delegate_to: localhost -------------------------------------------------------------------------------- /playbooks/lab2-patching.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: "{{ HOSTS }}" 3 | become: yes 4 | vars: 5 | report_server: rhel1 6 | 7 | tasks: 8 | - include_role: 9 | name: "demo.patching.patch_linux" 10 | 11 | - block: 12 | 13 | - include_role: 14 | name: "{{ item }}" 15 | loop: 16 | - "demo.patching.report_server" 17 | - "demo.patching.report_linux" 18 | - "demo.patching.report_linux_patching" 19 | 20 | - include_role: 21 | name: "demo.patching.report_server" 22 | tasks_from: linux_landing_page 23 | 24 | delegate_to: "{{ report_server }}" 25 | run_once: yes 26 | -------------------------------------------------------------------------------- /roles/retrieve_info/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ec2_regions: 3 | - 'us-east-1' 4 | - 'us-east-2' 5 | - 'us-west-1' 6 | - 'us-west-2' 7 | - 'ca-central-1' 8 | # 'af-south-1' 9 | # - 'ap-east-1' 10 | # - 'ap-south-2' 11 | # - 'ap-southeast-3' 12 | # - 'ap-southeast-4' 13 | - 'ap-south-1' 14 | - 'ap-southeast-1' 15 | - 'ap-southeast-2' 16 | - 'ap-northeast-1' 17 | - 'ap-northeast-2' 18 | - 'ap-northeast-3' 19 | - 'eu-central-1' 20 | # - 'eu-central-2' 21 | - 'eu-west-1' 22 | - 'eu-west-2' 23 | - 'eu-west-3' 24 | # - 'eu-south-1' 25 | # - 'eu-south-2' 26 | - 'eu-north-1' 27 | # - 'me-south-1' 28 | # - 'me-central-1' 29 | - 'sa-east-1' 30 | # - 'us-gov-east-1' -------------------------------------------------------------------------------- /playbooks/aws_ssm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: ssm 3 | tasks: 4 | - name: do something 5 | command: ls -la 6 | register: output 7 | 8 | - name: print out output 9 | debug: 10 | var: output 11 | 12 | - name: do something 13 | vars: 14 | ansible_connection: "community.aws.aws_ssm" 15 | ansible_aws_ssm_region: "us-east-1" 16 | ansible_aws_ssm_bucket_name: "ssmtestingoctober" 17 | ansible_aws_ssm_instance_id: i-09793f817c1a29bf4 18 | ansible_user: ssm-user 19 | ansible.builtin.file: 20 | path: blah.txt 21 | state: touch 22 | register: output 23 | 24 | - name: print out output 25 | debug: 26 | var: output 27 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: create HTML report 2 | ansible.builtin.template: 3 | src: report.j2 4 | dest: "{{ file_path }}/network.html" 5 | 6 | - name: copy CSS over 7 | ansible.builtin.copy: 8 | src: "css" 9 | dest: "{{ file_path }}" 10 | directory_mode: true 11 | 12 | - name: copy logos over 13 | ansible.builtin.copy: 14 | src: "{{ item }}" 15 | dest: "{{ file_path }}" 16 | directory_mode: true 17 | loop: 18 | - "webpage_logo.png" 19 | - "redhat-ansible-logo.svg" 20 | - "router.png" 21 | 22 | - name: display link to inventory report 23 | ansible.builtin.debug: 24 | msg: "Please go to http://{{ ansible_host }}/network.html" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: create HTML report 2 | ansible.builtin.template: 3 | src: report.j2 4 | dest: "{{ file_path }}/windows.html" 5 | 6 | - name: copy CSS over 7 | ansible.builtin.copy: 8 | src: "css" 9 | dest: "{{ file_path }}" 10 | directory_mode: true 11 | 12 | - name: copy logos over 13 | ansible.builtin.copy: 14 | src: "{{ item }}" 15 | dest: "{{ file_path }}" 16 | directory_mode: true 17 | loop: 18 | - "webpage_logo.png" 19 | - "redhat-ansible-logo.svg" 20 | - "server.png" 21 | 22 | - name: display link to inventory report 23 | ansible.builtin.debug: 24 | msg: "Please go to http://{{ ansible_host }}/windows.html" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/README.md: -------------------------------------------------------------------------------- 1 | build_report_network 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from network devices 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html report on any number of Linux hosts using any number of network devices 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Network Report 33 | import_role: 34 | name: shadowman.reports.build_report_network 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Create HTML report 2 | ansible.windows.win_template: 3 | src: report.j2 4 | dest: "{{ file_path }}/windowspatch.html" 5 | check_mode: no 6 | 7 | - name: Copy CSS over 8 | ansible.windows.win_copy: 9 | src: "css" 10 | dest: "{{ file_path }}" 11 | directory_mode: true 12 | check_mode: no 13 | 14 | - name: Copy logo over 15 | ansible.windows.win_copy: 16 | src: "webpage_logo.png" 17 | dest: "{{ file_path }}" 18 | directory_mode: true 19 | check_mode: no 20 | 21 | - name: Display link to Patch report 22 | ansible.builtin.debug: 23 | msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/windowspatch.html" -------------------------------------------------------------------------------- /roles/retrieve_info/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: loop over all ec2 regions 3 | ansible.builtin.include_tasks: 4 | file: retrieve_info.yml 5 | loop: "{{ ec2_regions }}" 6 | 7 | - name: grab boto version 8 | ansible.builtin.pip: 9 | name: boto3 10 | register: register_boto3_version 11 | check_mode: true 12 | 13 | - name: grab information about AWS user 14 | amazon.aws.aws_caller_info: 15 | register: whoami 16 | delegate_to: localhost 17 | 18 | - name: save username of AWS user and boto3 version 19 | set_fact: 20 | aws_user: '{{ whoami.arn.split("/")[-1] }}' 21 | boto3_version: >- 22 | {{ lookup('pipe', ansible_playbook_python ~ ' -c "import boto3; print(boto3.__version__)"') | default('unknown') }} 23 | delegate_to: localhost -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/README.md: -------------------------------------------------------------------------------- 1 | build_report_windows_patch 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Windows update job 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html patching report on any number of Linux hosts using any number of Windows servers 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Windows Patch Report 33 | import_role: 34 | name: shadowman.reports.build_report_windows_patch 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/README.md: -------------------------------------------------------------------------------- 1 | build_report_windows_patch 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Windows update job 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html patching report on any number of Linux hosts using any number of Windows servers 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Windows Patch Report 33 | import_role: 34 | name: shadowman.reports.build_report_windows_patch 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/README.md: -------------------------------------------------------------------------------- 1 | build_report_linux 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Linux services and packages modules 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html report on any number of Linux hosts using any number of Linux servers about their services and packages installed 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Linux Report 33 | import_role: 34 | name: shadowman.reports.build_report_linux 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/README.md: -------------------------------------------------------------------------------- 1 | build_report_linux_patch 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Linux patching 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html report on any number of Linux hosts using any number of Linux servers about their patching results(yum and dnf) 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Windows Report 33 | import_role: 34 | name: shadowman.reports.build_report_linux_patch 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/tasks/iis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_vars: "{{ ansible_system }}.yml" 3 | 4 | - name: Install IIS 5 | ansible.windows.win_feature: 6 | name: Web-Server 7 | state: present 8 | check_mode: no 9 | 10 | - name: Start IIS service 11 | ansible.windows.win_service: 12 | name: W3Svc 13 | state: started 14 | check_mode: no 15 | 16 | - name: Create Directory 17 | ansible.windows.win_file: 18 | path: "{{ doc_root }}\\{{ reports_dir }}" 19 | state: directory 20 | check_mode: no 21 | 22 | - name: Enable Directory Browsing 23 | ansible.windows.win_powershell: 24 | script: | 25 | "Set-WebConfigurationProperty -filter /system.webServer/directoryBrowse -name enabled -value true -PSPath 'IIS:\Sites\Default Web Site\reports'" 26 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/README.md: -------------------------------------------------------------------------------- 1 | build_report_windows 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Windows services and packages modules 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html report on any number of Linux hosts using any number of Windows servers about their services and packages installed 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Windows Report 33 | import_role: 34 | name: shadowman.reports.build_report_windows 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/README.md: -------------------------------------------------------------------------------- 1 | build_report_windows 2 | ======== 3 | 4 | Installs Apache and creates a report based on facts from Windows services and packages modules 5 | 6 | Requirements 7 | ------------ 8 | 9 | Must run on Apache server 10 | 11 | Role Variables / Configuration 12 | -------------- 13 | 14 | N/A 15 | 16 | Dependencies 17 | ------------ 18 | 19 | N/A 20 | 21 | Example Playbook 22 | ---------------- 23 | 24 | The role can be used to create an html report on any number of Linux hosts using any number of Windows servers about their services and packages installed 25 | 26 | 27 | ``` 28 | --- 29 | - hosts: all 30 | 31 | tasks: 32 | - name: Run Windows Report 33 | import_role: 34 | name: shadowman.reports.build_report_windows 35 | 36 | ``` -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: create HTML report 2 | ansible.builtin.template: 3 | src: report.j2 4 | dest: "{{ file_path }}/linux.html" 5 | check_mode: no 6 | 7 | - name: copy CSS over 8 | ansible.builtin.copy: 9 | src: "css" 10 | dest: "{{ file_path }}" 11 | directory_mode: true 12 | check_mode: no 13 | 14 | - name: copy logos over 15 | ansible.builtin.copy: 16 | src: "{{ item }}" 17 | dest: "{{ file_path }}" 18 | directory_mode: true 19 | loop: 20 | - "webpage_logo.png" 21 | - "redhat-ansible-logo.svg" 22 | - "server.png" 23 | check_mode: no 24 | 25 | - name: display link to inventory report 26 | ansible.builtin.debug: 27 | msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/linux.html" 28 | -------------------------------------------------------------------------------- /playbooks/info_combined.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create AWS resources 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | 8 | - name: retrieve vpc information 9 | amazon.aws.ec2_vpc_net_info: 10 | region: "{{ ec2_region | default('us-east-1') }}" 11 | register: vpc_info 12 | 13 | - name: retrieve info for ec2 instances 14 | amazon.aws.ec2_instance_info: 15 | region: "{{ ec2_region | default('us-east-1') }}" 16 | register: ec2_instance_info 17 | 18 | - name: Gather information about Internet Gateways IGWs 19 | amazon.aws.ec2_vpc_igw_info: 20 | region: "{{ ec2_region | default('us-east-1') }}" 21 | register: igw_info 22 | 23 | - name: diplay AWS information to terminal 24 | debug: 25 | msg: "{{ lookup('template', 'templates/display.j2') }}" 26 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: create HTML report 3 | ansible.windows.win_template: 4 | src: report.j2 5 | dest: "{{ file_path }}/windows.html" 6 | check_mode: no 7 | 8 | - name: copy CSS over 9 | ansible.windows.win_copy: 10 | src: "css" 11 | dest: "{{ file_path }}" 12 | directory_mode: true 13 | check_mode: no 14 | 15 | - name: copy logos over 16 | ansible.windows.win_copy: 17 | src: "{{ item }}" 18 | dest: "{{ file_path }}" 19 | directory_mode: true 20 | loop: 21 | - "webpage_logo.png" 22 | - "redhat-ansible-logo.svg" 23 | - "server.png" 24 | check_mode: no 25 | 26 | #- name: display link to inventory report 27 | # ansible.builtin.debug: 28 | # msg: "Please go to http://{{ host_vars[report_server]['ansible_host'] }}/reports/windows.html" 29 | -------------------------------------------------------------------------------- /1dRHEL/1dwf2-Create-VPC.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: Play to Create AWS VPC 4 | hosts: localhost 5 | connection: local 6 | tasks: 7 | # VPC or Virtual Private Cloud. The instance will be tied to a subnet that belongs to this particular VPC 8 | - name: Create AWS VPC aws-demo1-vpc 9 | amazon.aws.ec2_vpc_net: 10 | name: "aws-demo1-vpc" 11 | cidr_block: "192.168.0.0/24" 12 | region: "{{ ec2_region }}" 13 | tags: 14 | Demo: "AWS demo1" 15 | register: create_vpc 16 | # 17 | - name: save the create_vpc variable for following job templates 18 | ansible.builtin.set_stats: 19 | data: 20 | vpcid: "{{ create_vpc.vpc.id }}" 21 | per_host: false 22 | # 23 | - name: print vpcid 24 | ansible.builtin.debug: 25 | msg: "The Demo1 VPC ID is: '{{ create_vpc.vpc.id }}'" 26 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/tasks/linux_landing_page.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_vars: "{{ ansible_system }}.yml" 3 | 4 | - name: get reports 5 | ansible.builtin.find: 6 | paths: "{{ doc_root }}/{{ reports_dir }}" 7 | patterns: '*.html' 8 | register: reports 9 | check_mode: no 10 | 11 | - name: publish landing page 12 | ansible.builtin.template: 13 | src: linux_report.j2 14 | dest: "{{ doc_root }}/index.html" 15 | check_mode: no 16 | 17 | - name: copy CSS over 18 | ansible.builtin.copy: 19 | src: "css" 20 | dest: "{{ doc_root }}" 21 | directory_mode: true 22 | check_mode: no 23 | 24 | - name: copy logos over 25 | ansible.builtin.copy: 26 | src: "{{ item }}" 27 | dest: "{{ doc_root }}" 28 | directory_mode: true 29 | loop: 30 | - "webpage_logo.png" 31 | - "redhat-ansible-logo.svg" 32 | - "report.png" 33 | check_mode: no 34 | 35 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/tasks/windows_landing_page.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_vars: "{{ ansible_system }}.yml" 3 | 4 | - name: get reports 5 | ansible.windows.win_find: 6 | paths: "{{ doc_root }}/{{ reports_dir }}" 7 | patterns: '*.html' 8 | register: reports 9 | check_mode: no 10 | 11 | - name: publish landing page 12 | ansible.builtin.win_template: 13 | src: windows_report.j2 14 | dest: "{{ doc_root }}/index.html" 15 | check_mode: no 16 | 17 | - name: copy CSS over 18 | ansible.builtin.win_copy: 19 | src: "css" 20 | dest: "{{ doc_root }}" 21 | directory_mode: true 22 | check_mode: no 23 | 24 | - name: copy logos over 25 | ansible.builtin.win_copy: 26 | src: "{{ item }}" 27 | dest: "{{ doc_root }}" 28 | directory_mode: true 29 | loop: 30 | - "webpage_logo.png" 31 | - "redhat-ansible-logo.svg" 32 | - "report.png" 33 | check_mode: no 34 | 35 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/plugins/modules/win_scan_packages.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | DOCUMENTATION = ''' 5 | --- 6 | module: win_scan_packages 7 | short_description: Return Package state information as fact data 8 | description: 9 | - Return Package state information as fact data for various Packages 10 | ''' 11 | 12 | EXAMPLES = ''' 13 | - monit: win_scan_packages 14 | # Example fact output: 15 | # host | success >> { 16 | # "ansible_facts": { 17 | # "packages": [ 18 | { 19 | "name": "Mozilla Firefox 76.0.1 (x64 en-US)", 20 | "version": "76.0.1", 21 | "publisher": "Mozilla", 22 | "arch": "Win64" 23 | }, 24 | { 25 | "name": "Mozilla Maintenance Service", 26 | "version": "76.0.1", 27 | "publisher": "Mozilla", 28 | "arch": "Win64" 29 | }, 30 | # } 31 | ''' -------------------------------------------------------------------------------- /1dRHEL/1dwf1-Create-ssh-key-pair.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: Play to Create the SSH key pair in AWS, and machine creds in Ansible controller 4 | hosts: localhost 5 | connection: local 6 | tasks: 7 | # It is possible to use a pre-existing key-pair, this is done just for simplicity 8 | - name: Create ssh key pair 9 | amazon.aws.ec2_key: 10 | region: "{{ ec2_region }}" 11 | name: "aws-demo1-key" 12 | register: create_key 13 | # 14 | - name: Update SSH key with latest 15 | ansible.controller.credential: 16 | name: AWS Demo1 Instance Key 17 | organization: Default 18 | credential_type: Machine 19 | state: present 20 | controller_username: "{{ controller_username }}" 21 | controller_password: "{{ controller_password }}" 22 | controller_host: "{{ controller_host }}" 23 | validate_certs: false 24 | inputs: 25 | ssh_key_data: "{{ create_key.key.private_key }}" 26 | when: create_key.changed 27 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/summary.j2: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Platform{{hostvars[network_switch]['ansible_net_system']}}
Code Version{{hostvars[network_switch]['ansible_net_version']}}
Model{{hostvars[network_switch]['ansible_net_model']|default("N/A")}}
Serial Number{{hostvars[network_switch]['ansible_net_serialnum']}}
Transport{{hostvars[network_switch]['ansible_net_api']}}
25 |
26 | -------------------------------------------------------------------------------- /roles/template/templates/ansible.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

Ansible Automation Info

5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Ansible user{{ ansible_user_id | default('unknown') }}
Ansible FQDN{{ ansible_fqdn | default('unknown') }}
Ansible core version{{ ansible_version.full }}
Ansible Python{{ ansible_python_version | default('unknown')}}
Host OS{{ ansible_distribution | default ("unknown distribution")}} {{ ansible_distribution_version | default ("unknown distro version") }}
30 |
31 |
32 |
33 | 34 | -------------------------------------------------------------------------------- /roles/build_report_linux/templates/ansible.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

Ansible Automation Info

5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Ansible user{{ ansible_user_id | default('unknown') }}
Ansible FQDN{{ ansible_fqdn | default('unknown') }}
Ansible core version{{ ansible_version.full }}
Ansible Python{{ ansible_python_version | default('unknown')}}
Host OS{{ ansible_distribution | default ("unknown distribution")}} {{ ansible_distribution_version | default ("unknown distro version") }}
30 |
31 |
32 |
33 | 34 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/patch_linux/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scan packages 3 | demo.patching.scan_packages: 4 | os_family: "{{ ansible_os_family }}" 5 | check_mode: no 6 | 7 | - name: Scan services 8 | demo.patching.scan_services: 9 | check_mode: no 10 | 11 | - name: upgrade packages (yum) 12 | ansible.builtin.yum: 13 | name: '*' 14 | state: latest 15 | exclude: "{{ exclude_packages }}" 16 | when: ansible_pkg_mgr == "yum" 17 | register: patchingresult_yum 18 | 19 | - name: upgrade packages (dnf) 20 | ansible.builtin.dnf: 21 | name: '*' 22 | state: latest 23 | exclude: "{{ exclude_packages }}" 24 | when: ansible_pkg_mgr == "dnf" 25 | register: patchingresult_dnf 26 | 27 | - name: Check to see if we need a reboot 28 | ansible.builtin.command: needs-restarting -r 29 | register: result 30 | changed_when: result.rc == 1 31 | failed_when: result.rc > 1 32 | check_mode: no 33 | 34 | - name: Reboot Server if Necessary 35 | ansible.builtin.reboot: 36 | when: 37 | - result.rc == 1 38 | - allow_reboot == true -------------------------------------------------------------------------------- /1dRHEL/1dwf4-Create-internet-gateway.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: Play to Create Internet Gateway and attache to VPC 4 | hosts: localhost 5 | connection: local 6 | tasks: 7 | # Create Internet Gateway and attach it to VPC. This allows instances on this VPC to reach the Internet 8 | - name: create vpc internet gateway for aws-demo1-vpc 9 | amazon.aws.ec2_vpc_igw: 10 | vpc_id: "{{ vpcid }}" 11 | region: "{{ ec2_region }}" 12 | tags: 13 | Name: aws_demo1_igw 14 | Demo: "AWS demo1" 15 | register: igw 16 | # 17 | # This task adds a route to the internet from the subnet through the IGW 18 | - name: This creates a default route (0.0.0.0/0) for the subnet to 19 | amazon.aws.ec2_vpc_route_table: 20 | region: "{{ ec2_region }}" 21 | vpc_id: "{{ vpcid }}" 22 | subnets: 23 | - "{{ vpcsubnetid }}" 24 | routes: 25 | - dest: 0.0.0.0/0 26 | gateway_id: "{{ igw.gateway_id }}" 27 | tags: 28 | Name: aws_demo1_default_route 29 | Demo: "AWS demo1" 30 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/plugins/modules/win_scan_services.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | DOCUMENTATION = ''' 5 | --- 6 | module: win_scan_services 7 | short_description: Return service state information as fact data 8 | description: 9 | - Return service state information as fact data for various service management utilities 10 | ''' 11 | 12 | EXAMPLES = ''' 13 | - monit: win_scan_services 14 | # Example fact output: 15 | # host | success >> { 16 | # "ansible_facts": { 17 | # "services": [ 18 | { 19 | "name": "AllJoyn Router Service", 20 | "win_svc_name": "AJRouter", 21 | "state": "stopped" 22 | }, 23 | { 24 | "name": "Application Layer Gateway Service", 25 | "win_svc_name": "ALG", 26 | "state": "stopped" 27 | }, 28 | { 29 | "name": "Application Host Helper Service", 30 | "win_svc_name": "AppHostSvc", 31 | "state": "running" 32 | }, 33 | # } 34 | ''' -------------------------------------------------------------------------------- /playbooks/lab2-deploy-application.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Application deployment Playbook 3 | hosts: "{{ HOSTS }}" 4 | gather_facts: false 5 | become: true 6 | 7 | tasks: 8 | - name: Make sure application is not empty 9 | ansible.builtin.assert: 10 | that: 11 | - "application != '' " 12 | 13 | - name: Print to terminal the application to be installed 14 | ansible.builtin.debug: 15 | msg: "This Ansible Playbook will install {{application}}" 16 | 17 | - name: Install the application(s) 18 | ansible.builtin.dnf: 19 | name: "{{application}}" 20 | allow_downgrade: true 21 | register: result 22 | 23 | - name: Print to terminal the applications that have been installed 24 | ansible.builtin.debug: 25 | msg: "The application: {{application}} has been installed" 26 | when: result.changed|bool 27 | 28 | - name: Print to terminal the applications that are already previously installed 29 | ansible.builtin.debug: 30 | msg: "The application: {{application}} was already installed" 31 | when: not result.changed|bool 32 | -------------------------------------------------------------------------------- /roles/retrieve_info/tasks/retrieve_info.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Retrieve vpc information for {{ item }} 3 | amazon.aws.ec2_vpc_net_info: 4 | region: "{{ item }}" 5 | register: vpc_info 6 | delegate_to: localhost 7 | 8 | - name: Retrieve info for ec2 instances 9 | amazon.aws.ec2_instance_info: 10 | region: "{{ item }}" 11 | filters: 12 | "{{ filter_tag | default(omit) }}" 13 | register: ec2_instance_info 14 | delegate_to: localhost 15 | 16 | - name: Retrieve information about Internet Gateways IGWs 17 | amazon.aws.ec2_vpc_igw_info: 18 | region: "{{ item }}" 19 | register: igw_info 20 | delegate_to: localhost 21 | 22 | # Dashes are not allowed as Ansible var names so we use underscores _ 23 | - name: Set facts all info for {{ item }} 24 | set_fact: 25 | '{{ item|replace("-", "_") }}': 26 | vpc_info: '{{ vpc_info }}' 27 | ec2_instance_info: '{{ ec2_instance_info }}' 28 | igw_info: '{{ igw_info }}' 29 | 30 | - name: Set facts all info for {{ item }} 31 | set_fact: 32 | all_ec2_regions: "{{ all_ec2_regions | default ([]) + [{ item|replace('-','_'): hostvars[inventory_hostname][item|replace('-','_')]}] }}" -------------------------------------------------------------------------------- /playbooks/templates/display.j2: -------------------------------------------------------------------------------- 1 | There are {{ vpc_info.vpcs | length }} AWS VPCs configured and {{ ec2_instance_info.instances | length }} instances on region {{ ec2_region | default('us-east-1') }} 2 | 3 | {{ '%-38s'|format('VPC name')}}{{ '%-18s'|format('cidr_block') }}{{ '%-28s'|format('VPC id') }}{{ '%-26s'|format('cidr block associations') }}{{ '%-12s'|format('instances') }}{{ '%-22s'|format('IGW') }} 4 | {% for vpc in vpc_info.vpcs %} 5 | {{ '%-38s'|format(vpc.tags['Name'] | default('Unspecified, missing name tag')) }}{{ '%-18s'|format(vpc.cidr_block) }}{{ '%-28s' | format(vpc.id) }}{{ '%-26s' | format(vpc.cidr_block_association_set | length | default('0')) }}{{ '%-12s'|format(ec2_instance_info.instances | selectattr('vpc_id', 'equalto', vpc.id ) | length) -}} 6 | {% set ns = namespace(igwfound=False) %} 7 | {%- for igw in igw_info.internet_gateways -%} 8 | {% if igw['attachments'] | length > 0 %} 9 | {% if igw['attachments'][0]['vpc_id'] == vpc.id %} 10 | {{ '%-22s'|format(igw['internet_gateway_id']) }} 11 | {% set ns.igwfound = True %} 12 | {% endif %} 13 | {% endif %} 14 | {%- endfor -%} 15 | {% if not ns.igwfound %} 16 | {{ '%-22s'|format('No IGW found') }} 17 | {% endif %} 18 | {% endfor %} 19 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Create HTML report 2 | ansible.builtin.template: 3 | src: report.j2 4 | dest: "{{ file_path }}/windowspatch.html" 5 | check_mode: no 6 | 7 | - name: Copy CSS over 8 | ansible.builtin.copy: 9 | src: "css" 10 | dest: "{{ file_path }}" 11 | directory_mode: true 12 | check_mode: no 13 | 14 | - name: Copy logo over 15 | ansible.builtin.copy: 16 | src: "webpage_logo.png" 17 | dest: "{{ file_path }}" 18 | directory_mode: true 19 | check_mode: no 20 | 21 | - name: Display link to Patch report 22 | ansible.builtin.debug: 23 | msg: "Please go to http://{{ ansible_host }}/windowspatch.html" 24 | 25 | - name: Send Report via E-mail 26 | community.general.mail: 27 | host: "{{ EMAIL_HOST }}" 28 | username: "{{ EMAIL_USERNAME }}" 29 | password: "{{ EMAIL_PASSWORD }}" 30 | port: "{{ EMAIL_PORT }}" 31 | subject: "Windows Patching Report" 32 | body: "{{ lookup('template', 'report.j2') }}" 33 | from: "{{ EMAIL_FROM }}" 34 | to: "{{ EMAIL_TO }}" 35 | subtype: html 36 | delegate_to: localhost 37 | become: false 38 | check_mode: no -------------------------------------------------------------------------------- /playbooks/cloud_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Build report with facts - Dynamic Documentation 3 | hosts: "{{ _aws_instances | default('none') }}" 4 | gather_facts: true 5 | 6 | tasks: 7 | - name: Load retrieve info role 8 | ansible.builtin.include_role: 9 | name: "../roles/retrieve_aws_instances_info" 10 | 11 | - name: Build report with facts - Dynamic Documentation 12 | hosts: "{{ _hosts | default('localhost') }}" 13 | gather_facts: true 14 | 15 | tasks: 16 | - name: Load retrieve info role 17 | ansible.builtin.include_role: 18 | name: "../roles/retrieve_info" 19 | 20 | - name: Template report into HTML 21 | ansible.builtin.include_role: 22 | name: "../roles/template" 23 | 24 | - name: Load report to host on Linux 25 | ansible.builtin.include_role: 26 | name: "../roles/build_report_linux" 27 | when: inventory_hostname != 'localhost' 28 | 29 | - name: Load report to host on AWS S3 30 | ansible.builtin.include_role: 31 | name: "../roles/build_report_s3" 32 | when: inventory_hostname == 'localhost' 33 | 34 | - name: Print all host_vars 35 | ansible.builtin.debug: 36 | var: hostvars 37 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Create HTML report 2 | ansible.builtin.template: 3 | src: report.j2 4 | dest: "{{ file_path }}/linuxpatch.html" 5 | check_mode: no 6 | 7 | - name: Copy CSS over 8 | ansible.builtin.copy: 9 | src: "css" 10 | dest: "{{ file_path }}" 11 | directory_mode: true 12 | check_mode: no 13 | 14 | - name: Copy logo over 15 | ansible.builtin.copy: 16 | src: "webpage_logo.png" 17 | dest: "{{ file_path }}" 18 | directory_mode: true 19 | check_mode: no 20 | 21 | - name: Display link to Linux patch report 22 | ansible.builtin.debug: 23 | msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/linuxpatch.html" 24 | 25 | 26 | #- name: Send Report via E-mail 27 | # community.general.mail: 28 | # host: "{{ EMAIL_HOST }}" 29 | # username: "{{ EMAIL_USERNAME }}" 30 | # password: "{{ EMAIL_PASSWORD }}" 31 | # port: "{{ EMAIL_PORT }}" 32 | # subject: "Linux Patching Report" 33 | # body: "{{ lookup('template', 'report.j2') }}" 34 | # from: "{{ EMAIL_FROM }}" 35 | # to: "{{ EMAIL_TO }}" 36 | # subtype: html 37 | # delegate_to: localhost 38 | # become: false 39 | # check_mode: no -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/plugins/modules/win_scan_services.ps1: -------------------------------------------------------------------------------- 1 | #!powershell 2 | # This file is part of Ansible 3 | # 4 | # Ansible is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Ansible is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with Ansible. If not, see . 16 | 17 | # WANT_JSON 18 | # POWERSHELL_COMMON 19 | 20 | $result = New-Object psobject @{ 21 | ansible_facts = New-Object psobject @{ 22 | services = Get-Service | 23 | Select-Object -Property @{Name="name"; Expression={$_."DisplayName"}}, 24 | @{Name="win_svc_name"; Expression={$_."Name"}}, 25 | @{Name="state"; Expression={$_."Status".ToString().ToLower()}} 26 | } 27 | changed = $false 28 | } 29 | 30 | Exit-Json $result; -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/templates/packages.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/templates/packages.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /playbooks/lab2-ec2-info.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Grab some specific details about the EC2 instances and display them 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | vars: 7 | ec2_region: "{{ your_region | default('us-east-1') }}" 8 | filter_tag: "{{ your_tag | default('*')}}" 9 | 10 | tasks: 11 | 12 | - name: Retrieve info for the EC2 instances 13 | amazon.aws.ec2_instance_info: 14 | region: "{{ ec2_region }}" 15 | register: ec2_instance_info 16 | 17 | - name: Display AWS EC2 information to terminal 18 | debug: 19 | msg: 20 | - "EC2 Instance Name: {{ item.tags['Name'] | default('The tag *Name* Does not exist') }}" 21 | - "EC2 Instance ID: {{ item.instance_id }}" 22 | - "EC2 Instance ID: {{ item.vpc_id }}" 23 | - "EC2 Instance Private DNS Name: {{ item.private_dns_name }}" 24 | - "EC2 Instance Private IP: {{ item.private_ip_address }}" 25 | - "EC2 Instance Public DNS Name: {{ item.public_dns_name }}" 26 | - "EC2 Instance Private IP: {{ item.public_ip_address }}" 27 | - "EC2 Instance State: {{ item.state.name }}" 28 | loop: "{{ ec2_instance_info.instances }}" 29 | loop_control: 30 | label: "Display the EC2 information that we desire" 31 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/templates/services.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/templates/services.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /playbooks/tag_info_aws.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Grab the tags on the VPC and EC2 instances and display them 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | vars: 7 | ec2_region: "{{ your_region | default('us-east-1') }}" 8 | 9 | tasks: 10 | 11 | - name: Retrieve the VPC information 12 | amazon.aws.ec2_vpc_net_info: 13 | region: "{{ ec2_region }}" 14 | register: vpc_info 15 | 16 | - name: Display AWS VPC IDs and tags information to terminal 17 | debug: 18 | msg: 19 | - "{{ item.id }}" 20 | - "{{ item.tags['Name'] | default('The tag *Name* Does not exist on this VPC') }}" 21 | - "{{ item.tags }}" 22 | loop: "{{ vpc_info.vpcs }}" 23 | loop_control: 24 | label: "VPC Info and all Tags on the VPC" 25 | 26 | - name: Retrieve info for the EC2 instances 27 | amazon.aws.ec2_instance_info: 28 | region: "{{ ec2_region }}" 29 | register: ec2_instance_info 30 | 31 | - name: Display AWS EC2 info and tags information to terminal 32 | debug: 33 | msg: 34 | - "{{ item.tags['Name'] | default('The tag *Name* Does not exist') }}" 35 | - "{{ item.instance_id }}" 36 | - "{{ item.tags }}" 37 | loop: "{{ ec2_instance_info.instances }}" 38 | loop_control: 39 | label: "EC2 info and associated tags" 40 | -------------------------------------------------------------------------------- /roles/build_report_s3/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create report bucket 3 | amazon.aws.s3_bucket: 4 | name: "{{ reports_aws_bucket_name }}" 5 | region: "{{ reports_aws_region }}" 6 | state: present 7 | policy: "{{ lookup('ansible.builtin.template', 'policy.json') }}" 8 | public_access: 9 | block_public_acls: false 10 | block_public_policy: false 11 | ignore_public_acls: false 12 | restrict_public_buckets: false 13 | 14 | - name: Configure bucket for website 15 | community.aws.s3_website: 16 | name: "{{ reports_aws_bucket_name }}" 17 | state: present 18 | 19 | - name: Put website files 20 | community.aws.s3_sync: 21 | bucket: "{{ reports_aws_bucket_name }}" 22 | file_root: "{{ playbook_dir }}/files" 23 | region: "{{ reports_aws_region }}" 24 | 25 | - name: Get bucket objects 26 | amazon.aws.s3_object_info: 27 | bucket_name: "{{ reports_aws_bucket_name }}" 28 | register: bucket_objects 29 | 30 | - name: Put index.html 31 | amazon.aws.s3_object: 32 | bucket: "{{ reports_aws_bucket_name }}" 33 | object: index.html 34 | src: "{{ playbook_dir }}/index.html" 35 | mode: put 36 | headers: 37 | ContentType: text/html 38 | 39 | - name: Print bucket URL 40 | ansible.builtin.debug: 41 | msg: "Bucket URL: http://{{ reports_aws_bucket_name }}.s3-website-{{ reports_aws_region }}.amazonaws.com" -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/templates/packages.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/templates/services.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /playbooks/lab3-challenge2.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Grab the tags on the VPC and EC2 instances and display them 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | vars: 7 | ec2_region: "{{ your_region | default('us-east-1') }}" 8 | filter_input: | 9 | "tag:Name": "rhel*" 10 | 11 | tasks: 12 | 13 | - name: Retrieve info for the EC2 instances 14 | amazon.aws.ec2_instance_info: 15 | region: "{{ ec2_region }}" 16 | filters: "{{ filter_input | from_yaml }}" 17 | register: ec2_instance_info 18 | 19 | - name: Display AWS EC2 info and tags information to terminal 20 | debug: 21 | msg: 22 | - "There are {{ ec2_instance_info.instances | length }} instances that match your filter" 23 | 24 | - name: Display AWS EC2 info and tags information to terminal 25 | debug: 26 | msg: 27 | - "{{ item.tags['Name'] | default('The tag *Name* Does not exist') }}" 28 | - "{{ item.instance_id }}" 29 | - "{{ item.tags }}" 30 | loop: "{{ ec2_instance_info.instances }}" 31 | loop_control: 32 | label: "EC2 info and associated tags" 33 | 34 | - name: save the instances to be used in a workflow variable for following job templates 35 | ansible.builtin.set_stats: 36 | data: 37 | identified_instances: "{{ ec2_instance_info.instances | map(attribute='instance_id') | list }}" 38 | per_host: false 39 | when: ec2_instance_info.instances | length > 0 40 | -------------------------------------------------------------------------------- /1dRHEL/1dwf3-Create-security-group.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: Play to Create the VPC security group, and subnet 4 | hosts: localhost 5 | connection: local 6 | tasks: 7 | # If a secruity group is not created, instances will be tied to the Default secruity group that allows all traffic (NON-SECURE) 8 | - name: Create EC2 security group aws-demo1-sg 9 | amazon.aws.ec2_group: 10 | name: "aws-demo1-sg" 11 | region: "{{ ec2_region }}" 12 | description: AWS demo1 SG for the demo 13 | vpc_id: "{{ vpcid }}" 14 | tags: 15 | Name: "aws-demo1-sg" 16 | Demo: "AWS demo1" 17 | rules: 18 | - proto: tcp 19 | ports: 22 20 | cidr_ip: 0.0.0.0/0 21 | 22 | # This task is subdiving up the 192.168.0.0/24 and getting a smaller chunk, a /28 23 | - name: Create subnet for aws-demo1-vpc 24 | amazon.aws.ec2_vpc_subnet: 25 | region: "{{ ec2_region }}" 26 | vpc_id: "{{ vpcid }}" 27 | cidr: "192.168.0.0/28" 28 | tags: 29 | Name: "aws_demo1_subnet" 30 | Demo: "AWS demo1" 31 | register: create_subnet 32 | # 33 | - name: save the create_subnet variable for following job templates 34 | ansible.builtin.set_stats: 35 | data: 36 | vpcsubnetid: "{{ create_subnet.subnet.id }}" 37 | per_host: false 38 | # 39 | - name: print the vpc subnet id 40 | ansible.builtin.debug: 41 | msg: "The Demo1 VPC Subnet ID is: '{{ create_subnet.subnet.id }}'" 42 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/ospf.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /roles/build_report_tags/templates/landing_page.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansible Linux Automation Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {% include 'header.j2' %} 16 |
17 |
18 |

Hybrid Cloud Reports

19 |

20 |

21 | 22 | 23 | {% for report in bucket_objects.s3_keys %} 24 | {% if report.endswith('.html') and report != 'index.html' %} 25 | 26 | 31 | 34 | {% endif %} 35 | {% endfor %} 36 | 37 |
27 |
28 | 29 |
30 |
32 | {{ report }} 33 |
38 | {% include 'footer.j2' %} 39 |
40 | 41 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/lacp.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /roles/retrieve_aws_instances_info/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Check Services 3 | ansible.builtin.service_facts: 4 | register: service_facts 5 | 6 | - name: Check if /etc/motd file exists 7 | ansible.builtin.stat: 8 | path: /etc/motd 9 | register: motd_file 10 | 11 | - name: Check if selinux is enabled 12 | ansible.builtin.command: getenforce 13 | register: selinux_status 14 | 15 | - name: Check IP address 16 | ansible.builtin.debug: 17 | var: ansible_default_ipv4.address 18 | 19 | - name: Retrieve EC2 instance information based on private IP address 20 | amazon.aws.ec2_instance_info: 21 | region: us-west-1 22 | filters: 23 | "network-interface.private-ip-address": "{{ ansible_default_ipv4.address }}" 24 | register: ec2_info 25 | delegate_to: localhost 26 | 27 | - name: Print out instance EC2 facts 28 | ansible.builtin.debug: 29 | var: ec2_info 30 | 31 | - name: Check if the web URL is responding 32 | ansible.builtin.uri: 33 | url: "http://{{ ec2_info.instances[0].public_dns_name }}" 34 | validate_certs: false 35 | register: webserver 36 | failed_when: webserver.status is undefined or webserver.status == "" 37 | 38 | - name: Check if oscap-reports web URL is responding 39 | ansible.builtin.uri: 40 | url: "http://{{ ec2_info.instances[0].public_dns_name }}/oscap-reports/" 41 | validate_certs: false 42 | register: openscap_webserver 43 | failed_when: openscap_webserver.status is undefined or openscap_webserver.status == "" 44 | 45 | - name: Print out webserver info 46 | ansible.builtin.debug: 47 | var: webserver 48 | 49 | - name: Print out openscap_webserver info 50 | ansible.builtin.debug: 51 | var: openscap_webserver -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/vlans.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/templates/linux_report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Linux Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | {% include 'header.j2' %} 16 |
17 |
18 |

Ansible Automation Reports

19 |

20 |

21 | 22 | 23 | {% for report in reports.files %} 24 | {% set page = report.path.split('/')[-1] %} 25 | 26 | 31 | 34 | {% endfor %} 35 | 36 |
27 |
28 |

29 |
30 |
32 | {{ page }} 33 |
37 |

Created with


38 |
39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/templates/windows_report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Linux Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | {% include 'header.j2' %} 16 |
17 |
18 |

Ansible Automation Reports

19 |

20 |

21 | 22 | 23 | {% for report in reports.files %} 24 | {% set page = report.path.split('\\')[-1] %} 25 | 26 | 31 | 34 | {% endfor %} 35 | 36 |
27 |
28 |

29 |
30 |
32 | {{ page }} 33 |
37 |

Created with


38 |
39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /roles/build_report_linux/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install apache 3 | become: true 4 | yum: 5 | name: httpd 6 | state: present 7 | 8 | - name: change apache to specified port 9 | become: true 10 | lineinfile: 11 | path: /etc/httpd/conf/httpd.conf 12 | regexp: '^Listen ' 13 | insertafter: '^#Listen ' 14 | line: 'Listen {{web_port}}' 15 | 16 | - name: Set nis_enabled flag on and keep it persistent across reboots 17 | become: true 18 | seboolean: 19 | name: nis_enabled 20 | state: true 21 | persistent: true 22 | 23 | - name: start httpd 24 | become: true 25 | service: 26 | name: httpd 27 | state: started 28 | 29 | - name: create HTML report 30 | become: true 31 | template: 32 | src: report.j2 33 | dest: "{{ file_path }}/index.html" 34 | 35 | - name: copy CSS over 36 | become: true 37 | copy: 38 | src: "css" 39 | dest: "{{ file_path }}" 40 | directory_mode: true 41 | 42 | - name: copy CSS over 43 | become: true 44 | copy: 45 | src: "{{ item }}" 46 | dest: "{{ file_path }}" 47 | directory_mode: true 48 | loop: 49 | - "webpage_logo.png" 50 | - "redhat-ansible-logo.svg" 51 | - "aws.png" 52 | 53 | - name: print variables 54 | debug: 55 | var: hostvars['ansible-1'] 56 | 57 | - name: retrieve public IP address 58 | ansible.builtin.command: curl https://ifconfig.me 59 | register: public_ip_report 60 | ignore_errors: true 61 | 62 | - name: display link to inventory report 63 | debug: 64 | msg: 65 | - "Please go to http://{{ public_ip_report.stdout | default(ansible_fqdn) }}:{{ web_port }}" 66 | - "or just refresh the Cloud Report tab" 67 | - "at the top of your window if you using Instruqt labs!" 68 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/lldp_interfaces.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /playbooks/aws_ssm_assume.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: ssm 3 | gather_facts: false 4 | tasks: 5 | 6 | # This is assuming a role SSMSeanTesting configured under IAM 7 | - name: SSMrole 8 | community.aws.sts_assume_role: 9 | role_arn: arn:aws:iam::962147768365:role/SSMSeanTesting 10 | role_session_name: "seantestrole" 11 | register: assumed_role 12 | delegate_to: localhost 13 | run_once: true 14 | 15 | - name: print out assumed_role info 16 | debug: 17 | var: assumed_role 18 | 19 | # The SSMSeanTestingRole has 2 acces permissions and works 20 | # AmazonSSMFullAccess 21 | # AmazonS3FullAccess 22 | - name: do file module via SSM 23 | vars: 24 | ansible_aws_ssm_access_key_id: "{{ assumed_role.sts_creds.access_key }}" 25 | ansible_aws_ssm_secret_access_key: "{{ assumed_role.sts_creds.secret_key }}" 26 | ansible_aws_ssm_session_token: "{{ assumed_role.sts_creds.session_token }}" 27 | ansible_connection: "community.aws.aws_ssm" 28 | ansible_aws_ssm_region: "us-east-1" 29 | ansible_aws_ssm_bucket_name: "ssmtestingoctober" 30 | ansible_aws_ssm_instance_id: i-09793f817c1a29bf4 31 | ansible_user: ssm-user 32 | ansible.builtin.file: 33 | path: blah.txt 34 | state: touch 35 | register: output 36 | 37 | - name: print out output 38 | debug: 39 | var: output 40 | 41 | # This won't work b/c the assume role can only do S3 and SSM 42 | - amazon.aws.ec2_tag: 43 | aws_access_key: "{{ assumed_role.sts_creds.access_key }}" 44 | aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}" 45 | security_token: "{{ assumed_role.sts_creds.session_token }}" 46 | resource: vpc-0ae1d7baeaa323b44 47 | state: present 48 | tags: 49 | Name: craigcraig-f5-vpc 50 | delegate_to: localhost 51 | run_once: true 52 | -------------------------------------------------------------------------------- /roles/build_report_linux/templates/vpc.backup: -------------------------------------------------------------------------------- 1 | 2 |
3 | {% for ec2_region in all_ec2_regions %} 4 |
5 |

{{ ec2_region | default('unknown') }}

6 |
7 |

There are {{ vpc_info.vpcs | length }} AWS VPCs configured and {{ ec2_instance_info.instances | length }} instances on region {{ ec2_region | default('unknown') }} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for vpc in vpc_info.vpcs %} 20 | 21 | 22 | 23 | 24 | 25 | 26 | {% set ns = namespace(igwfound=False) %} 27 | {%- for igw in igw_info.internet_gateways -%} 28 | {% if igw['attachments'] | length > 0 %} 29 | {% if igw['attachments'][0]['vpc_id'] == vpc.id %} 30 | 31 | {% set ns.igwfound = True %} 32 | {% endif %} 33 | {% endif %} 34 | {%- endfor -%} 35 | {% if not ns.igwfound %} 36 | 37 | {% endif %} 38 | 39 | {% endfor %} 40 | 41 |
{{ '%-38s'|format('VPC name')}}{{ '%-28s'|format('VPC id') }}{{ '%-14s'|format('instances') }}{{ '%-18s'|format('CIDR block') }}{{ '%-26s'|format('CIDR block associations') }}{{ '%-22s'|format('IGW') }}
{{ '%-38s'|format(vpc.tags['Name'] | default('Unspecified, missing name tag')) }}{{ '%-28s' | format(vpc.id) }}{{ '%-14s'|format(ec2_instance_info.instances | selectattr('vpc_id', 'equalto', vpc.id ) | length) -}}{{ '%-18s'|format(vpc.cidr_block) }}{{ '%-26s' | format(vpc.cidr_block_association_set | length | default('0')) }}{{ '%-22s'|format(igw['internet_gateway_id']) }}{{ '%-22s'|format('No IGW found') }}
42 |

43 |
44 | {% endfor %} 45 |
46 | 47 | -------------------------------------------------------------------------------- /1dRHEL/1dwf5-Create-RHEL-server.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: provision RHEL on Amazon Web Services EC2 4 | hosts: localhost 5 | connection: local 6 | # The paramater region will be set for all ec2 modules by specifying it here under module_defaults 7 | vars: 8 | instance_name: "aws-demo1-ec2" 9 | owner_tag: "aws-demo1-user" 10 | ec2_region: "{{ your_region | default('us-east-2') }}" 11 | # 12 | tasks: 13 | # Using ec2_ami_facts allows us to find a particular ami instance id regardless of region 14 | # Look for owner 309956199498 to find official Red Hat AMIs 15 | - name: find the AMI instance-id for RHEL 16 | amazon.aws.ec2_ami_info: 17 | region: "{{ ec2_region }}" 18 | owners: 309956199498 19 | filters: 20 | name: "RHEL-8*HVM-*Hourly*" 21 | architecture: x86_64 22 | register: amis 23 | # 24 | # The module ec2_ami_facts can return multiple ami instances for a given search 25 | # we will grab the latest instance (by date) that meets our criteria 26 | - name: SET AMI FOR SERVER01 27 | ansible.builtin.set_fact: 28 | server01_ami: > 29 | {{ amis.images | selectattr('name', 'defined') | sort(attribute='creation_date') | last }} 30 | # 31 | # the ec2 module actually provisions the instance 32 | # group refers to the AWS Security Group 33 | # key_name refers to the SSH key pair to use for this instance 34 | # vpc_subnet_id refers to the Virtual Private Cloud (VPC) subnet idenitifer to tie the instance to 35 | - name: Create EC2 instances for aws-demo1-ec2 36 | amazon.aws.ec2_instance: 37 | region: "{{ ec2_region }}" 38 | name: "aws-demo1-ec2" 39 | key_name: "aws-demo1-key" 40 | network: 41 | assign_public_ip: yes 42 | vpc_subnet_id: "{{ vpcsubnetid }}" 43 | security_group: aws-demo1-sg 44 | instance_type: t2.medium 45 | image_id: "{{ server01_ami.image_id }}" 46 | wait: true 47 | exact_count: 1 48 | tags: 49 | owner: "{{ owner_tag }}" 50 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/interfaces.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 7 | 39 |
40 |
41 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/l2_interfaces.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 35 |
36 |
37 | -------------------------------------------------------------------------------- /roles/build_report_tags/templates/tags_report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansible Linux Automation Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | {% include 'header.j2' %} 25 |
26 |
27 |

AWS Instance Report

28 |

29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {% for vm in ec2_instance_info.instances %} 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 59 | 60 | {% endfor %} 61 | 62 |
{{ '%-38s'|format('Name')}}{{ '%-28s'|format('Instance Id') }}{{ '%-14s'|format('Type') }}{{ '%-18s'|format('Launch Time') }}{{ '%-26s'|format('VPC ID') }}{{ '%-22s'|format('Subnet ID') }}{{ '%-20s'|format('Tags') }}
{{ '%-38s'|format(vm.tags['Name'] | default('Unspecified, missing name tag')) }}{{ '%-28s'|format(vm.instance_id) }}{{ '%-14s'|format(vm.instance_type) }}{{ '%-18s'|format(vm.launch_time) }}{{ '%-26s'|format(vm.vpc_id) }}{{ '%-26s'|format(vm.subnet_id) }} 50 | 51 | {% for tag in vm.tags | sort %} 52 | 53 | 54 | 55 | 56 | {% endfor %} 57 |
{{ tag }}{{ vm.tags[tag] }}
58 |
63 | {% include 'footer.j2' %} 64 |
65 | 66 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/files/css/main.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | } 6 | 7 | #subtable { 8 | background: #ebebeb; 9 | margin: 0px; 10 | } 11 | 12 | #subtable tbody tr td { 13 | padding: 5px 5px 5px 5px; 14 | } 15 | 16 | #subtable thead th { 17 | padding: 5px; 18 | } 19 | 20 | * { 21 | -moz-box-sizing: border-box; 22 | -webkit-box-sizing: border-box; 23 | box-sizing: border-box; 24 | font-family: "Open Sans", "Helvetica"; 25 | 26 | } 27 | 28 | a { 29 | color: #ffffff; 30 | } 31 | 32 | p { 33 | color: #ffffff; 34 | } 35 | h1 { 36 | text-align: center; 37 | color: #ffffff; 38 | } 39 | 40 | body { 41 | background:#353a40; 42 | } 43 | 44 | table { 45 | border-collapse: separate; 46 | background:#fff; 47 | @include border-radius(5px); 48 | margin:50px auto; 49 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 50 | } 51 | 52 | thead { 53 | @include border-radius(5px); 54 | } 55 | 56 | thead th { 57 | font-family: 'Patua One', monospace; 58 | font-size:16px; 59 | font-weight:400; 60 | color:#fff; 61 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 62 | text-align:left; 63 | padding:20px; 64 | border-top:1px solid #858d99; 65 | background: #353a40; 66 | 67 | &:first-child { 68 | @include border-top-left-radius(5px); 69 | } 70 | 71 | &:last-child { 72 | @include border-top-right-radius(5px); 73 | } 74 | } 75 | 76 | tbody tr td { 77 | font-family: 'Open Sans', sans-serif; 78 | font-weight:400; 79 | color:#5f6062; 80 | font-size:13px; 81 | padding:20px 20px 20px 20px; 82 | border-bottom:1px solid #e0e0e0; 83 | 84 | } 85 | 86 | tbody tr:nth-child(2n) { 87 | background:#f0f3f5; 88 | } 89 | 90 | tbody tr:last-child td { 91 | border-bottom:none; 92 | &:first-child { 93 | @include border-bottom-left-radius(5px); 94 | } 95 | &:last-child { 96 | @include border-bottom-right-radius(5px); 97 | } 98 | } 99 | 100 | span.highlight { 101 | background-color: yellow; 102 | } 103 | 104 | .expandclass { 105 | color: #5f6062; 106 | } 107 | 108 | .content{ 109 | display:none; 110 | margin: 10px; 111 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/files/css/main.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | } 6 | 7 | #subtable { 8 | background: #ebebeb; 9 | margin: 0px; 10 | } 11 | 12 | #subtable tbody tr td { 13 | padding: 5px 5px 5px 5px; 14 | } 15 | 16 | #subtable thead th { 17 | padding: 5px; 18 | } 19 | 20 | * { 21 | -moz-box-sizing: border-box; 22 | -webkit-box-sizing: border-box; 23 | box-sizing: border-box; 24 | font-family: "Open Sans", "Helvetica"; 25 | 26 | } 27 | 28 | a { 29 | color: #ffffff; 30 | } 31 | 32 | p { 33 | color: #ffffff; 34 | } 35 | h1 { 36 | text-align: center; 37 | color: #ffffff; 38 | } 39 | 40 | body { 41 | background:#353a40; 42 | } 43 | 44 | table { 45 | border-collapse: separate; 46 | background:#fff; 47 | @include border-radius(5px); 48 | margin:50px auto; 49 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 50 | } 51 | 52 | thead { 53 | @include border-radius(5px); 54 | } 55 | 56 | thead th { 57 | font-family: 'Patua One', monospace; 58 | font-size:16px; 59 | font-weight:400; 60 | color:#fff; 61 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 62 | text-align:left; 63 | padding:20px; 64 | border-top:1px solid #858d99; 65 | background: #353a40; 66 | 67 | &:first-child { 68 | @include border-top-left-radius(5px); 69 | } 70 | 71 | &:last-child { 72 | @include border-top-right-radius(5px); 73 | } 74 | } 75 | 76 | tbody tr td { 77 | font-family: 'Open Sans', sans-serif; 78 | font-weight:400; 79 | color:#5f6062; 80 | font-size:13px; 81 | padding:20px 20px 20px 20px; 82 | border-bottom:1px solid #e0e0e0; 83 | 84 | } 85 | 86 | tbody tr:nth-child(2n) { 87 | background:#f0f3f5; 88 | } 89 | 90 | tbody tr:last-child td { 91 | border-bottom:none; 92 | &:first-child { 93 | @include border-bottom-left-radius(5px); 94 | } 95 | &:last-child { 96 | @include border-bottom-right-radius(5px); 97 | } 98 | } 99 | 100 | span.highlight { 101 | background-color: yellow; 102 | } 103 | 104 | .expandclass { 105 | color: #5f6062; 106 | } 107 | 108 | .content{ 109 | display:none; 110 | margin: 10px; 111 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/files/css/main.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | } 6 | 7 | #subtable { 8 | background: #ebebeb; 9 | margin: 0px; 10 | } 11 | 12 | #subtable tbody tr td { 13 | padding: 5px 5px 5px 5px; 14 | } 15 | 16 | #subtable thead th { 17 | padding: 5px; 18 | } 19 | 20 | * { 21 | -moz-box-sizing: border-box; 22 | -webkit-box-sizing: border-box; 23 | box-sizing: border-box; 24 | font-family: "Open Sans", "Helvetica"; 25 | 26 | } 27 | 28 | a { 29 | color: #ffffff; 30 | } 31 | 32 | p { 33 | color: #ffffff; 34 | } 35 | h1 { 36 | text-align: center; 37 | color: #ffffff; 38 | } 39 | 40 | body { 41 | background:#353a40; 42 | } 43 | 44 | table { 45 | border-collapse: separate; 46 | background:#fff; 47 | @include border-radius(5px); 48 | margin:50px auto; 49 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 50 | } 51 | 52 | thead { 53 | @include border-radius(5px); 54 | } 55 | 56 | thead th { 57 | font-family: 'Patua One', monospace; 58 | font-size:16px; 59 | font-weight:400; 60 | color:#fff; 61 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 62 | text-align:left; 63 | padding:20px; 64 | border-top:1px solid #858d99; 65 | background: #353a40; 66 | 67 | &:first-child { 68 | @include border-top-left-radius(5px); 69 | } 70 | 71 | &:last-child { 72 | @include border-top-right-radius(5px); 73 | } 74 | } 75 | 76 | tbody tr td { 77 | font-family: 'Open Sans', sans-serif; 78 | font-weight:400; 79 | color:#5f6062; 80 | font-size:13px; 81 | padding:20px 20px 20px 20px; 82 | border-bottom:1px solid #e0e0e0; 83 | 84 | } 85 | 86 | tbody tr:nth-child(2n) { 87 | background:#f0f3f5; 88 | } 89 | 90 | tbody tr:last-child td { 91 | border-bottom:none; 92 | &:first-child { 93 | @include border-bottom-left-radius(5px); 94 | } 95 | &:last-child { 96 | @include border-bottom-right-radius(5px); 97 | } 98 | } 99 | 100 | span.highlight { 101 | background-color: yellow; 102 | } 103 | 104 | .expandclass { 105 | color: #5f6062; 106 | } 107 | 108 | .content{ 109 | display:none; 110 | margin: 10px; 111 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/l3_interfaces.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 56 |
57 |
58 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/plugins/modules/win_scan_packages.ps1: -------------------------------------------------------------------------------- 1 | #!powershell 2 | # This file is part of Ansible 3 | # 4 | # Ansible is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Ansible is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with Ansible. If not, see . 16 | 17 | # WANT_JSON 18 | # POWERSHELL_COMMON 19 | 20 | $uninstall_native_path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" 21 | $uninstall_wow6432_path = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" 22 | 23 | if ([System.IntPtr]::Size -eq 4) { 24 | 25 | # This is a 32-bit Windows system, so we only check for 32-bit programs, which will be 26 | # at the native registry location. 27 | 28 | [PSObject []]$packages = Get-ChildItem -Path $uninstall_native_path | 29 | Get-ItemProperty | 30 | Select-Object -Property @{Name="name"; Expression={$_."DisplayName"}}, 31 | @{Name="version"; Expression={$_."DisplayVersion"}}, 32 | @{Name="publisher"; Expression={$_."Publisher"}}, 33 | @{Name="arch"; Expression={ "Win32" }} | 34 | Where-Object { $_.name } 35 | 36 | } else { 37 | 38 | # This is a 64-bit Windows system, so we check for 64-bit programs in the native 39 | # registry location, and also for 32-bit programs under Wow6432Node. 40 | 41 | [PSObject []]$packages = Get-ChildItem -Path $uninstall_native_path | 42 | Get-ItemProperty | 43 | Select-Object -Property @{Name="name"; Expression={$_."DisplayName"}}, 44 | @{Name="version"; Expression={$_."DisplayVersion"}}, 45 | @{Name="publisher"; Expression={$_."Publisher"}}, 46 | @{Name="arch"; Expression={ "Win64" }} | 47 | Where-Object { $_.name } 48 | 49 | $packages += Get-ChildItem -Path $uninstall_wow6432_path | 50 | Get-ItemProperty | 51 | Select-Object -Property @{Name="name"; Expression={$_."DisplayName"}}, 52 | @{Name="version"; Expression={$_."DisplayVersion"}}, 53 | @{Name="publisher"; Expression={$_."Publisher"}}, 54 | @{Name="arch"; Expression={ "Win32" }} | 55 | Where-Object { $_.name } 56 | 57 | } 58 | 59 | $result = New-Object psobject @{ 60 | ansible_facts = New-Object psobject @{ 61 | packages = $packages 62 | } 63 | changed = $false 64 | } 65 | 66 | Exit-Json $result; -------------------------------------------------------------------------------- /roles/build_report_linux/templates/vpc.backupApril172023: -------------------------------------------------------------------------------- 1 | 2 |
3 | {% for ec2_region in all_ec2_regions %} 4 | {% for key, value in ec2_region.items() %} 5 | {% set running = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "running") | length %} 6 | {% set stopped = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "stopped") | length %} 7 | {% set total = value.ec2_instance_info.instances | length %} 8 |
9 |

{{ key | default('unknown') }}
{% if total > 0 %}{% if running > 0 %}
{% endif %}{{ running }} instances running{% if running > 0 %}
{% endif %}
{{ stopped }} stopped ({{ total }} total)
{% endif %}

10 |
11 |

There are {{ value.vpc_info.vpcs | length }} AWS VPCs configured and {{ total }} instances on region {{ key | default('unknown') }}

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {% for vpc in value.vpc_info.vpcs %} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {% set ns = namespace(igwfound=False) %} 33 | {% for igw in value.igw_info.internet_gateways %} 34 | {% if igw['attachments'] | length > 0 %} 35 | {% if igw['attachments'][0]['vpc_id'] is defined %} 36 | {% if igw['attachments'][0]['vpc_id'] == vpc.id %} 37 | 38 | {% set ns.igwfound = True %} 39 | {% endif %} 40 | {% endif %} 41 | {% endif %} 42 | {%- endfor -%} 43 | {% if not ns.igwfound %} 44 | 45 | {% endif %} 46 | 47 | {% endfor %} 48 | 49 |
VPC nameVPC idinstances
running
instances
stopped
CIDR blockCIDR block
associations
IGW
{{ vpc.tags['Name'] | default('Unspecified, missing name tag') }}{{ vpc.id }}{{ value.ec2_instance_info.instances | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "running") | length }}{{ value.ec2_instance_info.instances | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "stopped") | length }}{{ vpc.cidr_block }}{{ vpc.cidr_block_association_set | length | default('0') }}{{ igw['internet_gateway_id'] }}No IGW found
50 |
51 |
52 | {% endfor %} 53 | {% endfor %} 54 |
55 | 56 | -------------------------------------------------------------------------------- /roles/build_report_tags/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create report bucket 3 | amazon.aws.s3_bucket: 4 | name: "{{ reports_aws_bucket_name }}" 5 | region: "{{ reports_aws_region }}" 6 | state: present 7 | acl: "{{ reports_aws_bucket_permissions }}" 8 | public_access: "{{ reports_aws_public_access }}" 9 | object_ownership: BucketOwnerPreferred 10 | 11 | - name: Configure bucket for website 12 | community.aws.s3_website: 13 | name: "{{ reports_aws_bucket_name }}" 14 | state: present 15 | suffix: index.html 16 | error_key: index.html 17 | 18 | - name: Put website files 19 | community.aws.s3_sync: 20 | bucket: "{{ reports_aws_bucket_name }}" 21 | file_root: "{{ role_path }}/files" 22 | permission: "{{ reports_aws_bucket_permissions }}" 23 | mime_map: 24 | .css: text/css 25 | .js: application/javascript 26 | .png: image/png 27 | .jpg: image/jpeg 28 | .jpeg: image/jpeg 29 | .gif: image/gif 30 | .svg: image/svg+xml 31 | 32 | - name: Retrieve instance information 33 | amazon.aws.ec2_instance_info: 34 | filters: "{{ reports_aws_instance_filters }}" 35 | region: "{{ reports_aws_region }}" 36 | register: ec2_instance_info 37 | 38 | - name: Ensure build directory exists 39 | ansible.builtin.file: 40 | path: "{{ playbook_dir }}/.build" 41 | state: directory 42 | delegate_to: localhost 43 | run_once: true 44 | 45 | - name: Render tags-report locally 46 | ansible.builtin.template: 47 | src: tags_report.j2 48 | dest: "{{ playbook_dir }}/.build/tag-report.html" 49 | delegate_to: localhost 50 | run_once: true 51 | 52 | - name: Put tags-report 53 | amazon.aws.s3_object: 54 | bucket: "{{ reports_aws_bucket_name }}" 55 | object: tag-report.html 56 | src: "{{ playbook_dir }}/.build/tag-report.html" 57 | mode: put 58 | permission: "{{ reports_aws_bucket_permissions }}" 59 | headers: 60 | ContentType: "text/html; charset=utf-8" 61 | ContentDisposition: inline 62 | CacheControl: "no-cache, no-store, must-revalidate" 63 | 64 | - name: Get bucket objects 65 | amazon.aws.s3_object_info: 66 | bucket_name: "{{ reports_aws_bucket_name }}" 67 | register: bucket_objects 68 | 69 | - name: Render index locally 70 | ansible.builtin.template: 71 | src: landing_page.j2 72 | dest: "{{ playbook_dir }}/.build/index.html" 73 | delegate_to: localhost 74 | run_once: true 75 | 76 | - name: Put index.html 77 | amazon.aws.s3_object: 78 | bucket: "{{ reports_aws_bucket_name }}" 79 | object: index.html 80 | src: "{{ playbook_dir }}/.build/index.html" 81 | mode: put 82 | permission: "{{ reports_aws_bucket_permissions }}" 83 | force: different 84 | headers: 85 | ContentType: "text/html; charset=utf-8" 86 | ContentDisposition: inline 87 | 88 | - name: Print bucket url 89 | ansible.builtin.debug: 90 | msg: "Bucket URL: http://{{ reports_aws_bucket_name }}.s3-website.{{ reports_aws_region }}.amazonaws.com" -------------------------------------------------------------------------------- /roles/build_report_linux/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cloud Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 19 | 20 | 21 | {% include 'header.j2' %} 22 |
23 |
24 |

Ansible Hybrid Cloud Automation Example Report

25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 69 | 70 | 73 | 74 | 75 | 76 |
Public CloudRegion
36 |
37 | picture of cloud 38 |

AWS

39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
Boto3 Version{{ boto3_version | default ('unknown')}}
AWS user{{ aws_user | default('unknown') }}
Account ID{{ whoami.account | default('unknown') }}
Account Alias{{ whoami.account_alias | default ('unknown')}}
61 | 62 | 63 | {% include 'ansible.j2' %} 64 |
65 | 66 | 67 | 68 |
71 | {% include 'vpc.j2' %} 72 |
77 |

Created with


red hat ansible automation platform logo 78 |

The source code to create this report can be found at https://github.com/ansible-cloud/aws_demos

79 | If you are new to Ansible Automation check out the following links:
80 | Getting Started
81 | Free hands-on workshops
82 | Youtube Videos
83 |

84 |
85 |
86 |
87 | 88 | 89 | -------------------------------------------------------------------------------- /roles/template/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cloud Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | 23 | {% include 'header.j2' %} 24 |
25 |
26 |

Ansible Hybrid Cloud Automation Example Report

27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 71 | 72 | 75 | 76 | 77 | 78 |
Public CloudRegion
38 |
39 | picture of cloud 40 |

AWS

41 |
42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
Boto3 Version{{ boto3_version | default ('unknown')}}
AWS user{{ aws_user | default('unknown') }}
Account ID{{ whoami.account | default('unknown') }}
Account Alias{{ whoami.account_alias | default ('unknown')}}
63 | 64 | 65 | {% include 'ansible.j2' %} 66 |
67 | 68 | 69 | 70 |
73 | {% include 'vpc.j2' %} 74 |
79 |

Created with


red hat ansible automation platform logo 80 |

The source code to create this report can be found at https://github.com/ansible-cloud/aws_demos

81 | If you are new to Ansible Automation check out the following links:
82 | Getting Started
83 | Free hands-on workshops
84 | Youtube Videos
85 |

86 |
87 |
88 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/plugins/modules/scan_packages.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from ansible.module_utils.basic import * # noqa 4 | 5 | DOCUMENTATION = ''' 6 | --- 7 | module: scan_packages 8 | short_description: Return installed packages information as fact data 9 | description: 10 | - Return information about installed packages as fact data 11 | ''' 12 | 13 | EXAMPLES = ''' 14 | # Example fact output: 15 | # host | success >> { 16 | # "ansible_facts": { 17 | # "packages": [ 18 | # { 19 | # "version": "1.0.6-5", 20 | # "source": "apt", 21 | # "arch": "amd64", 22 | # "name": "libbz2-1.0" 23 | # }, 24 | # { 25 | # "version": "2.7.1-4ubuntu1", 26 | # "source": "apt", 27 | # "arch": "amd64", 28 | # "name": "patch" 29 | # }, 30 | # { 31 | # "version": "4.8.2-19ubuntu1", 32 | # "source": "apt", 33 | # "arch": "amd64", 34 | # "name": "gcc-4.8-base" 35 | # } 36 | # ] 37 | ''' 38 | 39 | 40 | def rpm_package_list(): 41 | import rpm 42 | trans_set = rpm.TransactionSet() 43 | installed_packages = [] 44 | for package in trans_set.dbMatch(): 45 | package_details = { 46 | 'name':package[rpm.RPMTAG_NAME], 47 | 'version':package[rpm.RPMTAG_VERSION], 48 | 'release':package[rpm.RPMTAG_RELEASE], 49 | 'epoch':package[rpm.RPMTAG_EPOCH], 50 | 'arch':package[rpm.RPMTAG_ARCH], 51 | 'source':'rpm' } 52 | if installed_packages == []: 53 | installed_packages = [package_details] 54 | else: 55 | installed_packages.append(package_details) 56 | return installed_packages 57 | 58 | 59 | def deb_package_list(): 60 | import apt 61 | apt_cache = apt.Cache() 62 | installed_packages = [] 63 | apt_installed_packages = [pk for pk in apt_cache.keys() if apt_cache[pk].is_installed] 64 | for package in apt_installed_packages: 65 | ac_pkg = apt_cache[package].installed 66 | package_details = { 67 | 'name':package, 68 | 'version':ac_pkg.version, 69 | 'arch':ac_pkg.architecture, 70 | 'source':'apt'} 71 | if installed_packages == []: 72 | installed_packages = [package_details] 73 | else: 74 | installed_packages.append(package_details) 75 | return installed_packages 76 | 77 | 78 | def main(): 79 | module = AnsibleModule( 80 | argument_spec = dict(os_family=dict(required=True)) 81 | ) 82 | ans_os = module.params['os_family'] 83 | if ans_os in ('RedHat', 'Suse', 'openSUSE Leap'): 84 | packages = rpm_package_list() 85 | elif ans_os == 'Debian': 86 | packages = deb_package_list() 87 | else: 88 | packages = None 89 | 90 | if packages is not None: 91 | results = dict(ansible_facts=dict(packages=packages)) 92 | else: 93 | results = dict(skipped=True, msg="Unsupported Distribution") 94 | module.exit_json(**results) 95 | 96 | 97 | main() -------------------------------------------------------------------------------- /playbooks/aws_instances.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create lab instances in AWS 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | # Using ec2_ami_facts allows us to find a particular ami instance id regardless of region 8 | # Look for owner 309956199498 to find official Red Hat AMIs 9 | - name: find ami instance-id for RHEL 10 | amazon.aws.ec2_ami_info: 11 | region: "{{ ec2_region | default('us-east-1') }}" 12 | owners: 309956199498 13 | filters: 14 | name: "RHEL-8*HVM-*Hourly*" 15 | architecture: x86_64 16 | register: amis 17 | 18 | # The module ec2_ami_facts can return multiple ami instances for a given search 19 | # we will grab the latest instance (by date) that meets our criteria 20 | - name: set AMI for RHEL 21 | ansible.builtin.set_fact: 22 | rhel_ami: > 23 | {{ amis.images | selectattr('name', 'defined') | sort(attribute='creation_date') | last }} 24 | 25 | - name: retrieve VPC subnet id 26 | amazon.aws.ec2_vpc_subnet_info: 27 | region: "{{ ec2_region | default('us-east-1') }}" 28 | filters: 29 | "tag:Name": "{{ ec2_vpc_subnet_name | default('ansible-demo') }}" 30 | register: ec2_vpc_subnet_id 31 | 32 | - name: debug ec2_vpc_subnet_name 33 | debug: 34 | msg: "{{ ec2_vpc_subnet_id }}" 35 | 36 | - name: Create EC2 instances for ansible node (control node) 37 | amazon.aws.ec2_instance: 38 | key_name: "{{ ec2_key_name | default('ansible-demo') }}" 39 | security_group: "{{ ec2_security_group | default('ansible-demo') }}" 40 | instance_type: "{{ ec2_instance_type | default('t2.micro') }}" 41 | image_id: "{{ rhel_ami.image_id }}" 42 | region: "{{ ec2_region | default('us-east-1') }}" 43 | exact_count: "{{ ec2_exact_count | default('2') }}" 44 | state: running 45 | filters: 46 | "tag:instruqt": "true" 47 | instance-state-name: running 48 | tags: 49 | ansible-demo: "true" 50 | instruqt: "true" 51 | network: 52 | assign_public_ip: true 53 | vpc_subnet_id: "{{ ec2_vpc_subnet_id.subnets[0].subnet_id }}" 54 | volumes: 55 | - device_name: /dev/sda1 56 | ebs: 57 | volume_type: "{{ ec2_volume_type | default('gp3') }}" 58 | volume_size: "{{ ec2_volume_size | default('40') }}" 59 | iops: "{{ ec2_iops | default('3000') }}" 60 | throughput: "{{ ec2_throughput | default('125') }}" 61 | delete_on_termination: "{{ delete_on_termination | default(True) }}" 62 | register: control_output 63 | 64 | - name: grab instance ids to tag them all 65 | amazon.aws.ec2_instance_info: 66 | region: "{{ ec2_region | default('us-east-1') }}" 67 | filters: 68 | instance-state-name: running 69 | "tag:instruqt": "true" 70 | register: control_output 71 | 72 | - name: Ensure tags are present 73 | amazon.aws.ec2_tag: 74 | region: "{{ ec2_region | default('us-east-1') }}" 75 | resource: "{{ item.1.instance_id }}" 76 | state: present 77 | tags: 78 | Name: "rhel{{ item.0 + 1 }}" 79 | Index: "{{ item[0] }}" 80 | launch_time: "{{ item.1.launch_time }}" 81 | with_indexed_items: 82 | - "{{ control_output.instances }}" 83 | when: control_output.instances|length > 0 84 | -------------------------------------------------------------------------------- /roles/build_report_linux/templates/vpc.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 | {% for ec2_region in all_ec2_regions %} 4 | {% for key, value in ec2_region.items() %} 5 | {% set running = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "running") | length %} 6 | {% set stopped = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "stopped") | length %} 7 | {% set total = value.ec2_instance_info.instances | length %} 8 |
9 |

{{ key | default('unknown') }}
{% if total > 0 %}{% if running > 0 %}
{% endif %}{{ running }} instances running{% if running > 0 %}
{% endif %}
{{ stopped }} stopped ({{ total }} total)
{% endif %}

10 |
11 |

There are {{ value.vpc_info.vpcs | length }} AWS VPCs configured and {{ total }} instances on region {{ key | default('unknown') }}

12 | {% set nsvpc = namespace(total_empty_vpc = 0) %} 13 | {% for vpc in value.vpc_info.vpcs %} 14 | {% set instances_with_vpc = value.ec2_instance_info.instances | selectattr('vpc_id', 'defined') %} 15 | {% if instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | length <= 0 %} 16 | {% set nsvpc.total_empty_vpc = nsvpc.total_empty_vpc + 1 %} 17 | {% endif %} 18 | {% endfor %} 19 | {% if nsvpc.total_empty_vpc > 0 %} 20 |
21 |

Optimization Opportunities

22 |
{{ nsvpc.total_empty_vpc }} empty VPCs
23 |
24 | {% endif %} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | {% for vpc in value.vpc_info.vpcs %} 38 | 39 | 40 | 41 | {% set instances_with_vpc = value.ec2_instance_info.instances | selectattr('vpc_id', 'defined') %} 42 | 43 | 44 | 45 | 46 | {% set ns = namespace(igwfound=False) %} 47 | {% for igw in value.igw_info.internet_gateways %} 48 | {% if igw['attachments'] | length > 0 %} 49 | {% if igw['attachments'][0]['vpc_id'] is defined %} 50 | {% if igw['attachments'][0]['vpc_id'] == vpc.id %} 51 | 52 | {% set ns.igwfound = True %} 53 | {% endif %} 54 | {% endif %} 55 | {% endif %} 56 | {%- endfor -%} 57 | {% if not ns.igwfound %} 58 | 59 | {% endif %} 60 | 61 | {% endfor %} 62 | 63 |
VPC nameVPC idinstances
running
instances
stopped
CIDR blockCIDR block
associations
IGW
{{ vpc.tags['Name'] | default('no name tag') }}{{ vpc.id }}{{ instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "running") | length }}{{ instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "stopped") | length }}{{ vpc.cidr_block }}{{ vpc.cidr_block_association_set | length | default('0') }}{{ igw['internet_gateway_id'] }}No IGW found
64 |
65 |
66 | {% endfor %} 67 | {% endfor %} 68 |
69 | 70 | -------------------------------------------------------------------------------- /1dRHEL/1d-Teardown-all-AWS-WF-resources.yml: -------------------------------------------------------------------------------- 1 | # code: language=ansible 2 | --- 3 | - name: AWS ec2 de-provisioning including VPC and all related resources 4 | connection: local 5 | hosts: localhost 6 | gather_facts: false 7 | # The paramater region will be set for all ec2 modules by specifying it here under module_defaults 8 | module_defaults: 9 | group/aws: 10 | region: "{{ ec2_region | default('us-east-2') }}" 11 | vars: 12 | instance_name: "aws-demo1-ec2" 13 | owner_tag: "aws-demo1-user" 14 | 15 | tasks: 16 | - name: Grab facts for aws-demo1-ec2 17 | amazon.aws.ec2_instance_info: 18 | filters: 19 | "tag:Name": "aws-demo1-ec2" 20 | register: ec2_node_info 21 | 22 | - name: Destroy the EC2 instance 23 | amazon.aws.ec2_instance: 24 | filters: 25 | "tag:Name": "aws-demo1-ec2" 26 | state: absent 27 | instance_ids: "{{ ec2_node_info.instances | map(attribute='instance_id') | list }}" 28 | register: result 29 | when: 30 | - ec2_node_info.instances is defined 31 | - ec2_node_info.instances 32 | 33 | - name: Get the VPC ID 34 | amazon.aws.ec2_vpc_net_info: 35 | filters: 36 | "tag:Name": "aws-demo1-vpc" 37 | register: vpc_net_facts 38 | 39 | - name: Print the VPC ID 40 | ansible.builtin.debug: 41 | msg: 'The VPC ID is "{{ vpc_net_facts.vpcs[0].id }}"' 42 | 43 | - name: Delete the EC2 security group for aws-demo1-vpc 44 | amazon.aws.ec2_group: 45 | name: "aws-demo1-sg" 46 | state: absent 47 | register: delete_sg 48 | until: delete_sg is not failed 49 | retries: 50 50 | delegate_to: localhost 51 | run_once: true 52 | when: vpc_net_facts.vpcs|length > 0 53 | 54 | - name: Delete the subnet for aws-demo1-vpc 55 | amazon.aws.ec2_vpc_subnet: 56 | vpc_id: "{{ vpc_net_facts.vpcs[0].id }}" 57 | cidr: "192.168.0.0/28" 58 | state: absent 59 | delegate_to: localhost 60 | run_once: true 61 | when: vpc_net_facts.vpcs|length > 0 62 | 63 | - name: Delete the vpc Internet Gateway for aws-demo1-vpc 64 | amazon.aws.ec2_vpc_igw: 65 | vpc_id: "{{vpc_net_facts.vpcs[0].id}}" 66 | state: absent 67 | delegate_to: localhost 68 | run_once: true 69 | when: vpc_net_facts.vpcs|length > 0 70 | 71 | - name: Grab the route information for aws-demo1-vpc 72 | amazon.aws.ec2_vpc_route_table_info: 73 | filters: 74 | vpc-id: "{{ vpc_net_facts.vpcs[0].id }}" 75 | register: route_table_facts 76 | delegate_to: localhost 77 | run_once: true 78 | when: vpc_net_facts.vpcs|length > 0 79 | 80 | - name: Delete the VPC public Subnet Route Table entry 81 | amazon.aws.ec2_vpc_route_table: 82 | vpc_id: "{{ vpc_net_facts.vpcs[0].id }}" 83 | route_table_id: "{{ item.id }}" 84 | lookup: id 85 | state: absent 86 | loop: "{{ route_table_facts.route_tables }}" 87 | when: 88 | - vpc_net_facts.vpcs|length > 0 89 | - item.associations == [] 90 | 91 | - name: Delete the AWS VPC aws-demo1-vpc 92 | amazon.aws.ec2_vpc_net: 93 | name: "aws-demo1-vpc" 94 | cidr_block: "192.168.0.0/24" 95 | state: absent 96 | register: delete_vpc 97 | until: delete_vpc is not failed 98 | retries: 50 99 | delegate_to: localhost 100 | run_once: true 101 | when: vpc_net_facts.vpcs|length > 0 102 | 103 | - name: Remove the SSH Key Pair 104 | amazon.aws.ec2_key: 105 | name: "aws-demo1-key" 106 | state: absent 107 | register: create_key 108 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows_patching/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Windows Patch Report 5 | 6 | 7 |
8 |

Ansible Windows Patching Report

9 | 16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {% for windows_host in ansible_play_hosts |sort %} 31 | 32 | 33 | 34 | 47 | 48 | 49 | {% endfor %} 50 | 51 |
HostnameOperating SystemRequired Updates
{{hostvars[windows_host]['inventory_hostname']}}{{hostvars[windows_host]['ansible_distribution']|default("none")}} 35 |
    36 | 37 | {% if hostvars[windows_host].patchingresult.updates is defined and hostvars[windows_host].patchingresult.found_update_count|int > 0 %} 38 | {% for update in hostvars[windows_host].patchingresult.updates %} 39 | {% set updatenum = hostvars[windows_host].patchingresult.updates[update] %} 40 |
  • {{updatenum.title}}
  • 41 | {% endfor %} 42 | {% else %} 43 |
  • Compliant
  • 44 | {% endif %} 45 |
46 |
52 |

Created with Ansible on {{hostvars[inventory_hostname].ansible_date_time.iso8601}}

53 | 112 | 113 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows_patch/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Windows Patch Report 5 | 6 | 7 |
8 |

Ansible Windows Patching Report

9 | 16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {% for windows_host in groups['tag_Windows']|sort %} 31 | 32 | 33 | 34 | 47 | 48 | 49 | {% endfor %} 50 | 51 |
HostnameOperating SystemRequired Updates
{{hostvars[windows_host]['inventory_hostname']}}{{hostvars[windows_host]['ansible_distribution']|default("none")}} 35 |
    36 | 37 | {% if hostvars[windows_host].patchresult.updates is defined and hostvars[windows_host].patchresult.found_update_count|int > 0 %} 38 | {% for update in hostvars[windows_host].patchresult.updates %} 39 | {% set updatenum = hostvars[windows_host].patchresult.updates[update] %} 40 |
  • {{updatenum.title}}
  • 41 | {% endfor %} 42 | {% else %} 43 |
  • Compliant
  • 44 | {% endif %} 45 |
46 |
52 | {% for host in ansible_play_hosts %} 53 |

Created with Ansible on {{hostvars[host].ansible_date_time.iso8601}}

54 | {% endfor %} 55 | 114 | 115 | -------------------------------------------------------------------------------- /roles/template/templates/vpc.j2: -------------------------------------------------------------------------------- 1 | 2 |
3 | {% for ec2_region in all_ec2_regions %} 4 | {% for key, value in ec2_region.items() %} 5 | {% set running = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "running") | length %} 6 | {% set stopped = value.ec2_instance_info.instances | selectattr('state.name', 'equalto', "stopped") | length %} 7 | {% set total = value.ec2_instance_info.instances | length %} 8 |
9 |

{{ key | default('unknown') }}
10 |
11 | {% if total > 0 %} 12 | {% if running > 0 %} 13 |
14 | {% endif %} 15 | {{ running }} instances running 16 | {% if running > 0 %} 17 |
18 | {% endif %} 19 |
{{ stopped }} stopped ({{ total }} total)
20 | {% endif %} 21 |

22 |
23 |

There are {{ value.vpc_info.vpcs | length }} AWS VPCs configured and {{ total }} instances on region {{ key | default('unknown') }}

24 | {% set nsvpc = namespace(total_empty_vpc = 0) %} 25 | {% for vpc in value.vpc_info.vpcs %} 26 | {% set instances_with_vpc = value.ec2_instance_info.instances | selectattr('vpc_id', 'defined') %} 27 | {% if instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | length <= 0 %} 28 | {% set nsvpc.total_empty_vpc = nsvpc.total_empty_vpc + 1 %} 29 | {% endif %} 30 | {% endfor %} 31 | {% if nsvpc.total_empty_vpc > 0 %} 32 |
33 |

Optimization Opportunities

34 |
{{ nsvpc.total_empty_vpc }} empty VPCs
35 |
36 | {% endif %} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | {% for vpc in value.vpc_info.vpcs %} 50 | 51 | 52 | 53 | {% set instances_with_vpc = value.ec2_instance_info.instances | selectattr('vpc_id', 'defined') %} 54 | 55 | 56 | 57 | 58 | {% set ns = namespace(igwfound=False) %} 59 | {% for igw in value.igw_info.internet_gateways %} 60 | {% if igw['attachments'] | length > 0 %} 61 | {% if igw['attachments'][0]['vpc_id'] is defined %} 62 | {% if igw['attachments'][0]['vpc_id'] == vpc.id %} 63 | 64 | {% set ns.igwfound = True %} 65 | {% endif %} 66 | {% endif %} 67 | {% endif %} 68 | {%- endfor -%} 69 | {% if not ns.igwfound %} 70 | 71 | {% endif %} 72 | 73 | {% endfor %} 74 | 75 |
VPC nameVPC idinstances
running
instances
stopped
CIDR blockCIDR block
associations
IGW
{{ vpc.tags['Name'] | default('no name tag') }}{{ vpc.id }}{{ instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "running") | length }}{{ instances_with_vpc | selectattr('vpc_id', 'equalto', vpc.id ) | selectattr('state.name', 'equalto', "stopped") | length }}{{ vpc.cidr_block }}{{ vpc.cidr_block_association_set | length | default('0') }}{{ igw['internet_gateway_id'] }}No IGW found
76 | {% if instances_compliance is defined and instances_compliance %} 77 | {% include 'instances.j2' %} 78 | {% endif %} 79 |
80 |
81 | {% endfor %} 82 | {% endfor %} 83 |
84 | 85 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Windows Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 21 | 60 | 61 | 62 |
63 | {% include 'header.j2' %} 64 |
65 |
66 |

Ansible Windows Automation Report

67 |

68 |

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | {% for windows_host in ansible_play_hosts |sort %} 79 | 80 | 90 | 91 | 92 | 93 | {% endfor %} 94 | 95 |
Windows DeviceOperating SystemOperating System Kernel Version
81 |
82 |

83 | {{ hostvars[windows_host]['inventory_hostname'].split('.')[0] }}

84 |
85 | {% if detailedreport == 'True' %} 86 | {% include 'packages.j2' %} 87 | {% include 'services.j2' %} 88 | {% endif %} 89 |
{{hostvars[windows_host]['ansible_os_family']|default("none")}}{{hostvars[windows_host]['ansible_distribution']|default("none")}}
96 |

Created with


97 |
98 |
99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Network Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 20 | 59 | 60 | 61 |
62 | {% include 'header.j2' %} 63 |
64 |
65 |

Ansible Network Automation Report

66 |

67 |

68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | {% for network_switch in groups['tag_Router']|sort %} 79 | 80 | 87 | 90 | 95 | 101 | 102 | 103 | {% endfor %} 104 | 105 |
Network DeviceLayer 1Layer 2Layer 3
81 |
82 |

83 | {{ hostvars[network_switch]['ansible_net_hostname'].split('.')[0] }}

84 |
85 | {% include 'summary.j2' %} 86 |
88 | {% include 'interfaces.j2' %} 89 | 91 | {% include 'vlans.j2' %} 92 | {% include 'lldp_interfaces.j2' %} 93 | {% include 'l2_interfaces.j2' %} 94 | 96 | {% include 'l3_interfaces.j2' %} 97 | {% include 'lacp.j2' %} 98 | {% include 'bgp.j2' %} 99 | {% include 'ospf.j2' %} 100 |
106 |

Created with


107 |
108 |
109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Windows Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 21 | 60 | 61 | 62 |
63 | {% include 'header.j2' %} 64 |
65 |
66 |

Ansible Windows Automation Report

67 |

68 |

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | {% for windows_host in groups['tag_Windows']|sort %} 79 | 80 | 90 | 91 | 92 | 93 | {% endfor %} 94 | 95 |
Windows DeviceOperating SystemOperating System Kernel Version
81 |
82 |

83 | {{ hostvars[windows_host]['inventory_hostname'].split('.')[0] }}

84 |
85 | {% if detailedreport == 'True' %} 86 | {% include 'packages.j2' %} 87 | {% include 'services.j2' %} 88 | {% endif %} 89 |
{{hostvars[windows_host]['ansible_os_family']|default("none")}}{{hostvars[windows_host]['ansible_distribution']|default("none")}}
96 |

Created with


97 |
98 |
99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux_patching/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Linux Patch Report 5 | 6 | 7 |
8 |

Ansible Linux Patching Report

9 | 16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {% for linux_host in ansible_play_hosts |sort %} 32 | 33 | 34 | 35 | 36 | 55 | 56 | {% endfor %} 57 | 58 |
HostnameOperating SystemOperating System VersionRequired Updates
{{hostvars[linux_host]['inventory_hostname']}}{{hostvars[linux_host]['ansible_os_family']|default("none")}}{{hostvars[linux_host]['ansible_distribution_version']|default("none")}} 37 |
    38 | {% if hostvars[linux_host].patchingresult_yum.changed|default("false",true) == true %} 39 | {% for packagename in hostvars[linux_host].patchingresult_yum.changes.updated|sort %} 40 |
  • {{ packagename[0] }} - {{ packagename[1] }}
  • 41 | {% endfor %} 42 | {% elif hostvars[linux_host].patchingresult_dnf.changed|default("false",true) == true %} 43 | {% for packagename in hostvars[linux_host].patchingresult_dnf.results|sort %} 44 |
  • {{ packagename }}
  • 45 | {% endfor %} 46 | {% elif hostvars[linux_host].patchingresult_dnf.changed is undefined %} 47 |
  • Patching Failed
  • 48 | {% elif hostvars[linux_host].patchingresult_yum.changed is undefined %} 49 |
  • Patching Failed
  • 50 | {% else %} 51 |
  • Compliant
  • 52 | {% endif %} 53 |
54 |
59 |

Created with Ansible on {{hostvars[inventory_hostname].ansible_date_time.iso8601}}

60 | 119 | 120 | -------------------------------------------------------------------------------- /playbooks/aws_resources.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create AWS resources 3 | hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | tasks: 7 | - name: Create ssh key pair 8 | amazon.aws.ec2_key: 9 | region: "{{ ec2_region | default('us-east-1') }}" 10 | name: "ansible-demo" 11 | register: create_key 12 | 13 | - name: Save private key 14 | ansible.builtin.copy: 15 | content: "{{ create_key.key.private_key }}" 16 | dest: "ansible-demo.pem" 17 | mode: '0400' 18 | when: create_key.changed 19 | 20 | - name: Add machine credential 21 | awx.awx.credential: 22 | name: "RHEL on AWS - SSH KEY" 23 | description: "Machine Credential for AWS instances" 24 | organization: "{{ organization | default('Default') }}" 25 | credential_type: Machine 26 | inputs: 27 | username: ec2-user 28 | ssh_key_data: "{{ lookup('file', 'ansible-demo.pem') }}" 29 | controller_username: "{{ controller_username | default('admin') }}" 30 | controller_password: "{{ controller_password | default('ansible123!') }}" 31 | # controller_host: "{{ controller_host | default('https://host.containers.internal/') }}" 32 | controller_host: "{{ controller_host | default('https://localhost/') }}" 33 | validate_certs: false 34 | 35 | - name: Create AWS VPC {{ ec2_name_prefix }}-vpc 36 | amazon.aws.ec2_vpc_net: 37 | name: "{{ ec2_name_prefix | default('ansible-demo') }}" 38 | cidr_block: 39 | - "{{ ec2_subnet | default('192.168.0.0/24') }}" 40 | region: "{{ ec2_region | default('us-east-1') }}" 41 | tags: 42 | ansible-demo: "true" 43 | ansible: "is awesome" 44 | register: create_vpc 45 | until: create_vpc is not failed 46 | retries: 5 47 | 48 | - name: Create EC2 security group aws-demo-sg 49 | amazon.aws.ec2_group: 50 | name: "{{ ec2_name_prefix | default('ansible-demo') }}" 51 | region: "{{ ec2_region | default('us-east-1') }}" 52 | description: AWS demo SG for the demo 53 | vpc_id: "{{create_vpc.vpc.id}}" 54 | tags: 55 | Name: "{{ ec2_name_prefix | default('ansible-demo') }}" 56 | ansible: "is awesome" 57 | rules: 58 | - proto: tcp 59 | ports: 60 | - 22 61 | cidr_ip: 0.0.0.0/0 62 | - proto: tcp 63 | ports: 64 | - 80 65 | cidr_ip: 0.0.0.0/0 66 | register: create_sg 67 | until: create_sg is not failed 68 | retries: 5 69 | 70 | # This task is subdiving up the 192.168.0.0/24 and getting a smaller chunk, a /28 71 | - name: Create subnet for aws-demo-vpc 72 | amazon.aws.ec2_vpc_subnet: 73 | region: "{{ ec2_region | default('us-east-1') }}" 74 | vpc_id: "{{ create_vpc.vpc.id }}" 75 | cidr: "{{ ec2_cidr | default('192.168.0.0/28') }}" 76 | tags: 77 | Name: "{{ ec2_name_prefix | default('ansible-demo') }}" 78 | ansible: "is awesome" 79 | register: create_subnet 80 | until: create_subnet is not failed 81 | retries: 15 82 | 83 | - name: VPC internet gateway is present for {{ create_vpc.vpc.id }} 84 | amazon.aws.ec2_vpc_igw: 85 | region: "{{ ec2_region | default('us-east-1') }}" 86 | vpc_id: "{{ create_vpc.vpc.id }}" 87 | tags: 88 | Name: "{{ ec2_name_prefix | default('ansible-demo') }}" 89 | ansible: "is awesome" 90 | register: igw 91 | until: igw is not failed 92 | retries: 15 93 | 94 | - name: VPC public subnet route table is present for {{ create_vpc.vpc.id }} 95 | amazon.aws.ec2_vpc_route_table: 96 | region: "{{ ec2_region | default('us-east-1') }}" 97 | vpc_id: "{{ create_vpc.vpc.id }}" 98 | subnets: 99 | - "{{ create_subnet.subnet.id }}" 100 | routes: 101 | - dest: 0.0.0.0/0 102 | gateway_id: "{{ igw.gateway_id }}" 103 | tags: 104 | Name: "{{ ec2_name_prefix | default('ansible-demo') }}" 105 | ansible: "is awesome" 106 | register: routetable 107 | until: routetable is not failed 108 | retries: 5 109 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/templates/report.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ansible Linux Automation Report 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 21 | 60 | 61 | 62 |
63 | {% include 'header.j2' %} 64 |
65 |
66 |

Ansible Linux Automation Report

67 |

68 |

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | {% for linux_host in ansible_play_hosts |sort %} 81 | 82 | 92 | 93 | 94 | 95 | 96 | 97 | {% endfor %} 98 | 99 |
Linux DevicePackage ManagerOperating SystemOperating System VersionOperating System Kernel Version
83 |
84 |

85 | {{ hostvars[linux_host]['inventory_hostname'].split('.')[0] }}

86 |
87 | {% if detailedreport == 'True' %} 88 | {% include 'packages.j2' %} 89 | {% include 'services.j2' %} 90 | {% endif %} 91 |
{{hostvars[linux_host]['ansible_pkg_mgr']|default("none")}}{{hostvars[linux_host]['ansible_os_family']|default("none")}}{{hostvars[linux_host]['ansible_distribution_version']|default("none")}}{{hostvars[linux_host]['ansible_kernel']|default("none")}}
100 |

Created with


101 |
102 |
103 |
104 | 105 | 106 | -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_linux/files/css/new.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | margin: auto; 6 | width: 50%; 7 | } 8 | 9 | #subtable { 10 | background: #ebebeb; 11 | margin: 0px; 12 | width: 100%; 13 | } 14 | 15 | #subtable tbody tr td { 16 | padding: 5px 5px 5px 5px; 17 | } 18 | 19 | #subtable thead th { 20 | padding: 5px; 21 | } 22 | 23 | * { 24 | -moz-box-sizing: border-box; 25 | -webkit-box-sizing: border-box; 26 | box-sizing: border-box; 27 | font-family: "Open Sans", "Helvetica"; 28 | 29 | } 30 | 31 | a { 32 | color: #ffffff; 33 | } 34 | 35 | p { 36 | color: #ffffff; 37 | } 38 | h1 { 39 | text-align: center; 40 | color: #ffffff; 41 | } 42 | 43 | body { 44 | background:#353a40; 45 | padding: 0px; 46 | margin: 0px; 47 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 48 | } 49 | 50 | table { 51 | border-collapse: separate; 52 | background:#fff; 53 | @include border-radius(5px); 54 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 55 | } 56 | 57 | .main_net_table { 58 | margin:50px auto; 59 | } 60 | 61 | thead { 62 | @include border-radius(5px); 63 | } 64 | 65 | thead th { 66 | font-size:16px; 67 | font-weight:400; 68 | color:#fff; 69 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 70 | text-align:left; 71 | padding:20px; 72 | border-top:1px solid #858d99; 73 | background: #353a40; 74 | 75 | &:first-child { 76 | @include border-top-left-radius(5px); 77 | } 78 | 79 | &:last-child { 80 | @include border-top-right-radius(5px); 81 | } 82 | } 83 | 84 | tbody tr td { 85 | font-weight:400; 86 | color:#5f6062; 87 | font-size:13px; 88 | padding:20px 20px 20px 20px; 89 | border-bottom:1px solid #e0e0e0; 90 | } 91 | 92 | tbody tr:nth-child(2n) { 93 | background:#f0f3f5; 94 | } 95 | 96 | tbody tr:last-child td { 97 | border-bottom:none; 98 | &:first-child { 99 | @include border-bottom-left-radius(5px); 100 | } 101 | &:last-child { 102 | @include border-bottom-right-radius(5px); 103 | } 104 | } 105 | 106 | td { 107 | vertical-align: top; 108 | } 109 | 110 | span.highlight { 111 | background-color: yellow; 112 | } 113 | 114 | .expandclass { 115 | color: #5f6062; 116 | } 117 | 118 | .content{ 119 | display:none; 120 | margin: 10px; 121 | } 122 | 123 | header { 124 | width: 100%; 125 | position: initial; 126 | float: initial; 127 | padding: 0; 128 | margin: 0; 129 | border-radius: 0; 130 | height: 88px; 131 | background-color: #171717; 132 | } 133 | 134 | .header-container { 135 | margin: 0 auto; 136 | width: 100%; 137 | height: 100%; 138 | max-width: 1170px; 139 | padding: 0; 140 | float: initial; 141 | display: flex; 142 | align-items: center; 143 | } 144 | 145 | .header-logo { 146 | width: 137px; 147 | border: 0; 148 | margin: 0; 149 | margin-left: 15px; 150 | } 151 | 152 | .header-link { 153 | margin-left: 40px; 154 | text-decoration: none; 155 | cursor: pointer; 156 | text-transform: uppercase; 157 | font-size: 15px; 158 | font-family: 'Red Hat Text'; 159 | font-weight: 500; 160 | } 161 | 162 | .header-link:hover { 163 | text-shadow: 0 0 0.02px white; 164 | text-decoration: none; 165 | } 166 | 167 | table.net_info td { 168 | padding: 5px; 169 | } 170 | 171 | p.expandclass:hover { 172 | text-decoration: underline; 173 | color: #EE0000; 174 | cursor: pointer; 175 | } 176 | 177 | .summary_info { 178 | } 179 | 180 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { 181 | border: 1px solid #5F0000; 182 | background: #EE0000; 183 | } 184 | 185 | div#net_content { 186 | padding: 0px; 187 | height: auto !important; 188 | } 189 | 190 | img.router_image { 191 | vertical-align: middle; 192 | padding: 0px 10px 10px 10px; 193 | width: 50px; 194 | } 195 | 196 | table.net_info { 197 | width: 100%; 198 | } 199 | 200 | p.internal_label { 201 | color: #000000; 202 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_windows/files/css/new.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | margin: auto; 6 | width: 50%; 7 | } 8 | 9 | #subtable { 10 | background: #ebebeb; 11 | margin: 0px; 12 | width: 100%; 13 | } 14 | 15 | #subtable tbody tr td { 16 | padding: 5px 5px 5px 5px; 17 | } 18 | 19 | #subtable thead th { 20 | padding: 5px; 21 | } 22 | 23 | * { 24 | -moz-box-sizing: border-box; 25 | -webkit-box-sizing: border-box; 26 | box-sizing: border-box; 27 | font-family: "Open Sans", "Helvetica"; 28 | 29 | } 30 | 31 | a { 32 | color: #ffffff; 33 | } 34 | 35 | p { 36 | color: #ffffff; 37 | } 38 | h1 { 39 | text-align: center; 40 | color: #ffffff; 41 | } 42 | 43 | body { 44 | background:#353a40; 45 | padding: 0px; 46 | margin: 0px; 47 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 48 | } 49 | 50 | table { 51 | border-collapse: separate; 52 | background:#fff; 53 | @include border-radius(5px); 54 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 55 | } 56 | 57 | .main_net_table { 58 | margin:50px auto; 59 | } 60 | 61 | thead { 62 | @include border-radius(5px); 63 | } 64 | 65 | thead th { 66 | font-size:16px; 67 | font-weight:400; 68 | color:#fff; 69 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 70 | text-align:left; 71 | padding:20px; 72 | border-top:1px solid #858d99; 73 | background: #353a40; 74 | 75 | &:first-child { 76 | @include border-top-left-radius(5px); 77 | } 78 | 79 | &:last-child { 80 | @include border-top-right-radius(5px); 81 | } 82 | } 83 | 84 | tbody tr td { 85 | font-weight:400; 86 | color:#5f6062; 87 | font-size:13px; 88 | padding:20px 20px 20px 20px; 89 | border-bottom:1px solid #e0e0e0; 90 | } 91 | 92 | tbody tr:nth-child(2n) { 93 | background:#f0f3f5; 94 | } 95 | 96 | tbody tr:last-child td { 97 | border-bottom:none; 98 | &:first-child { 99 | @include border-bottom-left-radius(5px); 100 | } 101 | &:last-child { 102 | @include border-bottom-right-radius(5px); 103 | } 104 | } 105 | 106 | td { 107 | vertical-align: top; 108 | } 109 | 110 | span.highlight { 111 | background-color: yellow; 112 | } 113 | 114 | .expandclass { 115 | color: #5f6062; 116 | } 117 | 118 | .content{ 119 | display:none; 120 | margin: 10px; 121 | } 122 | 123 | header { 124 | width: 100%; 125 | position: initial; 126 | float: initial; 127 | padding: 0; 128 | margin: 0; 129 | border-radius: 0; 130 | height: 88px; 131 | background-color: #171717; 132 | } 133 | 134 | .header-container { 135 | margin: 0 auto; 136 | width: 100%; 137 | height: 100%; 138 | max-width: 1170px; 139 | padding: 0; 140 | float: initial; 141 | display: flex; 142 | align-items: center; 143 | } 144 | 145 | .header-logo { 146 | width: 137px; 147 | border: 0; 148 | margin: 0; 149 | margin-left: 15px; 150 | } 151 | 152 | .header-link { 153 | margin-left: 40px; 154 | text-decoration: none; 155 | cursor: pointer; 156 | text-transform: uppercase; 157 | font-size: 15px; 158 | font-family: 'Red Hat Text'; 159 | font-weight: 500; 160 | } 161 | 162 | .header-link:hover { 163 | text-shadow: 0 0 0.02px white; 164 | text-decoration: none; 165 | } 166 | 167 | table.net_info td { 168 | padding: 5px; 169 | } 170 | 171 | p.expandclass:hover { 172 | text-decoration: underline; 173 | color: #EE0000; 174 | cursor: pointer; 175 | } 176 | 177 | .summary_info { 178 | } 179 | 180 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { 181 | border: 1px solid #5F0000; 182 | background: #EE0000; 183 | } 184 | 185 | div#net_content { 186 | padding: 0px; 187 | height: auto !important; 188 | } 189 | 190 | img.router_image { 191 | vertical-align: middle; 192 | padding: 0px 10px 10px 10px; 193 | width: 50px; 194 | } 195 | 196 | table.net_info { 197 | width: 100%; 198 | } 199 | 200 | p.internal_label { 201 | color: #000000; 202 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_network/files/css/new.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | margin: auto; 6 | width: 50%; 7 | } 8 | 9 | #subtable { 10 | background: #ebebeb; 11 | margin: 0px; 12 | width: 100%; 13 | } 14 | 15 | #subtable tbody tr td { 16 | padding: 5px 5px 5px 5px; 17 | } 18 | 19 | #subtable thead th { 20 | padding: 5px; 21 | } 22 | 23 | * { 24 | -moz-box-sizing: border-box; 25 | -webkit-box-sizing: border-box; 26 | box-sizing: border-box; 27 | font-family: "Open Sans", "Helvetica"; 28 | 29 | } 30 | 31 | a { 32 | color: #ffffff; 33 | } 34 | 35 | p { 36 | color: #ffffff; 37 | } 38 | h1 { 39 | text-align: center; 40 | color: #ffffff; 41 | } 42 | 43 | body { 44 | background:#353a40; 45 | padding: 0px; 46 | margin: 0px; 47 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 48 | } 49 | 50 | table { 51 | border-collapse: separate; 52 | background:#fff; 53 | @include border-radius(5px); 54 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 55 | } 56 | 57 | .main_net_table { 58 | margin:50px auto; 59 | } 60 | 61 | thead { 62 | @include border-radius(5px); 63 | } 64 | 65 | thead th { 66 | font-size:16px; 67 | font-weight:400; 68 | color:#fff; 69 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 70 | text-align:left; 71 | padding:20px; 72 | border-top:1px solid #858d99; 73 | background: #353a40; 74 | 75 | &:first-child { 76 | @include border-top-left-radius(5px); 77 | } 78 | 79 | &:last-child { 80 | @include border-top-right-radius(5px); 81 | } 82 | } 83 | 84 | tbody tr td { 85 | font-weight:400; 86 | color:#5f6062; 87 | font-size:13px; 88 | padding:20px 20px 20px 20px; 89 | border-bottom:1px solid #e0e0e0; 90 | } 91 | 92 | tbody tr:nth-child(2n) { 93 | background:#f0f3f5; 94 | } 95 | 96 | tbody tr:last-child td { 97 | border-bottom:none; 98 | &:first-child { 99 | @include border-bottom-left-radius(5px); 100 | } 101 | &:last-child { 102 | @include border-bottom-right-radius(5px); 103 | } 104 | } 105 | 106 | td { 107 | vertical-align: top; 108 | } 109 | 110 | span.highlight { 111 | background-color: yellow; 112 | } 113 | 114 | .expandclass { 115 | color: #5f6062; 116 | } 117 | 118 | .content{ 119 | display:none; 120 | margin: 10px; 121 | } 122 | 123 | header { 124 | width: 100%; 125 | position: initial; 126 | float: initial; 127 | padding: 0; 128 | margin: 0; 129 | border-radius: 0; 130 | height: 88px; 131 | background-color: #171717; 132 | } 133 | 134 | .header-container { 135 | margin: 0 auto; 136 | width: 100%; 137 | height: 100%; 138 | max-width: 1170px; 139 | padding: 0; 140 | float: initial; 141 | display: flex; 142 | align-items: center; 143 | } 144 | 145 | .header-logo { 146 | width: 137px; 147 | border: 0; 148 | margin: 0; 149 | margin-left: 15px; 150 | } 151 | 152 | .header-link { 153 | margin-left: 40px; 154 | text-decoration: none; 155 | cursor: pointer; 156 | text-transform: uppercase; 157 | font-size: 15px; 158 | font-family: 'Red Hat Text'; 159 | font-weight: 500; 160 | } 161 | 162 | .header-link:hover { 163 | text-shadow: 0 0 0.02px white; 164 | text-decoration: none; 165 | } 166 | 167 | table.net_info td { 168 | padding: 5px; 169 | } 170 | 171 | p.expandclass:hover { 172 | text-decoration: underline; 173 | color: #EE0000; 174 | cursor: pointer; 175 | } 176 | 177 | .summary_info { 178 | } 179 | 180 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { 181 | border: 1px solid #5F0000; 182 | background: #EE0000; 183 | } 184 | 185 | div#net_content { 186 | padding: 0px; 187 | height: auto !important; 188 | } 189 | 190 | img.router_image { 191 | vertical-align: middle; 192 | padding: 0px 10px 10px 10px; 193 | width: 50px; 194 | } 195 | 196 | table.net_info { 197 | width: 100%; 198 | } 199 | 200 | p.internal_label { 201 | color: #000000; 202 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/build_report_windows/files/css/new.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | margin: auto; 6 | width: 50%; 7 | } 8 | 9 | #subtable { 10 | background: #ebebeb; 11 | margin: 0px; 12 | width: 100%; 13 | } 14 | 15 | #subtable tbody tr td { 16 | padding: 5px 5px 5px 5px; 17 | } 18 | 19 | #subtable thead th { 20 | padding: 5px; 21 | } 22 | 23 | * { 24 | -moz-box-sizing: border-box; 25 | -webkit-box-sizing: border-box; 26 | box-sizing: border-box; 27 | font-family: "Open Sans", "Helvetica"; 28 | 29 | } 30 | 31 | a { 32 | color: #ffffff; 33 | } 34 | 35 | p { 36 | color: #ffffff; 37 | } 38 | h1 { 39 | text-align: center; 40 | color: #ffffff; 41 | } 42 | 43 | body { 44 | background:#353a40; 45 | padding: 0px; 46 | margin: 0px; 47 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 48 | } 49 | 50 | table { 51 | border-collapse: separate; 52 | background:#fff; 53 | @include border-radius(5px); 54 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 55 | } 56 | 57 | .main_net_table { 58 | margin:50px auto; 59 | } 60 | 61 | thead { 62 | @include border-radius(5px); 63 | } 64 | 65 | thead th { 66 | font-size:16px; 67 | font-weight:400; 68 | color:#fff; 69 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 70 | text-align:left; 71 | padding:20px; 72 | border-top:1px solid #858d99; 73 | background: #353a40; 74 | 75 | &:first-child { 76 | @include border-top-left-radius(5px); 77 | } 78 | 79 | &:last-child { 80 | @include border-top-right-radius(5px); 81 | } 82 | } 83 | 84 | tbody tr td { 85 | font-weight:400; 86 | color:#5f6062; 87 | font-size:13px; 88 | padding:20px 20px 20px 20px; 89 | border-bottom:1px solid #e0e0e0; 90 | } 91 | 92 | tbody tr:nth-child(2n) { 93 | background:#f0f3f5; 94 | } 95 | 96 | tbody tr:last-child td { 97 | border-bottom:none; 98 | &:first-child { 99 | @include border-bottom-left-radius(5px); 100 | } 101 | &:last-child { 102 | @include border-bottom-right-radius(5px); 103 | } 104 | } 105 | 106 | td { 107 | vertical-align: top; 108 | } 109 | 110 | span.highlight { 111 | background-color: yellow; 112 | } 113 | 114 | .expandclass { 115 | color: #5f6062; 116 | } 117 | 118 | .content{ 119 | display:none; 120 | margin: 10px; 121 | } 122 | 123 | header { 124 | width: 100%; 125 | position: initial; 126 | float: initial; 127 | padding: 0; 128 | margin: 0; 129 | border-radius: 0; 130 | height: 88px; 131 | background-color: #171717; 132 | } 133 | 134 | .header-container { 135 | margin: 0 auto; 136 | width: 100%; 137 | height: 100%; 138 | max-width: 1170px; 139 | padding: 0; 140 | float: initial; 141 | display: flex; 142 | align-items: center; 143 | } 144 | 145 | .header-logo { 146 | width: 137px; 147 | border: 0; 148 | margin: 0; 149 | margin-left: 15px; 150 | } 151 | 152 | .header-link { 153 | margin-left: 40px; 154 | text-decoration: none; 155 | cursor: pointer; 156 | text-transform: uppercase; 157 | font-size: 15px; 158 | font-family: 'Red Hat Text'; 159 | font-weight: 500; 160 | } 161 | 162 | .header-link:hover { 163 | text-shadow: 0 0 0.02px white; 164 | text-decoration: none; 165 | } 166 | 167 | table.net_info td { 168 | padding: 5px; 169 | } 170 | 171 | p.expandclass:hover { 172 | text-decoration: underline; 173 | color: #EE0000; 174 | cursor: pointer; 175 | } 176 | 177 | .summary_info { 178 | } 179 | 180 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { 181 | border: 1px solid #5F0000; 182 | background: #EE0000; 183 | } 184 | 185 | div#net_content { 186 | padding: 0px; 187 | height: auto !important; 188 | } 189 | 190 | img.router_image { 191 | vertical-align: middle; 192 | padding: 0px 10px 10px 10px; 193 | width: 50px; 194 | } 195 | 196 | table.net_info { 197 | width: 100%; 198 | } 199 | 200 | p.internal_label { 201 | color: #000000; 202 | } -------------------------------------------------------------------------------- /collections/ansible_collections/demo/patching/roles/report_server/files/css/new.css: -------------------------------------------------------------------------------- 1 | p.hostname { 2 | color: #000000; 3 | font-weight: bolder; 4 | font-size: large; 5 | margin: auto; 6 | width: 50%; 7 | } 8 | 9 | #subtable { 10 | background: #ebebeb; 11 | margin: 0px; 12 | width: 100%; 13 | } 14 | 15 | #subtable tbody tr td { 16 | padding: 5px 5px 5px 5px; 17 | } 18 | 19 | #subtable thead th { 20 | padding: 5px; 21 | } 22 | 23 | * { 24 | -moz-box-sizing: border-box; 25 | -webkit-box-sizing: border-box; 26 | box-sizing: border-box; 27 | font-family: "Open Sans", "Helvetica"; 28 | 29 | } 30 | 31 | a { 32 | color: #000000; 33 | } 34 | 35 | p { 36 | color: #ffffff; 37 | } 38 | h1 { 39 | text-align: center; 40 | color: #ffffff; 41 | } 42 | 43 | body { 44 | background:#353a40; 45 | padding: 0px; 46 | margin: 0px; 47 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 48 | } 49 | 50 | table { 51 | border-collapse: separate; 52 | background:#fff; 53 | @include border-radius(5px); 54 | @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); 55 | } 56 | 57 | .main_net_table { 58 | margin:50px auto; 59 | } 60 | 61 | thead { 62 | @include border-radius(5px); 63 | } 64 | 65 | thead th { 66 | font-size:16px; 67 | font-weight:400; 68 | color:#fff; 69 | @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); 70 | text-align:left; 71 | padding:20px; 72 | border-top:1px solid #858d99; 73 | background: #353a40; 74 | 75 | &:first-child { 76 | @include border-top-left-radius(5px); 77 | } 78 | 79 | &:last-child { 80 | @include border-top-right-radius(5px); 81 | } 82 | } 83 | 84 | tbody tr td { 85 | font-weight:400; 86 | color:#5f6062; 87 | font-size:13px; 88 | padding:20px 20px 20px 20px; 89 | border-bottom:1px solid #e0e0e0; 90 | } 91 | 92 | tbody tr:nth-child(2n) { 93 | background:#f0f3f5; 94 | } 95 | 96 | tbody tr:last-child td { 97 | border-bottom:none; 98 | &:first-child { 99 | @include border-bottom-left-radius(5px); 100 | } 101 | &:last-child { 102 | @include border-bottom-right-radius(5px); 103 | } 104 | } 105 | 106 | td { 107 | vertical-align: top; 108 | } 109 | 110 | span.highlight { 111 | background-color: yellow; 112 | } 113 | 114 | .expandclass { 115 | color: #5f6062; 116 | } 117 | 118 | .content{ 119 | display:none; 120 | margin: 10px; 121 | } 122 | 123 | header { 124 | width: 100%; 125 | position: initial; 126 | float: initial; 127 | padding: 0; 128 | margin: 0; 129 | border-radius: 0; 130 | height: 88px; 131 | background-color: #171717; 132 | } 133 | 134 | .header-container { 135 | margin: 0 auto; 136 | width: 100%; 137 | height: 100%; 138 | max-width: 1170px; 139 | padding: 0; 140 | float: initial; 141 | display: flex; 142 | align-items: center; 143 | } 144 | 145 | .header-logo { 146 | width: 137px; 147 | border: 0; 148 | margin: 0; 149 | margin-left: 15px; 150 | } 151 | 152 | .header-link { 153 | margin-left: 40px; 154 | text-decoration: none; 155 | cursor: pointer; 156 | text-transform: uppercase; 157 | font-size: 15px; 158 | font-family: 'Red Hat Text'; 159 | font-weight: 500; 160 | } 161 | 162 | .header-link:hover { 163 | text-shadow: 0 0 0.02px white; 164 | text-decoration: none; 165 | } 166 | 167 | table.net_info td { 168 | padding: 5px; 169 | } 170 | 171 | p.expandclass:hover { 172 | text-decoration: underline; 173 | color: #EE0000; 174 | cursor: pointer; 175 | } 176 | 177 | .summary_info { 178 | } 179 | 180 | .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { 181 | border: 1px solid #5F0000; 182 | background: #EE0000; 183 | } 184 | 185 | div#net_content { 186 | padding: 0px; 187 | height: auto !important; 188 | } 189 | 190 | img.router_image { 191 | vertical-align: middle; 192 | padding: 0px 10px 10px 10px; 193 | width: 50px; 194 | } 195 | 196 | table.net_info { 197 | width: 100%; 198 | } 199 | 200 | p.internal_label { 201 | color: #000000; 202 | } 203 | -------------------------------------------------------------------------------- /roles/build_report_tags/files/ansible-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | Logo-Red_Hat-Ansible_Automation_Platform-A-Reverse-RGB 10 | 12 | 14 | 18 | 21 | 24 | 25 | 28 | 33 | 35 | 48 | 49 | -------------------------------------------------------------------------------- /roles/template/files/redhat-ansible-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | Logo-Red_Hat-Ansible_Automation_Platform-A-Reverse-RGB 10 | 12 | 14 | 18 | 21 | 24 | 25 | 28 | 33 | 35 | 48 | 49 | -------------------------------------------------------------------------------- /roles/build_report_linux/files/redhat-ansible-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | Logo-Red_Hat-Ansible_Automation_Platform-A-Reverse-RGB 10 | 12 | 14 | 18 | 21 | 24 | 25 | 28 | 33 | 35 | 48 | 49 | --------------------------------------------------------------------------------