update patching

This commit is contained in:
willtome
2022-03-24 08:03:51 -04:00
parent e194ced972
commit c2257fdc48
4 changed files with 74 additions and 17 deletions

34
cloud/README.md Normal file
View File

@@ -0,0 +1,34 @@
# Ansible Cloud Demos
## Setup
> These steps may differ if you in your environment
### Add AWS Credentials
1) Add AWS Access and Secret key to the AWS Credential created by the setup job
### Add Workshop Credential Password
1) Add the password used to login to Controller. This allows you to connect to Windows Servers provisioned with Create VM job. Required until [RFE](https://github.com/ansible/workshops/issues/1597]) is complete
### Remove Inventory Variables
1) Remove Workshop Inventory variables on the Details page of the inventory. Required until [RFE](https://github.com/ansible/workshops/issues/1597]) is complete
### Getting your Puiblic Key for Create Infra Job
1) Connect to the command line of your Controller server. This is easiest to do by opening the VS Code Web Editor from the landing page where you found the Controller login details.
2) Open a Terminal Window in the VS Code Web Editor.
3) SSH to one of your linux nodes (eg. `ssh node1`). This should log you into the node as `ec2-user`
4) `cat .ssh/authorized_keys` and copy the key listed including the `ssh-rsa` prefix
## Demos
### Cloud / Create Infra
The Create Infra job builds cloud infrastructure based on the provider definition in the included `demo.cloud` collection.
### Cloud / Create VM
The Create VM job builds a VM in the given provider based on the included `demo.cloud` collection. VM blueprints define variables for each provider that override the collection roles.

View File

@@ -2,12 +2,14 @@
ansible.builtin.template:
src: report.j2
dest: "{{ file_path }}/linux.html"
check_mode: no
- name: copy CSS over
ansible.builtin.copy:
src: "css"
dest: "{{ file_path }}"
directory_mode: true
check_mode: no
- name: copy logos over
ansible.builtin.copy:
@@ -18,6 +20,7 @@
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "server.png"
check_mode: no
- name: display link to inventory report
ansible.builtin.debug:

View File

@@ -1,20 +1,38 @@
---
- name: Apply Non-kernel Updates
hosts: "{{ HOSTS }}"
become: true
- hosts: "{{ HOSTS }}"
become: yes
vars:
report_server: node1
tasks:
- name: upgrade all packages except kernel
yum:
name: '*'
state: latest
exclude: kernel*
tags: all
- include_role:
name: demo.patching.patch_linux
- name: upgrade all packages security related except kernel
yum:
name: '*'
- block:
- yum:
name: httpd
state: latest
security: true
exclude: kernel*
tags: security
check_mode: no
- file:
path: /var/www/html/reports/
state: directory
check_mode: no
- copy:
dest: /var/www/html/reports/.htaccess
content: Options +Indexes
check_mode: no
- service:
name: httpd
state: started
check_mode: no
- include_role:
name: demo.patching.report_linux
- include_role:
name: demo.patching.report_linux_patching
delegate_to: "{{ report_server }}"
run_once: yes

View File

@@ -134,6 +134,8 @@ controller_templates:
playbook: "linux/patching.yml"
execution_environment: Default execution environment
use_fact_cache: true
job_type: check
ask_job_type_on_launch: yes
credentials:
- "Workshop Credential"
survey_enabled: true