add compliance

add job template

fix I

add extra vars

add documentation

Added contributing doc (#2)

add contributing doc

cleaning up docs

add suggested usage

log demo

DERP

network demos

change role name

source update

add hub creds

add readme

add main readme

typo, no biggie (#23)

https://knowyourmeme.com/memes/but-its-honest-work

add notification

fix var

fix var

fix var

fix vars

fix vars

fix vars

fix vars

fix vars

add telemetry

update telemetry

add feedback

add feedback

add feedback

update windows stuff

bugs

bugs

bugs

bugs

add assert

add groups

update AD jobs

random pass

pin version for comm.gen

Add landing page (#25)

* work on landing page

* work on landing page

* work on landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* add files

* derp

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add ee

* add ee

* add ee

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* remove commented out sections

Increased the Idle Time Force Log Out (#28)

* increased timeout

* sdf

* asdf

* corrected key

Instruqt Refactor (#40)

* work on landing page

* work on landing page

* work on landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* add files

* derp

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add ee

* add ee

* add ee

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* remove commented out sections

* remove default ee

* set local admin password

* set ee for fact scan

* fall back to default ee for patching

* check for valid org_id

* check for valid org_id

* check admin username

* add remote_user

* credssp

* ntlm

Add network report job template (#44)

* Network report

Linux demo updates bblasco pt1 (#45)

* Improved description of Ansible group to address issue #29

* Ensured "at" package is present rather than latest for Issue #31

* Added timesync as a second example role to run (Issue #37)

Co-authored-by: Benjamin Blasco <bblasco@redhat.com>

Added task to print STDOUT lines from script (Issue #33) (#46)

Co-authored-by: Benjamin Blasco <bblasco@redhat.com>

Added Insights Compliance Scan (Issue #49) (#51)

Co-authored-by: Benjamin Blasco <bblasco@redhat.com>

Linux demo updates bblasco podman (#47)

* Switched from using podman volumes to file path (issue #36)

* Improved readability of output

* Added a sensible default message for web server (Issue #36)

Co-authored-by: Benjamin Blasco <bblasco@redhat.com>

Run insights scan (skip errors if not configured) (Issue #32) (#48)

* Run insights scan (skip errors if not configured) (Issue #32)

* Improved Insights client checks to use facts
defined by redhatinsights.insights.insights_client role

* Fixed missed call to debug module

* Updated message for clarity

Co-authored-by: Benjamin Blasco <bblasco@redhat.com>

Issue 52 (#53)

* add fact scan

* add fact scan

* update patching role

* dont ask limit

* add become

Add Satellite Demos (#41)

* add satellite demos

* move satellite vars to setup.yml

* fix var

* fix playbook path

* remove async

* fix =

* fix condition

* fix lookup

* add credential

* update tools version

* fix scap role

* add satellite setup

* add satellite stuff

* remove local

* stupid

* stupid

* params

* these vars arent right

* these vars arent right

* add compliance workflow

* work on landing page

* work on landing page

* work on landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* add files

* derp

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add ee

* add ee

* add ee

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* remove commented out sections

* remove default ee

* set local admin password

* set ee for fact scan

* fall back to default ee for patching

* check for valid org_id

* check for valid org_id

* no gpg

* no gpg

* add satllite stuff

* update cred type

* update cred type

* raw

* raw

* work on landing page

* work on landing page

* work on landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* landing page

* add files

* derp

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add link

* add ee

* add ee

* add ee

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* fix landing page

* remove commented out sections

* remove default ee

* set local admin password

* set ee for fact scan

* fall back to default ee for patching

* check for valid org_id

* check for valid org_id

* no gpg

* no gpg

* add satllite stuff

* update cred type

* update cred type

* raw

* raw

* raw

* merge satellite

* fix vars

* fix vars

* fix vars

* fix vars

* add publish

* add lifecycle and actviation keys

* workaround for publish issue

* use module to publish

* use module to publish

* use module to publish

* use module to publish

* change sat version

* change sat version

* change sat version

* remove maint repos

* launch sat setup

* reorder

* reorder

* moar inventory

* add manifest refresh

* add telemetry

* run linux setup

* parent efcf729fa0
author willtome <willtome@gmail.com> 1663173584 -0400
committer willtome <willtome@gmail.com> 1668183942 -0500

parent efcf729fa0
author willtome <willtome@gmail.com> 1663173584 -0400
committer willtome <willtome@gmail.com> 1668183785 -0500

parent efcf729fa0
author willtome <willtome@gmail.com> 1663173584 -0400
committer willtome <willtome@gmail.com> 1668183318 -0500

parent efcf729fa0
author willtome <willtome@gmail.com> 1663173584 -0400
committer willtome <willtome@gmail.com> 1668182787 -0500

parent efcf729fa0
author willtome <willtome@gmail.com> 1663173584 -0400
committer willtome <willtome@gmail.com> 1668182651 -0500

add satellite demos

work on landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

add files

derp

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add ee

add ee

add ee

fix landing page

fix landing page

fix landing page

fix landing page

fix landing page

remove commented out sections

remove default ee

set local admin password

set ee for fact scan

fall back to default ee for patching

check for valid org_id

check for valid org_id

no gpg

no gpg

add satllite stuff

update cred type

update cred type

raw

raw

raw

add satellite demos

move satellite vars to setup.yml

fix var

fix playbook path

remove async

fix =

fix condition

fix lookup

add credential

update tools version

fix scap role

add satellite setup

add satellite stuff

remove local

stupid

stupid

params

these vars arent right

these vars arent right

add compliance workflow

work on landing page

work on landing page

work on landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

landing page

add files

derp

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add link

add ee

add ee

add ee

fix landing page

fix landing page

fix landing page

fix landing page

fix landing page

remove commented out sections

remove default ee

set local admin password

set ee for fact scan

fall back to default ee for patching

check for valid org_id

check for valid org_id

no gpg

no gpg

update cred type

update cred type

raw

merge satellite

 fix vars

 fix vars

 fix vars

 fix vars

add publish

add lifecycle and actviation keys

workaround for publish issue

use module to publish

use module to publish

use module to publish

use module to publish

change sat version

change sat version

change sat version

remove maint repos

launch sat setup

reorder

reorder

moar inventory

add manifest refresh

add telemetry

run linux setup

* Updates to node1 (#42)

clean up satellite config
clean up server registration
add web console job

Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com>

* add rhel 8 tailoring

* add ee

* dont verify certs

* Update setup.yml

* Update setup.yml

* what the heck

Co-authored-by: calvingsmith <4283930+calvingsmith@users.noreply.github.com>
Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com>

Fixes for Issues 54 and 55 (#56)

* add fixes

* add survey for org id

updated version (#58)

add rhel9 (#18)

check-install missing packages (#63)

* check-install missing packages
* updated subcription manager installation
* move subscription manager install up

Bump ansible.controller version (#60)

* bump

* bumperino

* corrected

* Update requirements.yml

* Update requirements.yml

* Update requirements.yml

---------

Co-authored-by: willtome <willtome@gmail.com>

fix selinux variables (#66)

Integration of Content Lab for AWS (#67)

* add jobs

* role name

* scm

* naming

* add new jobs

* update URL

* add playbook

* add keypair

* fix spaces

* update setup

* add rhel9

* change to main branch
This commit is contained in:
willtome
2022-06-28 14:30:47 -04:00
parent 8acff9c9b1
commit b670b6e780
110 changed files with 4644 additions and 433 deletions

View File

@@ -1,6 +0,0 @@
{
"default": true,
"MD003": false,
"MD013": false,
"MD033": false
}

View File

@@ -1,52 +0,0 @@
---
##########################
##########################
## Ansible Linter rules ##
##########################
##########################
#############################
# Exclude paths from linter #
#############################
#exclude_paths:
########################
# Make output parsable #
########################
parseable: true
#######################
# Set output to quiet #
#######################
quiet: true
#####################
# Path to rules dir #
#####################
#rulesdir:
################
# Tags to skip #
################
skip_list:
- 'empty-string-compare' # Allow compare to empty string
- '204' # Allow string length greater than 160 chars
- 'no-changed-when' # False positives for running command shells
- 'command-instead-of-module' # Allow git commands for push, add, etc...
- 'command-instead-of-shell' # Allow use of shell when you want
- 'no-handler' # Allow step to run like handler
##################
# Tags to follow #
##################
#tags:
#############
# Use rules #
#############
use_default_rules: true
#################
# Set verbosity #
#################
verbosity: 1

View File

@@ -1,35 +0,0 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################
# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#
###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 400 # Line length 80 is far to short
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading
#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines

46
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,46 @@
# Contribution Guidelines
This document aims to outline the requirements for the various forms of contribution for this project.
**ALL** contributions are subject to review via pull request
## Pull Requests
1) Ensure the "base repository" is set to "RedHatGov/product-demos" since this is a fork it defaults to it's parent "ansible/product-demos".
### Pull Request Guidelines
- PRs should include the playbook/demo and required entry in corresponding `<demo>/setup.yml`.
- PRs should include documentation in corresponding `<demo>/README.md`.
- PRs should be rebased against the `main` branch to avoid conflicts.
- PRs should not impact more than a single directory/demo section.
- PRs should not rely on external infrastructure or configuration unless the dependency is automated or specified in the `user_message` of `setup.yml`.
## Adding a New Demo
1) Create a new branch based on main. (eg. `git checkout -b <branch name>`)
2) Add your playbook to the appropriate demo/section subdirectory.
3) Make any changes needed to match the existing standards in the directory.
1) Ex: Parameterized hosts
```ansible
hosts: "{{ HOSTS | default('windows') }}"
```
4) Create an entry for your playbook in your subdirectories `setup.yml`
1) You can copy paste an existing one and edit it.
2) Ensure you edit the name, playbook path, survey etc.
5) Add any needed roles/collections to the [requirements.yml](/collections/requirements.yml)
6) Test via RHPDS, specify your branch name within the project configuration.
## New Demo Section/Category
1) Create a new subdirectory with no spaces
2) Create a new setup.yml copying appropriate elements from another
- Below is a sample skeleton for a new setup.yml
```ansible
---
user_message: ''
controller_components:
- job_templates
controller_templates:
...
```
- `controller_components` can be any of the roles defined [here](https://github.com/redhat-cop/controller_configuration/tree/devel/roles)
- Add variables for each component listed
3) Include a README.md in the subdirectory

View File

@@ -2,24 +2,20 @@
This is a centralized location for all Ansible Product Demos going forward.
| Demo Name | Description |
|------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| [AAP on CodeReady](aap-on-crc/README.md) | Repository and video of how to install Ansible Automation Platform on Code Ready Containers |
| [Infrastructure Demos](old-demo-repository#infrastructure-demos) | Azure, AWS, Chocolatey, Linux and Windows Demos |
| [Network Demos](old-demo-repository#network-demos) | Cisco IOS and F5 Demos |
| [Security Demos](old-demo-repository#security-demos) | OSCAP and hardening demos |
| [Developer Demos](old-demo-repository#developer-demos) | Create Reports with Ansible |
| Demo Name | Description |
|-----------|-------------|
| [Linux](linux/README.md) | Repository of demos for RHEL and Linux automation |
| [Windows](windows/README.md) | Repository of demos for Windows Server automation |
| [Cloud](cloud/README.md) | Demo for infrastructure and cloud provisioning automation |
| [Network](network/README.md) | Ansible Network automation demos |
## Contributions
Please push contributions via a pull request following the naming convention of name-of-demo.
[![GitHub Super-Linter](https://github.com/ansible/ansible-demos/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
If you would like to contribute to this project please refer to [contribution guide](CONTRIBUTING.md) for best practices.
## Using this project
> This project is tested for compatibility with AAP2 Linux Automation Workshop available to Red Hat Employees and Partners.
> This project is tested for compatibility with AAP2 Linux Automation Workshop available to Red Hat Employees and Partners. To use with other Ansible Controller installations, review the [pre-requisite documentation](https://github.com/RedHatGov/ansible-tower-samples/tree/product-demos).
1. First you must create a credential for [Automation Hub](https://console.redhat.com/ansible/automation-hub/) to successfully sync collections used by this project.
@@ -40,6 +36,4 @@ Please push contributions via a pull request following the naming convention of
- Name: Controller Credential
- Extra vars:
demo: <linux or windows>
4. If you require a Windows Active Directory domain you will need to run the "ACTIVE DIRECTORY / Create Active Directory domain" template after the Windows setup completes. This will create the "ansible.local" domain as well as a few generic users and groups.
demo: <linux or windows or cloud or network>

3
ansible.cfg Normal file
View File

@@ -0,0 +1,3 @@
[defaults]
collections_paths=./collections
roles_path=./roles

25
cloud/aws_key.yml Normal file
View File

@@ -0,0 +1,25 @@
---
- name: Create AWS keypair
hosts: localhost
vars:
aws_key_name: aws-test-key
aws_keypair_owner: undef
tasks:
- name: Fail if variables not defined
ansible.builtin.assert:
that:
- aws_key_name is defined
- aws_region is defined
- aws_public_key is defined
- aws_keypair_owner is defined
fail_msg: "Required variables not set"
- name: Create AWS keypair
amazon.aws.ec2_key:
name: "{{ aws_key_name }}"
region: "{{ aws_region }}"
key_material: "{{ aws_public_key }}"
state: present
tags:
owner: "{{ aws_keypair_owner }}"

View File

@@ -0,0 +1,7 @@
---
vm_providers:
- aws
aws_image_owners: 309956199498
aws_instance_size: t3.micro
aws_image_architecture: x86_64
aws_image_filter: 'RHEL-9*HVM-*Hourly*'

View File

@@ -1,13 +1,27 @@
---
user_message:
- Update AWS credential with Access and Secret key
- Update Workshop Credential with password used to login to Controller
controller_components:
- execution_environments
- projects
- credentials
- inventory_sources
- groups
- job_templates
controller_execution_environments:
- name: Cloud Services Execution Environment
image: quay.io/scottharwell/cloud-ee:latest
controller_projects:
- name: Ansible Cloud Content Lab - AWS
organization: Default
scm_type: git
wait: yes
#scm_url: https://github.com/ansible-content-lab/aws.infrastructure_config_demos.git
scm_url: https://github.com/willtome/aws.infrastructure_config_demos.git
default_environment: Cloud Services Execution Environment
controller_credentials:
- name: AWS
credential_type: Amazon Web Services
@@ -36,11 +50,17 @@ controller_inventory_sources:
- tag:Name
compose:
ansible_host: public_ip_address
ansible_user: 'ec2-user'
groups:
cloud_aws: true
os_linux: tags.blueprint.startswith('rhel')
keyed_groups:
- key: platform
prefix: os
- key: tags.blueprint
prefix: blueprint
- key: tags.owner
prefix: owner
#- name: Azure Inventory
# organization: Default
@@ -59,7 +79,73 @@ controller_inventory_sources:
# conditional_groups:
# cloud_azure: true
controller_groups:
- name: cloud_aws
inventory: Workshop Inventory
variables:
ansible_user: ec2-user
controller_templates:
- name: Cloud / AWS / Create Peer Infrastructure
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_create_peer_network.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
dmz_ssh_key_name: aws-test-key
priv_network_ssh_key_name: aws-test-key
- name: Cloud / AWS / Delete Peer Infrastructure
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_delete_peer_network.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
- name: Cloud / AWS / Create Transit Infrastructure
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_create_transit_network.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
dmz_ssh_key_name: aws-test-key
priv_network_ssh_key_name: aws-test-key
- name: Cloud / AWS / Delete Transit Infrastructure
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_delete_transit_network.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
- name: Cloud / Create Infra
job_type: run
organization: Default
@@ -69,7 +155,9 @@ controller_templates:
project: Ansible official demo project
playbook: cloud/create_infra.yml
inventory: Workshop Inventory
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
extra_vars:
aws_region: us-east-2
@@ -88,20 +176,23 @@ controller_templates:
type: textarea
required: false
variable: aws_public_key
- name: Cloud / Create VM
- name: Cloud / AWS / Create VM
job_type: run
organization: Default
credentials:
- AWS
#- Azure
- Workshop Credential
project: Ansible official demo project
playbook: cloud/create_vm.yml
project: Ansible Cloud Content Lab - AWS
playbook: playbook_create_vm.yml
inventory: Workshop Inventory
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
extra_vars:
aws_region: us-east-2
aws_region: us-east-1
aws_keypair_name: aws-test-key
survey:
name: ''
description: ''
@@ -114,42 +205,121 @@ controller_templates:
type: text
variable: vm_owner
required: true
- question_name: Provider
- question_name: Deployment
type: text
variable: vm_deployment
required: true
- question_name: Environment
type: multiplechoice
variable: vm_provider
variable: vm_environment
required: true
choices:
- aws
#- azure
- Dev
- QA
- Prod
- question_name: Blueprint
type: multiplechoice
variable: vm_blueprint
required: true
choices: #"{{ lookup('fileglob', 'blueprints/*.yml') | regex_replace(',','\n') | regex_findall('.*/(.*)(?=.yml)') | list }}"
choices:
- windows_core
- windows_full
- rhel9
- rhel8
- rhel7
- name: Cloud / Destroy VM
- question_name: Subnet
type: text
variable: aws_vpc_subnet_name
required: true
default: dmz-subnet
- question_name: Security Group
type: text
variable: aws_securitygroup_name
required: true
default: dmz-sg
- name: Cloud / AWS / Delete VM
job_type: run
organization: Default
credentials:
- AWS
#- Azure
- Workshop Credential
project: Ansible official demo project
playbook: cloud/destroy_vm.yml
project: Ansible Cloud Content Lab - AWS
playbook: playbook_delete_inventory_vm.yml
inventory: Workshop Inventory
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
extra_vars:
aws_region: us-east-2
aws_region: us-east-1
survey:
name: ''
description: ''
spec:
- question_name: Name or Pattern
type: text
variable: HOSTS
variable: _hosts
required: true
- name: Cloud / AWS / VPC Report
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_create_reports.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
aws_report: vpc
- name: Cloud / AWS / Tags Report
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Cloud Content Lab - AWS
playbook: playbook_create_reports.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
extra_vars:
aws_region: us-east-1
aws_report: tags
- name: Cloud / AWS / Create Keypair
job_type: run
organization: Default
credentials:
- AWS
project: Ansible official demo project
playbook: cloud/aws_key.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
extra_vars:
aws_region: us-east-1
survey:
name: ''
description: ''
spec:
- question_name: Keypair Name
type: text
variable: aws_key_name
required: true
default: aws-test-key
- question_name: Keypair Public Key
type: textarea
variable: aws_public_key
required: true
- question_name: Owner
type: text
variable: aws_keypair_owner
required: true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

@@ -0,0 +1,207 @@
p.hostname {
color: #000000;
font-weight: bolder;
font-size: large;
margin: auto;
width: 50%;
}
#subtable {
background: #ebebeb;
margin: 0px;
width: 100%;
}
#subtable tbody tr td {
padding: 5px 5px 5px 5px;
}
#subtable thead th {
padding: 5px;
}
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-family: "Open Sans", "Helvetica";
}
a {
color: #ffffff;
}
p {
color: #ffffff;
}
h1 {
text-align: center;
color: #ffffff;
}
body {
background:#353a40;
padding: 0px;
margin: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
table {
border-collapse: separate;
background:#fff;
@include border-radius(5px);
@include box-shadow(0px 0px 5px rgba(0,0,0,0.3));
}
.main_net_table {
margin:50px auto;
}
.main_net_table {
margin:50px auto;
}
thead {
@include border-radius(5px);
}
thead th {
font-size:16px;
font-weight:400;
color:#fff;
@include text-shadow(1px 1px 0px rgba(0,0,0,0.5));
text-align:left;
padding:20px;
border-top:1px solid #858d99;
background: #353a40;
&:first-child {
@include border-top-left-radius(5px);
}
&:last-child {
@include border-top-right-radius(5px);
}
}
tbody tr td {
font-weight:400;
color:#5f6062;
font-size:13px;
padding:20px 20px 20px 20px;
border-bottom:1px solid #e0e0e0;
}
tbody tr:nth-child(2n) {
background:#f0f3f5;
}
tbody tr:last-child td {
border-bottom:none;
&:first-child {
@include border-bottom-left-radius(5px);
}
&:last-child {
@include border-bottom-right-radius(5px);
}
}
td {
vertical-align: top;
}
span.highlight {
background-color: yellow;
}
.expandclass {
color: #5f6062;
}
.content{
display:none;
margin: 10px;
}
header {
width: 100%;
position: initial;
float: initial;
padding: 0;
margin: 0;
border-radius: 0;
height: 88px;
background-color: #171717;
}
.header-container {
margin: 0 auto;
width: 100%;
height: 100%;
max-width: 1170px;
padding: 0;
float: initial;
display: flex;
align-items: center;
}
.header-logo {
width: 137px;
border: 0;
margin: 0;
margin-left: 15px;
}
.header-link {
margin-left: 40px;
text-decoration: none;
cursor: pointer;
text-transform: uppercase;
font-size: 15px;
font-family: 'Red Hat Text';
font-weight: 500;
}
.header-link:hover {
text-shadow: 0 0 0.02px white;
text-decoration: none;
}
table.net_info td {
padding: 5px;
}
p.expandclass:hover {
text-decoration: underline;
color: #EE0000;
cursor: pointer;
}
.summary_info {
}
.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 {
border: 1px solid #5F0000;
background: #EE0000;
}
div#net_content {
padding: 0px;
height: auto !important;
}
img.router_image {
vertical-align: middle;
padding: 0px 10px 10px 10px;
width: 50px;
}
table.net_info {
width: 100%;
}
p.internal_label {
color: #000000;
}

View File

@@ -1,13 +1,21 @@
- name: Create web directory if it does not exist
ansible.builtin.file:
path: "{{ file_path }}"
state: directory
mode: '0755'
- name: create HTML report
ansible.builtin.template:
src: report.j2
dest: "{{ file_path }}/network.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,7 +26,8 @@
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "router.png"
check_mode: no
- name: display link to inventory report
ansible.builtin.debug:
msg: "Please go to http://{{ ansible_host }}/network.html"
# - name: Display link to Linux patch report
# ansible.builtin.debug:
# msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/network.html"

View File

@@ -0,0 +1,41 @@
<!-- INTERNAL TABLE FOR Ansible -->
<div id="accordion">
<div>
<h3>Ansible Automation Info</h3>
<div class="net_content">
<table class="net_info">
<tbody>
<tr>
<td>Ansible user</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_user'] }}</td>
</tr>
<tr>
<td>Transport</td>
<td class="sub_net_info">{% set ansible_connection = hostvars[network_switch]['ansible_net_api'] %}{{ transport[ansible_connection] }}</td>
</tr>
<tr>
<td>Ansible Mgmt IP</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_host'] | default('N/A') }}</td>
</tr>
<tr>
<td>Ansible groups</td>
<td class="sub_net_info">{% for group in hostvars[network_switch]['group_names'] %}{{ group }} {% endfor %}</td>
</tr>
<tr>
<td>Ansible core version</td>
<td class="sub_net_info">{% for group in hostvars[network_switch]['ansible_version']['string']|default("Unknown") %}{{ group }} {% endfor %}</td>
</tr>
<tr>
<td>Ansible Python</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_playbook_python']|default("Unknown") }} </td>
</tr>
<tr>
<td>Python version</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_net_python_version']|default("Unknown") }} </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END INTERNAL TABLE FOR Ansible -->

View File

@@ -1,25 +1,46 @@
<! INTERNAL TABLE FOR BGP --!>
<!-- INTERNAL TABLE FOR BGP -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">BGP Global Info</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>BGP Global Info</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['bgp_global'] is defined and hostvars[network_switch]['ansible_network_resources']['bgp_global']|length > 0 %}
<table id="subtable">
<thead>
<tr>
<th>ASN</th>
<th>Router ID</th>
</tr>
</thead>
<tbody>
{% for bgpinfo in hostvars[network_switch]['ansible_network_resources']['bgp_global'] %}
<tr>
<td>{{bgpinfo['as_number']}}</td>
<td>{{bgpinfo['router_id']|default("Not Configured")}}</td>
<td>{{ hostvars[network_switch].ansible_network_resources.bgp_global['as_number']|default("Not Configured") }}</td>
<td>{{ hostvars[network_switch].ansible_network_resources.bgp_global.bgp['router_id']['address']|default("Not Configured") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if hostvars[network_switch]['ansible_network_resources']['bgp_global'][
'neighbor'] is defined and hostvars[network_switch]['ansible_network_resources']['bgp_global'][
'neighbor']|length > 0 %}
<p class="internal_label">BGP Neighbors</p>
<table id="subtable">
<thead>
<tr>
<th>Address</th>
<th>Remote AS</th>
</tr>
</thead>
<tbody>
{% for bgp_neighbor in hostvars[network_switch].ansible_network_resources.bgp_global.neighbor %}
<tr>
<td>{{ bgp_neighbor['address']|default("Not Configured") }}</td>
<td>{{ bgp_neighbor['remote_as']|default("Not Configured") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% elif hostvars[network_switch]['ansible_network_resources']['bgp_global'] is defined and hostvars[network_switch]['ansible_network_resources']['bgp_global']|length == 0 %}
BGP is not configured on this device
{% else %}
@@ -28,4 +49,4 @@ No BGP information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR BGP --!>
<!-- END INTERNAL TABLE FOR BGP -->

View File

@@ -0,0 +1,46 @@
<!-- INTERNAL TABLE FOR BGP -->
<div id="accordion">
<div>
<h3>BGP Address Family</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family'] is defined and hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']|length > 0 %}
{% for address_family in hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family'] %}
<p class="internal_label">Address Family {{ address_family['afi'] }}</p>
<table id="subtable">
<thead>
<tr>
<th>Network</th>
</tr>
</thead>
<tbody>
{% if hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']['networks'] is defined %}
{% for bgp_network in address_family['networks'] %}
<tr>
<td>{{ bgp_network['prefix']|default("Not Configured") }}</td>
</tr>
{% endfor %}
{% elif hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']['network'] is defined %}
{% for bgp_network in address_family['network'] %}
<tr>
<td>{{ bgp_network['address']|default("Not Configured") }}</td>
<td>{{ bgp_network['mask']|default("Not Configured") }}</td>
</tr>
{% endfor %}
{% else %}
No BGP networks information available
{% endif %}
</tbody>
</table>
{% endfor %}
{% elif hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family'] is defined and hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']|length == 0 %}
no BGP address-family is not configured on this device
{% else %}
No BGP information available
{% endif %}
</div>
</div>
</div>
<!-- END INTERNAL TABLE FOR BGP -->

View File

@@ -1,5 +1,3 @@
<div class="wrapper">
<header>
<div class="header-container">
@@ -12,4 +10,4 @@
/>
</a>
</div>
</header>
</header>

View File

@@ -1,10 +1,8 @@
<! INTERNAL TABLE FOR INTERFACES --!>
<!-- INTERNAL TABLE FOR INTERFACES -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">
Interfaces - MTU/Duplex/Speed
</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>Interfaces - MTU/Duplex/Speed</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['interfaces'] is defined and hostvars[network_switch]['ansible_network_resources']['interfaces']|length > 0 %}
<table id="subtable">
<thead>
@@ -23,7 +21,7 @@
<td>{{interface['name']}}</td>
<td>{{interface['description']|default("none")}}</td>
<td>{{interface['duplex']|default("default")}}</td>
<td>{{interface['enabled']}}</td>
<td>{{interface['enabled']|default("N/A")}}</td>
<td>{{interface['mtu']|default("default")}}</td>
<td>{{interface['speed']|default("default")}}</td>
</tr>
@@ -38,4 +36,4 @@ No Interface information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR INTERFACES --!>
<!-- END INTERNAL TABLE FOR INTERFACES -->

View File

@@ -1,8 +1,8 @@
<! INTERNAL TABLE FOR l2_interfaces --!>
<!-- INTERNAL TABLE FOR l2_interfaces -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">L2 Interfaces - Trunk/Access Ports</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>L2 Interfaces - Trunk/Access Ports</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['l2_interfaces'] is defined and hostvars[network_switch]['ansible_network_resources']['l2_interfaces']|length > 0 %}
<table id="subtable">
<thead>
@@ -34,4 +34,4 @@ No L2 information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR l2_interfaces --!>
<!-- END INTERNAL TABLE FOR l2_interfaces -->

View File

@@ -1,8 +1,8 @@
<! INTERNAL TABLE FOR L3_INTERFACES --!>
<!-- INTERNAL TABLE FOR L3_INTERFACES -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">L3 Interfaces - IP Addresses</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>L3 Interfaces - IP Addresses</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['l3_interfaces'] is defined and hostvars[network_switch]['ansible_network_resources']['l3_interfaces']|length > 0 %}
<table id="subtable">
<thead>
@@ -16,15 +16,11 @@
{% for interface in hostvars[network_switch]['ansible_network_resources']['l3_interfaces'] %}
<tr>
<td>{{interface['name']}}</td>
<! INTERNAL IPv4 LOOP FOR L3_INTERFACES --!>
<!-- INTERNAL IPv4 LOOP FOR L3_INTERFACES -->
<td>
{% if interface.ipv4 is defined %}
{% for address in interface.ipv4 %}
{% if address['address'] is defined %}
{{address['address']}}
{% else %}
dhcp
{% endif %}
{{ address['address']|default("Not Configured") }}
{% if address['secondary'] is defined %}
secondary
{% endif %}
@@ -32,17 +28,17 @@ secondary
{% endfor %}
{% endif %}
</td>
<! END IPv4 INTERNAL LOOP FOR L3_INTERFACES --!>
<! INTERNAL IPv6 LOOP FOR L3_INTERFACES --!>
<!-- END IPv4 INTERNAL LOOP FOR L3_INTERFACES -->
<!-- INTERNAL IPv6 LOOP FOR L3_INTERFACES -->
<td>
{% if interface.ipv6 is defined %}
{% for v6address in interface.ipv6 %}
{{v6address['address']}}
{{v6address['address']|default("Not Configured") }}
{% if loop.length > 1 and not loop.last %}<br>{% endif %}
{% endfor %}
{% endif %}
</td>
<! END INTERNAL LOOP FOR L3_INTERFACES --!>
<!-- END INTERNAL LOOP FOR L3_INTERFACES -->
</tr>
{% endfor %}
</tbody>
@@ -55,4 +51,4 @@ No L3 information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR L3_INTERFACES --!>
<!-- END INTERNAL TABLE FOR L3_INTERFACES -->

View File

@@ -1,8 +1,8 @@
<! INTERNAL TABLE FOR LACP --!>
<!-- INTERNAL TABLE FOR LACP -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">LACP</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>LACP</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['lacp'] is defined and hostvars[network_switch]['ansible_network_resources']['lacp'].keys()|length > 0 %}
<table id="subtable">
<thead>
@@ -11,14 +11,14 @@
</tr>
</thead>
<tbody>
{% for property in hostvars[network_switch]['ansible_network_resources']['lacp'] %}
<tr>
{% if hostvars[network_switch]['ansible_network_resources']['lacp']['system'] is defined %}
<td> {{hostvars[network_switch]['ansible_network_resources']['lacp']['system']['priority']}}</td>
{% endif %}
<td>{% if property['system'] is defined %} }{{property['system']['priority']}}{% else %}LACP not configured {% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% elif hostvars[network_switch]['ansible_network_resources']['lacp'] is defined and hostvars[network_switch]['ansible_network_resources']['lacp']|length == 0 %}
{% elif hostvars[network_switch]['ansible_network_resources']['lacp'] is defined and hostvars[network_switch]['ansible_network_resources']['lacp'].keys()|length == 0 %}
LACP is not configured on this device
{% else %}
No LACP information available
@@ -26,4 +26,4 @@ No LACP information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR LACP --!>
<!-- END INTERNAL TABLE FOR LACP -->

View File

@@ -1,9 +1,9 @@
<! INTERNAL TABLE FOR lldp_interfaces --!>
<!-- INTERNAL TABLE FOR lldp_interfaces -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">LLDP Interfaces</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
{% if hostvars[network_switch]['ansible_network_resources']['lldp_interfaces'] is defined and hostvars[network_switch]['ansible_network_resources']['lldp_interfaces']|length > 0 %}
<div>
<h3>LLDP Interfaces</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['lldp_interfaces'] is defined %}
<table id="subtable">
<thead>
<tr>
@@ -22,12 +22,10 @@
{% endfor %}
</tbody>
</table>
{% elif hostvars[network_switch]['ansible_network_resources']['lldp_interfaces'] is defined and hostvars[network_switch]['ansible_network_resources']['lldp_interfaces'].keys()|length == 0 %}
LLDP is not configured on this device
{% else %}
No LLDP information available
{% endif %}
</div>
</div>
</div>
<! END INTERNAL TABLE FOR lldp_interfaces --!>
<!-- END INTERNAL TABLE FOR lldp_interfaces -->

View File

@@ -1,8 +1,8 @@
<! INTERNAL TABLE FOR OSPF --!>
<!-- INTERNAL TABLE FOR OSPF -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">OSPF Global Info</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>OSPF Global Info</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['ospfv2'] is defined and hostvars[network_switch]['ansible_network_resources']['ospfv2']|length > 0 %}
<table id="subtable">
<thead>
@@ -12,10 +12,12 @@
</tr>
</thead>
<tbody>
{% for key,value in hostvars[network_switch]['ansible_network_resources']['ospfv2'].items() %}
<tr>
<td>1</td>
<td>{{ hostvars[network_switch]['ansible_network_resources']['ospfv2']['parameters']['router_id'] }}</td>
<td>{{ value[0].process_id }}</td>
<td>{{ value[0].router_id|default("Not Configured") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% elif hostvars[network_switch]['ansible_network_resources']['ospfv2'] is defined and hostvars[network_switch]['ansible_network_resources']['ospfv2']|length == 0 %}
@@ -26,4 +28,4 @@ No OSPF information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR OSPF --!>
<!-- END INTERNAL TABLE FOR OSPF -->

View File

@@ -1,13 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title> Ansible Network Automation Report </title>
<title>Network Automation Report</title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/new.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="css/main.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function() {
$( "#accordion > div" ).accordion({
@@ -17,55 +16,14 @@ collapsible: true
});
});
</script>
<script>
(function(document) {
'use strict';
var TableFilter = (function(myArray) {
var search_input;
function _onInputSearch(e) {
search_input = e.target;
var tables = document.getElementsByClassName(search_input.getAttribute('data-table'));
myArray.forEach.call(tables, function(table) {
myArray.forEach.call(table.tBodies, function(tbody) {
myArray.forEach.call(tbody.rows, function(row) {
var text_content = row.textContent.toLowerCase();
var search_val = search_input.value.toLowerCase();
row.style.display = text_content.indexOf(search_val) > -1 ? '' : 'none';
});
});
});
}
return {
init: function() {
var inputs = document.getElementsByClassName('search-input');
myArray.forEach.call(inputs, function(input) {
input.oninput = _onInputSearch;
});
}
};
})(Array.prototype);
document.addEventListener('readystatechange', function() {
if (document.readyState === 'complete') {
TableFilter.init();
}
});
})(document);
</script>
</head>
<body>
<div class="wrapper">
{% include 'header.j2' %}
<section>
<center>
<h1>Ansible Network Automation Report</h1>
<h3><input type="search" placeholder="Search..." class="form-control search-input" data-table="main_net_table"/>
<h1>Ansible Network Automation Example Report</h1>
</center>
<table class="table table-striped mt32 main_net_table">
<table class="main_net_table">
<thead>
<tr>
<th>Network Device</th>
@@ -75,35 +33,71 @@ collapsible: true
</tr>
</thead>
<tbody>
{% for network_switch in groups['tag_Router']|sort %}
{% for network_switch in groups['routers']|sort %}
{% if hostvars[network_switch].ansible_facts.network_resources is defined %}
<tr>
<td class="summary_info">
<div id="hostname">
<p class="hostname">
<img class="router_image" src="router.png"> {{ hostvars[network_switch]['ansible_net_hostname'].split('.')[0] }}</p>
</div>
{% include 'summary.j2' %}
</td>
<td>
{% include 'interfaces.j2' %}
</td>
<td>
{% include 'vlans.j2' %}
{% include 'lldp_interfaces.j2' %}
{% include 'l2_interfaces.j2' %}
</td>
<td>
{% include 'l3_interfaces.j2' %}
{% include 'lacp.j2' %}
{% include 'bgp.j2' %}
{% include 'ospf.j2' %}
</td>
<p class="hostname"><img class="router_image" src="router.png" alt="picture of network device">{{ hostvars[network_switch].ansible_net_hostname }}</p>
</div>
<div id="net_info_div">
<table class="net_info">
<tbody>
<tr>
<td>Platform</td>
<td class="sub_net_info">{% set ansible_network_os = hostvars[network_switch]['ansible_net_system'] %}{{ vendor[ansible_network_os]}} {{hostvars[network_switch]['ansible_net_system'] }}</td>
</tr>
<tr>
<td>Code Version</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_net_version'] }}</td>
</tr>
<tr>
<td>Model</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_net_model'] }}</td>
</tr>
<tr>
<td>Serial Number</td>
<td class="sub_net_info">{{ hostvars[network_switch]['ansible_net_serialnum'] | default('N/A') }}</td>
</tr>
</tbody>
</table>
{% include 'ansible.j2' %}
</div>
</td>
<td>
{% include 'interfaces.j2' %}
</td>
<td>
{% include 'vlans.j2' %}
{% include 'lldp_interfaces.j2' %}
{% include 'l2_interfaces.j2' %}
</td>
<td>
{% include 'l3_interfaces.j2' %}
{% include 'lacp.j2' %}
{% include 'static.j2' %}
{% include 'bgp.j2' %}
{% include 'bgp_address_family.j2' %}
{% include 'ospf.j2' %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<center><p>Created with</p><br><img src="webpage_logo.png" width="300">
<center><p>Created with</p><br><img src="webpage_logo.png" width="300" alt="red hat ansible automation platform logo">
<p>The source code to create this report can be found at <a href="https://github.com/network-automation/toolkit">https://github.com/network-automation/toolkit</a><br><br>
If you are new to Ansible Automation check out the following links:<br>
<a href="https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html">Getting Started</a><br>
<a target="_blank" href="https://ansible.com/workshops">Free hands-on workshops</a><br>
<a href="https://youtube.com/ansibleautomation">Youtube Videos</a><br>
</p>
</center>
</section>
</div>

View File

@@ -0,0 +1,45 @@
<!-- INTERNAL TABLE FOR Static Routes -->
<div id="accordion">
<div>
<h3>Static Routes</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['static_routes'] is defined and hostvars[network_switch]['ansible_network_resources']['static_routes']|length > 0 %}
<table id="subtable">
<thead>
<tr>
<th>VRF</th>
<th>Address-Family</th>
<th>Route</th>
<th>Interface</th>
<th>Next-Hop Address</th>
<th>Global</th>
</tr>
</thead>
<tbody>
{% for net_route in hostvars[network_switch]['ansible_network_resources']['static_routes'] %}
<tr>
<td>{{ net_route['vrf']|default("N/A") }}</td>
{% for address_family in net_route.address_families|default([]) %}
<td>{{ address_family['afi'] }}</td>
{% for routes in address_family['routes'] %}
<td>{{ routes['dest'] }}</td>
{% for next_hops in routes['next_hops'] %}
<td>{{ next_hops['interface']|default("N/A") }}</td>
<td>{{ next_hops['forward_router_address']|default("N/A") }}</td>
<td>{{ next_hops['global']|default("N/A") }}</td>
{% endfor %}
{% endfor %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% elif hostvars[network_switch]['ansible_network_resources']['static_routes'] is defined and hostvars[network_switch]['ansible_network_resources']['static_routes']|length == 0 %}
Static Routes are not configured on this device
{% else %}
No Static Route information available
{% endif %}
</div>
</div>
</div>
<!-- END INTERNAL TABLE FOR Static Routes -->

View File

@@ -1,25 +0,0 @@
<div id="net_info_div">
<table class="net_info">
<tbody>
<tr>
<td>Platform</td>
<td class="sub_net_info">{{hostvars[network_switch]['ansible_net_system']}}</td>
</tr>
<tr>
<td>Code Version</td>
<td class="sub_net_info">{{hostvars[network_switch]['ansible_net_version']}}</td>
</tr>
<tr>
<td>Model</td>
<td class="sub_net_info">{{hostvars[network_switch]['ansible_net_model']|default("N/A")}}</td>
</tr>
<tr>
<td>Serial Number</td>
<td class="sub_net_info">{{hostvars[network_switch]['ansible_net_serialnum']}}</td>
</tr>
<tr>
<td>Transport</td>
<td class="sub_net_info">{{hostvars[network_switch]['ansible_net_api']}}</td>
</tbody>
</table>
</div>

View File

@@ -1,8 +1,8 @@
<! INTERNAL TABLE FOR VLANS --!>
<!-- INTERNAL TABLE FOR VLANS -->
<div id="accordion">
<div class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-3" aria-controls="ui-id-4" aria-selected="false" aria-expanded="false" tabindex="0">VLANs</h3>
<div class="net_content ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" id="ui-id-4" aria-labelledby="ui-id-3" role="tabpanel" aria-hidden="true" style="display: none; height: 194px;">
<div>
<h3>VLANs</h3>
<div class="net_content">
{% if hostvars[network_switch]['ansible_network_resources']['vlans'] is defined and hostvars[network_switch]['ansible_network_resources']['vlans']|length > 0 %}
<table id="subtable">
<thead>
@@ -30,4 +30,4 @@ No VLAN information available
</div>
</div>
</div>
<! END INTERNAL TABLE FOR VLANS --!>
<!-- END INTERNAL TABLE FOR VLANS -->

View File

@@ -1 +1,11 @@
file_path: /var/www/html
file_path: "{{ web_path | default('/var/www/html/reports') }}"
vendor:
ios: &my_value 'Cisco'
nxos: *my_value
iosxr: *my_value
junos: "Juniper"
eos: "Arista"
transport:
cliconf: "Network_CLI"
netconf: "NETCONF"
nxapi: "NX-API"

View File

@@ -1,11 +1,10 @@
---
- name: Scan packages
demo.patching.scan_packages:
os_family: "{{ ansible_os_family }}"
- name: get packages
ansible.builtin.package_facts:
check_mode: no
- name: Scan services
demo.patching.scan_services:
- name: get services
ansible.builtin.service_facts:
check_mode: no
- name: upgrade packages (yum)
@@ -35,4 +34,4 @@
ansible.builtin.reboot:
when:
- result.rc == 1
- allow_reboot == true
- allow_reboot == true

View File

@@ -29,7 +29,7 @@ p.hostname {
}
a {
color: #ffffff;
color: #000000;
}
p {
@@ -199,4 +199,4 @@ table.net_info {
p.internal_label {
color: #000000;
}
}

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="930.2px" height="350px" viewBox="0 0 930.2 350" style="enable-background:new 0 0 930.2 350;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#EE0000;}
</style>
<title>Logo-Red_Hat-Ansible_Automation_Platform-A-Reverse-RGB</title>
<path class="st0" d="M383.3,228.5h18.8L446,335.7h-17.5l-12.4-31.4h-48l-12.6,31.4h-16.7L383.3,228.5z M410.9,291l-18.7-47l-18.7,47
H410.9z"/>
<path class="st0" d="M455.2,257.7h15.3v7.8c6.2-6.2,14.7-9.6,23.5-9.3c17.9,0,30.5,12.4,30.5,30.5v49h-15.3v-46.5
c0-12.3-7.5-19.8-19.3-19.8c-7.8-0.3-15.1,3.6-19.3,10.1v56.1h-15.3V257.7z"/>
<path class="st0" d="M543,315.5c8.1,6.4,16.7,9.8,25.4,9.8c11,0,18.7-4.8,18.7-11.7c0-5.5-4-8.7-12.6-10l-14.1-2
c-15.5-2.3-23.3-9.5-23.3-21.6c0-14.1,12.3-23.6,30.5-23.6c11.3-0.1,22.3,3.4,31.5,9.9l-7.8,10.1c-8.6-5.7-16.4-8.1-24.7-8.1
c-9.3,0-15.6,4.3-15.6,10.6c0,5.7,3.7,8.4,12.9,9.8l14.1,2c15.5,2.3,23.6,9.7,23.6,21.7c0,14-14.1,24.5-32.6,24.5
c-13.5,0-25.6-4-34.2-11.5L543,315.5z"/>
<path class="st0" d="M611.6,235.6c0-5.2,4.1-9.4,9.3-9.5c0,0,0,0,0,0c5.2-0.2,9.7,3.9,9.9,9.1c0.2,5.2-3.9,9.7-9.1,9.9
c-0.2,0-0.5,0-0.7,0C615.8,245.1,611.6,240.9,611.6,235.6C611.6,235.7,611.6,235.7,611.6,235.6z M628.6,335.7h-15.3v-78h15.3V335.7z
"/>
<path class="st0" d="M685.5,336.9c-8.5,0-16.8-2.7-23.6-7.8v6.6h-15.2V228.5l15.3-3.4v40c6.6-5.6,15.1-8.7,23.7-8.6
c22.1,0,39.4,17.7,39.4,40.1C725.2,319.1,707.9,336.9,685.5,336.9z M662,279.2v35.2c4.9,5.7,13,9.2,21.8,9.2
c15,0,26.4-11.5,26.4-26.8c0-15.3-11.5-27-26.4-27C674.9,269.8,667.1,273.2,662,279.2z"/>
<path class="st0" d="M755,335.7h-15.3V228.5l15.3-3.4V335.7z"/>
<path class="st0" d="M810.5,337.1c-23,0-40.9-17.7-40.9-40.4c0-22.5,17.2-40.1,39.1-40.1c21.5,0,37.7,17.8,37.7,40.8v4.4h-61.6
c2,13,13.2,22.5,26.4,22.4c7.2,0.2,14.2-2.3,19.8-6.8l9.8,9.7C832.1,333.7,821.5,337.4,810.5,337.1z M784.9,290.2h46.3
c-2.3-11.9-11.5-20.8-22.8-20.8C796.5,269.4,787.2,277.8,784.9,290.2z"/>
<path class="st1" d="M202.8,137.5c18.4,0,45.1-3.8,45.1-25.7c0.1-1.7-0.1-3.4-0.5-5l-11-47.7c-2.5-10.5-4.8-15.2-23.2-24.5
c-14.3-7.3-45.5-19.4-54.7-19.4c-8.6,0-11.1,11.1-21.3,11.1c-9.8,0-17.1-8.3-26.4-8.3c-8.8,0-14.6,6-19,18.4c0,0-12.4,34.9-14,40
c-0.3,0.9-0.4,1.9-0.4,2.9C77.6,92.9,131.1,137.5,202.8,137.5 M250.8,120.7c2.5,12.1,2.5,13.3,2.5,14.9c0,20.6-23.2,32.1-53.7,32.1
c-69,0-129.3-40.3-129.3-67c0-3.7,0.8-7.4,2.2-10.8c-24.8,1.3-56.9,5.7-56.9,34c0,46.4,109.9,103.5,196.9,103.5
c66.7,0,83.5-30.2,83.5-54C296.1,154.6,279.9,133.4,250.8,120.7"/>
<path d="M250.7,120.7c2.5,12.1,2.5,13.3,2.5,14.9c0,20.6-23.2,32.1-53.7,32.1c-69,0-129.3-40.3-129.3-67c0-3.7,0.8-7.4,2.2-10.8
l5.4-13.3c-0.3,0.9-0.4,1.9-0.4,2.8c0,13.6,53.5,58.1,125.2,58.1c18.4,0,45.1-3.8,45.1-25.7c0.1-1.7-0.1-3.4-0.5-5L250.7,120.7z"/>
<path class="st0" d="M869.1,151.2c0,17.5,10.5,26,29.7,26c5.9-0.1,11.8-1,17.5-2.5v-20.3c-3.7,1.2-7.5,1.7-11.3,1.7
c-7.9,0-10.8-2.5-10.8-9.9v-31.1h22.9V94.2h-22.9V67.7l-25,5.4v21.1h-16.6v20.9h16.6L869.1,151.2z M791,151.7
c0-5.4,5.4-8.1,13.6-8.1c5,0,10,0.7,14.9,1.9V156c-4.8,2.6-10.2,3.9-15.6,3.9C795.9,159.9,791.1,156.8,791,151.7 M798.7,177.5
c8.8,0,16-1.9,22.6-6.3v5h24.8v-52.5c0-20-13.5-30.9-35.9-30.9c-12.6,0-25,2.9-38.3,9l9,18.4c9.6-4,17.7-6.5,24.8-6.5
c10.3,0,15.6,4,15.6,12.2v4c-6.1-1.6-12.3-2.4-18.6-2.3c-21.1,0-33.8,8.8-33.8,24.6C768.9,166.6,780.4,177.6,798.7,177.5
M662.5,176.2h26.7v-42.5h44.6v42.5h26.7V67.7h-26.6v41.7h-44.6V67.7h-26.7L662.5,176.2z M561,135.1c0-11.8,9.3-20.8,21.5-20.8
c6.4-0.1,12.6,2.1,17.4,6.4v28.6c-4.7,4.4-10.9,6.7-17.4,6.5C570.5,155.8,561,146.8,561,135.1 M600.2,176.1H625V62.3l-25,5.4v30.8
c-6.4-3.6-13.6-5.5-20.9-5.4c-23.9,0-42.6,18.4-42.6,42c-0.3,23,18.1,41.9,41.1,42.2c0.2,0,0.5,0,0.7,0c7.9,0,15.6-2.5,22-7.1V176.1
z M486.5,113.2c7.9,0,14.6,5.1,17.2,13h-34.2C471.9,118,478.2,113.2,486.5,113.2 M444.2,135.2c0,23.9,19.5,42.5,44.6,42.5
c13.8,0,23.9-3.7,34.3-12.4l-16.6-14.7c-3.9,4-9.6,6.2-16.4,6.2c-8.8,0.2-16.8-4.9-20.2-13h58.4v-6.2c0-26-17.5-44.8-41.4-44.8
c-23.2-0.4-42.4,18.2-42.7,41.5C444.2,134.6,444.2,134.9,444.2,135.2 M400.9,90.5c8.8,0,13.8,5.6,13.8,12.2s-5,12.2-13.8,12.2h-26.3
V90.5H400.9z M347.9,176.2h26.7v-39.5h20.3l20.5,39.5h29.7l-23.9-43.4c12.4-5,20.5-17.1,20.4-30.5c0-19.5-15.3-34.5-38.3-34.5H348
L347.9,176.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -1,20 +1,22 @@
---
- include_vars: "{{ ansible_system }}.yml"
- yum:
name: httpd
state: latest
check_mode: no
- file:
path: /var/www/html/reports/
path: "{{ doc_root }}/{{ reports_dir }}"
state: directory
check_mode: no
- copy:
dest: /var/www/html/reports/.htaccess
dest: "{{ doc_root }}/{{ reports_dir }}/.htaccess"
content: Options +Indexes
check_mode: no
- service:
name: httpd
state: started
check_mode: no
check_mode: no

View File

@@ -1,4 +1,6 @@
---
- include_vars: "{{ ansible_system }}.yml"
- name: Install IIS
ansible.windows.win_feature:
name: Web-Server
@@ -13,11 +15,11 @@
- name: Create Directory
ansible.windows.win_file:
path: C:\Inetpub\wwwroot\reports
path: "{{ doc_root }}\\{{ reports_dir }}"
state: directory
check_mode: no
- name: Enable Directory Browsing
ansible.windows.win_powershell:
script: |
"Set-WebConfigurationProperty -filter /system.webServer/directoryBrowse -name enabled -value true -PSPath 'IIS:\Sites\Default Web Site\reports'"
"Set-WebConfigurationProperty -filter /system.webServer/directoryBrowse -name enabled -value true -PSPath 'IIS:\Sites\Default Web Site\reports'"

View File

@@ -0,0 +1,34 @@
---
- include_vars: "{{ ansible_system }}.yml"
- name: get reports
ansible.builtin.find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
check_mode: no
- name: publish landing page
ansible.builtin.template:
src: linux_report.j2
dest: "{{ doc_root }}/index.html"
check_mode: no
- name: copy CSS over
ansible.builtin.copy:
src: "css"
dest: "{{ doc_root }}"
directory_mode: true
check_mode: no
- name: copy logos over
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ doc_root }}"
directory_mode: true
loop:
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "report.png"
check_mode: no

View File

@@ -0,0 +1,6 @@
---
- include_tasks: apache.yml
when: ansible_system == 'Linux'
- include_tasks: iis.yml
when: ansible_system == 'Win32NT'

View File

@@ -0,0 +1,34 @@
---
- include_vars: "{{ ansible_system }}.yml"
- name: get reports
ansible.windows.win_find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
check_mode: no
- name: publish landing page
ansible.builtin.win_template:
src: windows_report.j2
dest: "{{ doc_root }}/index.html"
check_mode: no
- name: copy CSS over
ansible.builtin.win_copy:
src: "css"
dest: "{{ doc_root }}"
directory_mode: true
check_mode: no
- name: copy logos over
ansible.builtin.win_copy:
src: "{{ item }}"
dest: "{{ doc_root }}"
directory_mode: true
loop:
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "report.png"
check_mode: no

View File

@@ -0,0 +1,15 @@
<div class="wrapper">
<header>
<div class="header-container">
<a href="https://ansible.com">
<img
class="header-logo"
src="redhat-ansible-logo.svg"
title="Red Hat Ansible"
alt="Red Hat Ansible"
/>
</a>
</div>
</header>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title> Ansible Linux Automation Report </title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/new.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
</head>
<body>
<div class="wrapper">
{% include 'header.j2' %}
<section>
<center>
<h1>Ansible Automation Reports</h1>
<h3><input type="search" placeholder="Search..." class="form-control search-input" data-table="main_net_table"/>
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% set page = report.path.split('/')[-1] %}
<tr>
<td class="summary_info">
<div id="hostname">
<p class="hostname"> <img class="router_image" src="report.png"></p>
</div>
</td>
<td>
<a href="{{ reports_dir }}/{{ page }}"> {{ page }} <a>
</td>
{% endfor %}
</tbody>
</table>
<center><p>Created with</p><br><img src="webpage_logo.png" width="300">
</center>
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title> Ansible Linux Automation Report </title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/new.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
</head>
<body>
<div class="wrapper">
{% include 'header.j2' %}
<section>
<center>
<h1>Ansible Automation Reports</h1>
<h3><input type="search" placeholder="Search..." class="form-control search-input" data-table="main_net_table"/>
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% set page = report.path.split('\\')[-1] %}
<tr>
<td class="summary_info">
<div id="hostname">
<p class="hostname"> <img class="router_image" src="report.png"></p>
</div>
</td>
<td>
<a href="{{ reports_dir }}/{{ page }}"> {{ page }} <a>
</td>
{% endfor %}
</tbody>
</table>
<center><p>Created with</p><br><img src="webpage_logo.png" width="300">
</center>
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,3 @@
---
doc_root: /var/www/html
reports_dir: reports

View File

@@ -0,0 +1,3 @@
---
doc_root: C:\Inetpub\wwwroot
reports_dir: reports

View File

@@ -25,4 +25,4 @@
#- name: display link to inventory report
# ansible.builtin.debug:
# msg: "Please go to http://{{ host_vars[report_server]['ansible_host'] }}/reports/windows.html"
# msg: "Please go to http://{{ host_vars[report_server]['ansible_host'] }}/reports/windows.html"

View File

@@ -0,0 +1,202 @@
p.hostname {
color: #000000;
font-weight: bolder;
font-size: large;
margin: auto;
width: 50%;
}
#subtable {
background: #ebebeb;
margin: 0px;
width: 100%;
}
#subtable tbody tr td {
padding: 5px 5px 5px 5px;
}
#subtable thead th {
padding: 5px;
}
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-family: "Open Sans", "Helvetica";
}
a {
color: #000000;
}
p {
color: #ffffff;
}
h1 {
text-align: center;
color: #ffffff;
}
body {
background:#353a40;
padding: 0px;
margin: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
table {
border-collapse: separate;
background:#fff;
@include border-radius(5px);
@include box-shadow(0px 0px 5px rgba(0,0,0,0.3));
}
.main_net_table {
margin:50px auto;
}
thead {
@include border-radius(5px);
}
thead th {
font-size:16px;
font-weight:400;
color:#fff;
@include text-shadow(1px 1px 0px rgba(0,0,0,0.5));
text-align:left;
padding:20px;
border-top:1px solid #858d99;
background: #353a40;
&:first-child {
@include border-top-left-radius(5px);
}
&:last-child {
@include border-top-right-radius(5px);
}
}
tbody tr td {
font-weight:400;
color:#5f6062;
font-size:13px;
padding:20px 20px 20px 20px;
border-bottom:1px solid #e0e0e0;
}
tbody tr:nth-child(2n) {
background:#f0f3f5;
}
tbody tr:last-child td {
border-bottom:none;
&:first-child {
@include border-bottom-left-radius(5px);
}
&:last-child {
@include border-bottom-right-radius(5px);
}
}
td {
vertical-align: top;
}
span.highlight {
background-color: yellow;
}
.expandclass {
color: #5f6062;
}
.content{
display:none;
margin: 10px;
}
header {
width: 100%;
position: initial;
float: initial;
padding: 0;
margin: 0;
border-radius: 0;
height: 88px;
background-color: #171717;
}
.header-container {
margin: 0 auto;
width: 100%;
height: 100%;
max-width: 1170px;
padding: 0;
float: initial;
display: flex;
align-items: center;
}
.header-logo {
width: 137px;
border: 0;
margin: 0;
margin-left: 15px;
}
.header-link {
margin-left: 40px;
text-decoration: none;
cursor: pointer;
text-transform: uppercase;
font-size: 15px;
font-family: 'Red Hat Text';
font-weight: 500;
}
.header-link:hover {
text-shadow: 0 0 0.02px white;
text-decoration: none;
}
table.net_info td {
padding: 5px;
}
p.expandclass:hover {
text-decoration: underline;
color: #EE0000;
cursor: pointer;
}
.summary_info {
}
.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 {
border: 1px solid #5F0000;
background: #EE0000;
}
div#net_content {
padding: 0px;
height: auto !important;
}
img.router_image {
vertical-align: middle;
padding: 0px 10px 10px 10px;
width: 50px;
}
table.net_info {
width: 100%;
}
p.internal_label {
color: #000000;
}

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="930.2px" height="350px" viewBox="0 0 930.2 350" style="enable-background:new 0 0 930.2 350;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#EE0000;}
</style>
<title>Logo-Red_Hat-Ansible_Automation_Platform-A-Reverse-RGB</title>
<path class="st0" d="M383.3,228.5h18.8L446,335.7h-17.5l-12.4-31.4h-48l-12.6,31.4h-16.7L383.3,228.5z M410.9,291l-18.7-47l-18.7,47
H410.9z"/>
<path class="st0" d="M455.2,257.7h15.3v7.8c6.2-6.2,14.7-9.6,23.5-9.3c17.9,0,30.5,12.4,30.5,30.5v49h-15.3v-46.5
c0-12.3-7.5-19.8-19.3-19.8c-7.8-0.3-15.1,3.6-19.3,10.1v56.1h-15.3V257.7z"/>
<path class="st0" d="M543,315.5c8.1,6.4,16.7,9.8,25.4,9.8c11,0,18.7-4.8,18.7-11.7c0-5.5-4-8.7-12.6-10l-14.1-2
c-15.5-2.3-23.3-9.5-23.3-21.6c0-14.1,12.3-23.6,30.5-23.6c11.3-0.1,22.3,3.4,31.5,9.9l-7.8,10.1c-8.6-5.7-16.4-8.1-24.7-8.1
c-9.3,0-15.6,4.3-15.6,10.6c0,5.7,3.7,8.4,12.9,9.8l14.1,2c15.5,2.3,23.6,9.7,23.6,21.7c0,14-14.1,24.5-32.6,24.5
c-13.5,0-25.6-4-34.2-11.5L543,315.5z"/>
<path class="st0" d="M611.6,235.6c0-5.2,4.1-9.4,9.3-9.5c0,0,0,0,0,0c5.2-0.2,9.7,3.9,9.9,9.1c0.2,5.2-3.9,9.7-9.1,9.9
c-0.2,0-0.5,0-0.7,0C615.8,245.1,611.6,240.9,611.6,235.6C611.6,235.7,611.6,235.7,611.6,235.6z M628.6,335.7h-15.3v-78h15.3V335.7z
"/>
<path class="st0" d="M685.5,336.9c-8.5,0-16.8-2.7-23.6-7.8v6.6h-15.2V228.5l15.3-3.4v40c6.6-5.6,15.1-8.7,23.7-8.6
c22.1,0,39.4,17.7,39.4,40.1C725.2,319.1,707.9,336.9,685.5,336.9z M662,279.2v35.2c4.9,5.7,13,9.2,21.8,9.2
c15,0,26.4-11.5,26.4-26.8c0-15.3-11.5-27-26.4-27C674.9,269.8,667.1,273.2,662,279.2z"/>
<path class="st0" d="M755,335.7h-15.3V228.5l15.3-3.4V335.7z"/>
<path class="st0" d="M810.5,337.1c-23,0-40.9-17.7-40.9-40.4c0-22.5,17.2-40.1,39.1-40.1c21.5,0,37.7,17.8,37.7,40.8v4.4h-61.6
c2,13,13.2,22.5,26.4,22.4c7.2,0.2,14.2-2.3,19.8-6.8l9.8,9.7C832.1,333.7,821.5,337.4,810.5,337.1z M784.9,290.2h46.3
c-2.3-11.9-11.5-20.8-22.8-20.8C796.5,269.4,787.2,277.8,784.9,290.2z"/>
<path class="st1" d="M202.8,137.5c18.4,0,45.1-3.8,45.1-25.7c0.1-1.7-0.1-3.4-0.5-5l-11-47.7c-2.5-10.5-4.8-15.2-23.2-24.5
c-14.3-7.3-45.5-19.4-54.7-19.4c-8.6,0-11.1,11.1-21.3,11.1c-9.8,0-17.1-8.3-26.4-8.3c-8.8,0-14.6,6-19,18.4c0,0-12.4,34.9-14,40
c-0.3,0.9-0.4,1.9-0.4,2.9C77.6,92.9,131.1,137.5,202.8,137.5 M250.8,120.7c2.5,12.1,2.5,13.3,2.5,14.9c0,20.6-23.2,32.1-53.7,32.1
c-69,0-129.3-40.3-129.3-67c0-3.7,0.8-7.4,2.2-10.8c-24.8,1.3-56.9,5.7-56.9,34c0,46.4,109.9,103.5,196.9,103.5
c66.7,0,83.5-30.2,83.5-54C296.1,154.6,279.9,133.4,250.8,120.7"/>
<path d="M250.7,120.7c2.5,12.1,2.5,13.3,2.5,14.9c0,20.6-23.2,32.1-53.7,32.1c-69,0-129.3-40.3-129.3-67c0-3.7,0.8-7.4,2.2-10.8
l5.4-13.3c-0.3,0.9-0.4,1.9-0.4,2.8c0,13.6,53.5,58.1,125.2,58.1c18.4,0,45.1-3.8,45.1-25.7c0.1-1.7-0.1-3.4-0.5-5L250.7,120.7z"/>
<path class="st0" d="M869.1,151.2c0,17.5,10.5,26,29.7,26c5.9-0.1,11.8-1,17.5-2.5v-20.3c-3.7,1.2-7.5,1.7-11.3,1.7
c-7.9,0-10.8-2.5-10.8-9.9v-31.1h22.9V94.2h-22.9V67.7l-25,5.4v21.1h-16.6v20.9h16.6L869.1,151.2z M791,151.7
c0-5.4,5.4-8.1,13.6-8.1c5,0,10,0.7,14.9,1.9V156c-4.8,2.6-10.2,3.9-15.6,3.9C795.9,159.9,791.1,156.8,791,151.7 M798.7,177.5
c8.8,0,16-1.9,22.6-6.3v5h24.8v-52.5c0-20-13.5-30.9-35.9-30.9c-12.6,0-25,2.9-38.3,9l9,18.4c9.6-4,17.7-6.5,24.8-6.5
c10.3,0,15.6,4,15.6,12.2v4c-6.1-1.6-12.3-2.4-18.6-2.3c-21.1,0-33.8,8.8-33.8,24.6C768.9,166.6,780.4,177.6,798.7,177.5
M662.5,176.2h26.7v-42.5h44.6v42.5h26.7V67.7h-26.6v41.7h-44.6V67.7h-26.7L662.5,176.2z M561,135.1c0-11.8,9.3-20.8,21.5-20.8
c6.4-0.1,12.6,2.1,17.4,6.4v28.6c-4.7,4.4-10.9,6.7-17.4,6.5C570.5,155.8,561,146.8,561,135.1 M600.2,176.1H625V62.3l-25,5.4v30.8
c-6.4-3.6-13.6-5.5-20.9-5.4c-23.9,0-42.6,18.4-42.6,42c-0.3,23,18.1,41.9,41.1,42.2c0.2,0,0.5,0,0.7,0c7.9,0,15.6-2.5,22-7.1V176.1
z M486.5,113.2c7.9,0,14.6,5.1,17.2,13h-34.2C471.9,118,478.2,113.2,486.5,113.2 M444.2,135.2c0,23.9,19.5,42.5,44.6,42.5
c13.8,0,23.9-3.7,34.3-12.4l-16.6-14.7c-3.9,4-9.6,6.2-16.4,6.2c-8.8,0.2-16.8-4.9-20.2-13h58.4v-6.2c0-26-17.5-44.8-41.4-44.8
c-23.2-0.4-42.4,18.2-42.7,41.5C444.2,134.6,444.2,134.9,444.2,135.2 M400.9,90.5c8.8,0,13.8,5.6,13.8,12.2s-5,12.2-13.8,12.2h-26.3
V90.5H400.9z M347.9,176.2h26.7v-39.5h20.3l20.5,39.5h29.7l-23.9-43.4c12.4-5,20.5-17.1,20.4-30.5c0-19.5-15.3-34.5-38.3-34.5H348
L347.9,176.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,34 @@
---
- include_vars: "{{ ansible_system }}.yml"
- name: get reports
ansible.builtin.find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
check_mode: no
- name: publish landing page
ansible.builtin.template:
src: linux_report.j2
dest: "{{ doc_root }}/index.html"
check_mode: no
- name: copy CSS over
ansible.builtin.copy:
src: "css"
dest: "{{ doc_root }}"
directory_mode: true
check_mode: no
- name: copy logos over
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ doc_root }}"
directory_mode: true
loop:
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "report.png"
check_mode: no

View File

@@ -0,0 +1,6 @@
---
- include_tasks: apache.yml
when: ansible_system == 'Linux'
- include_tasks: iis.yml
when: ansible_system == 'Win32NT'

View File

@@ -0,0 +1,34 @@
---
- include_vars: "{{ ansible_system }}.yml"
- name: get reports
ansible.windows.win_find:
paths: "{{ doc_root }}/{{ reports_dir }}"
patterns: '*.html'
register: reports
check_mode: no
- name: publish landing page
ansible.builtin.win_template:
src: windows_report.j2
dest: "{{ doc_root }}/index.html"
check_mode: no
- name: copy CSS over
ansible.builtin.win_copy:
src: "css"
dest: "{{ doc_root }}"
directory_mode: true
check_mode: no
- name: copy logos over
ansible.builtin.win_copy:
src: "{{ item }}"
dest: "{{ doc_root }}"
directory_mode: true
loop:
- "webpage_logo.png"
- "redhat-ansible-logo.svg"
- "report.png"
check_mode: no

View File

@@ -0,0 +1,15 @@
<div class="wrapper">
<header>
<div class="header-container">
<a href="https://ansible.com">
<img
class="header-logo"
src="redhat-ansible-logo.svg"
title="Red Hat Ansible"
alt="Red Hat Ansible"
/>
</a>
</div>
</header>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title> Ansible Linux Automation Report </title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/new.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
</head>
<body>
<div class="wrapper">
{% include 'header.j2' %}
<section>
<center>
<h1>Ansible Automation Reports</h1>
<h3><input type="search" placeholder="Search..." class="form-control search-input" data-table="main_net_table"/>
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% set page = report.path.split('/')[-1] %}
<tr>
<td class="summary_info">
<div id="hostname">
<p class="hostname"> <img class="router_image" src="report.png"></p>
</div>
</td>
<td>
<a href="{{ reports_dir }}/{{ page }}"> {{ page }} <a>
</td>
{% endfor %}
</tbody>
</table>
<center><p>Created with</p><br><img src="webpage_logo.png" width="300">
</center>
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title> Ansible Linux Automation Report </title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/new.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
</head>
<body>
<div class="wrapper">
{% include 'header.j2' %}
<section>
<center>
<h1>Ansible Automation Reports</h1>
<h3><input type="search" placeholder="Search..." class="form-control search-input" data-table="main_net_table"/>
</center>
<table class="table table-striped mt32 main_net_table">
<tbody>
{% for report in reports.files %}
{% set page = report.path.split('\\')[-1] %}
<tr>
<td class="summary_info">
<div id="hostname">
<p class="hostname"> <img class="router_image" src="report.png"></p>
</div>
</td>
<td>
<a href="{{ reports_dir }}/{{ page }}"> {{ page }} <a>
</td>
{% endfor %}
</tbody>
</table>
<center><p>Created with</p><br><img src="webpage_logo.png" width="300">
</center>
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,3 @@
---
doc_root: C:\Inetpub\wwwroot
reports_dir: reports

View File

@@ -0,0 +1,4 @@
---
instance_name: "{{ inventory_hostname | regex_replace('_','-') }}"
activation_key: "{{ 'RHEL' + ansible_distribution_major_version + '_' + env }}"
rex_user: root # "{{ ansible_user }}"

View File

@@ -0,0 +1,67 @@
---
- name: verify operating system
assert:
that:
- ansible_os_family == 'RedHat'
- (ansible_distribution_major_version == '7') or (ansible_distribution_major_version == '8')
- name: set hostname
hostname:
name: "{{ instance_name }}"
- name: remove rhui client packages
yum:
name:
- google-rhui-client*
- rh-amazon-rhui-client*
state: removed
- name: get current repos
command:
cmd: ls /etc/yum.repos.d/
register: repos
changed_when: False
- name: remove existing rhui repos
file:
path: "/etc/yum.repos.d/{{ item }}"
state: absent
loop: "{{ repos.stdout_lines }}"
- name: install satellite certificate
yum:
name: "{{ satellite_url }}/pub/katello-ca-consumer-latest.noarch.rpm"
state: present
validate_certs: no
disable_gpg_check: true
- name: register system via subscription-mangler
redhat_subscription:
state: present
activationkey: "{{ activation_key }}"
consumer_name: "{{ instance_name }}"
org_id: "{{ org_id | default('Default_Organization')}}"
throttle: 1
- name: include repos
include_vars: "vars/{{ ansible_distribution + ansible_distribution_major_version }}.yml"
- name: enable repos
rhsm_repository:
name: "{{ rhsm_enabled_repos }}"
state: enabled
- name: install satellite client
yum:
name:
- katello-host-tools
- katello-host-tools-tracer
state: latest
- name: enable remote execution
authorized_key:
user: "{{ rex_user }}"
state: present
key: "{{ satellite_url }}:9090/ssh/pubkey"
validate_certs: no

View File

@@ -0,0 +1,4 @@
---
rhsm_enabled_repos:
- rhel-7-server-rpms
#- rhel-7-server-satellite-maintenance-6.11-rpms

View File

@@ -0,0 +1,5 @@
---
rhsm_enabled_repos:
- rhel-8-for-x86_64-baseos-rpms
- rhel-8-for-x86_64-appstream-rpms
- satellite-client-6-for-rhel-8-x86_64-rpms

View File

@@ -0,0 +1,17 @@
# Change Log
All notable changes to this project will be documented in this file.
## [0.0.1] - 20/03/2018 - First Release
### Added
- Install required packages
- Obtain data from satellite API
- Configure crontab and config.yaml
### Changed
### Removed
### Pending
- Allow a list of policies to be applied (only one is allowed at the moment)
- Get schedule from the policy instead of configure it using parameters
- Configure URI tasks to ask capsule instead of Satellite (for hosts without network access to the satellite api)
- Add tests to vars to be correctly formatted

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 morenod
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,45 @@
# Openscap client configuration Role
## About
Role created to configure a client to execute openscap policies based on the information obtained from a Red Hat Satellite/Foreman Host.
Steps and configuration changes obtained from the [foreman_scap_client puppet module](https://github.com/theforeman/puppet-foreman_scap_client)
The role has to be executed with root permission, using the root user or via sudo because it will modify system parameters.
## Ansible Requirements
RPM Repositories have to be enabled and containing required packages.
## Configuration parameters
### Required vars to be overwritten
- `satellite_server`: Used to obtain policy parameters
- `satellite_username`: Used to obtain policy parameters
- `satellite_password`: Used to obtain policy parameters
- `capsule_server`: Used to configure openscap client config.yaml file
- `capsule_port`: Used to configure openscap client config.yaml file
- `policy_name`: Name of the SCAP Policy to be configured
## Example playbook
```yml
---
- name: openscap client
hosts: <<host list>>
remote_user: <<user>>
gather_facts: true
become: yes
become_user: root
become_method: sudo
vars:
satellite_server: satellite.example.com
satellite_username`: admin
satellite_password`: verycomplexpassword
capsule_server`: capsule.example.com
policy_name`: 'rhel7-pci'
roles:
- ansible-ipaRegister
```

View File

@@ -0,0 +1,12 @@
foreman_server_url: "{{ lookup('env', 'SATELLITE_SERVER') }}"
foreman_username: "{{ lookup('env', 'SATELLITE_USERNAME') }}"
foreman_password: "{{ lookup('env', 'SATELLITE_PASSWORD') }}"
foreman_validate_certs: "{{ lookup('env', 'FOREMAN_VALIDATE_CERTS') | default(true) }}"
capsule_server: "{{ foreman_server_url }}"
capsule_port: '9090'
policy_name: 'all'
policy_scan: "{{ policy_name }}"
crontab_hour: 2
crontab_minute: 0
crontab_weekdays: 0
foreman_operations_scap_client_secure_logging: true

View File

@@ -0,0 +1,3 @@
galaxy_info:
author: morenod
description: Role created to configure a client to execute openscap policies based on the information obtained from a Red Hat Satellite/Foreman Host.

View File

@@ -0,0 +1,85 @@
---
- name: Install openscap client packages
yum:
name:
- openscap-scanner
- rubygem-foreman_scap_client
state: present
- name: Get Policy parameters
uri:
url: "{{ foreman_server_url }}/api/v2/compliance/policies"
method: GET
user: "{{ foreman_username }}"
password: "{{ foreman_password }}"
force_basic_auth: yes
body_format: json
validate_certs: False
register: policies
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
- name: Build policy {{ policy_name }} parameters
set_fact:
policy: "{{ policy | default([]) }} + {{ [item] }}"
loop: "{{policies.json.results}}"
when: item.name in policy_name or policy_name == 'all'
- name: Fail if no policy found with required name
fail:
when: policy is not defined
- name: Get scap content information
uri:
url: "{{ foreman_server_url }}/api/v2/compliance/scap_contents/{{item.scap_content_id}}"
method: GET
user: "{{ foreman_username }}"
password: "{{ foreman_password }}"
force_basic_auth: yes
body_format: json
validate_certs: False
register: scapcontents
loop: "{{ policy }}"
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
- name: Get tailoring content information
uri:
url: "{{ foreman_server_url }}/api/v2/compliance/tailoring_files/{{item.tailoring_file_id}}"
method: GET
user: "{{ foreman_username }}"
password: "{{ foreman_password }}"
force_basic_auth: yes
body_format: json
validate_certs: False
register: tailoringfiles
when: item.tailoring_file_id | int > 0 | d(False)
loop: "{{ policy }}"
no_log: "{{ foreman_operations_scap_client_secure_logging }}"
- name: Build scap content parameters
set_fact:
scap_content: "{{ scap_content | default({}) | combine({item.json.id: item.json }) }}"
loop: "{{ scapcontents.results }}"
- name: Build tailoring content parameters
set_fact:
tailoring_files: "{{ tailoring_files | default({}) | combine({item.json.id: item.json }) }}"
when: item.json is defined
loop: "{{ tailoringfiles.results }}"
- name: Apply openscap client configuration template
template:
src: openscap_client_config.yaml.j2
dest: /etc/foreman_scap_client/config.yaml
mode: 0644
owner: root
group: root
#- name: Configure execution crontab
# cron:
# name: "Openscap Execution"
# cron_file: 'foreman_openscap_client'
# job: '/usr/bin/foreman_scap_client {{policy.id}} > /dev/null'
# weekday: "{{crontab_weekdays}}"
# hour: "{{crontab_hour}}"
# minute: "{{crontab_minute}}"
# user: root

View File

@@ -0,0 +1,47 @@
# Foreman proxy to which reports should be uploaded
:server: {{ capsule_server | urlsplit('hostname') }}
:port: {{ capsule_port }}
## SSL specific options ##
# Client CA file.
# It could be Puppet CA certificate (e.g., '/var/lib/puppet/ssl/certs/ca.pem')
# Or (recommended for client reporting to Katello) subscription manager CA file, (e.g., '/etc/rhsm/ca/katello-server-ca.pem')
:ca_file: '/etc/rhsm/ca/katello-server-ca.pem'
# Client host certificate.
# It could be Puppet agent host certificate (e.g., '/var/lib/puppet/ssl/certs/myhost.example.com.pem')
# Or (recommended for client reporting to Katello) consumer certificate (e.g., '/etc/pki/consumer/cert.pem')
:host_certificate: '/etc/pki/consumer/cert.pem'
#
# Client private key
# It could be Puppet agent private key (e.g., '/var/lib/puppet/ssl/private_keys/myhost.example.com.pem')
# Or (recommended for client reporting to Katello) consumer private key (e.g., '/etc/pki/consumer/key.pem')
:host_private_key: '/etc/pki/consumer/key.pem'
# policy (key is id as in Foreman)
{% for item in policy %}
{{ item.id }}:
{% if item.tailoring_file_id | int > 0 | d(False) %}
{% for profile in tailoring_files[item.tailoring_file_id].tailoring_file_profiles %}
{% if profile.id == item.tailoring_file_profile_id %}
:profile: {{profile.profile_id}}
{% endif%}
{% endfor %}
:content_path: '/var/lib/openscap/content/{{scap_content[item.scap_content_id].digest}}.xml'
# Download path
# A path to download SCAP content from proxy
:download_path: '/compliance/policies/{{item.id}}/content/{{scap_content[item.scap_content_id].digest}}'
:tailoring_path: '/var/lib/openscap/content/{{tailoring_files[item.tailoring_file_id].digest}}.xml'
:tailoring_download_path: '/compliance/policies/{{item.id}}/tailoring/{{tailoring_files[item.tailoring_file_id].digest}}'
{% else %}
{% for profile in scap_content[item.scap_content_id].scap_content_profiles %}
{% if profile.id == item.scap_content_profile_id %}
:profile: {{profile.profile_id}}
{% endif%}
{% endfor %}
:content_path: '/var/lib/openscap/content/{{scap_content[item.scap_content_id].digest}}.xml'
# Download path
# A path to download SCAP content from proxy
:download_path: '/compliance/policies/{{item.id}}/content/{{scap_content[item.scap_content_id].digest}}'
:tailoring_path: ''
:tailoring_download_path: ''
{% endif %}
{% endfor %}

View File

@@ -1,23 +1,35 @@
---
collections:
- name: ansible.controller
version: 4.1.1
version: 4.3.0
- name: redhat_cop.controller_configuration
version: 2.1.1
version: 2.2.5
#linux
- name: redhat.insights
version: 1.0.7
- name: redhat.rhel_system_roles
version: 1.16.2
- community.general
- containers.podman
version: 1.20.0
- name: community.general
version: 6.3.0
- name: containers.podman
#windows
- chocolatey.chocolatey
- community.windows
- name: chocolatey.chocolatey
- name: community.windows
version: 1.12.0
- name: ansible.windows
version: 1.9.0
version: 1.13.0
#cloud
- name: azure.azcollection
version: 1.13.0
version: 1.14.0
- name: amazon.aws
version: 3.1.1
version: 5.2.0
#satellite
- name: redhat.satellite
version: 3.8.0
#network
- name: cisco.ios
version: 3.1.0
- name: cisco.nxos
version: 3.0.0
- name: cisco.iosxr
version: 3.0.0

13
feedback.yml Normal file
View File

@@ -0,0 +1,13 @@
---
- hosts: localhost
gather_facts: no
tasks:
- name: Submit Feedback
ansible.builtin.uri:
url: https://docs.google.com/forms/d/e/1FAIpQLSfTq7Dm0hw0sOthHTH2F6wbwwJc-fsJPbn72IZX4CY7p4uGBg/formResponse
method: POST
body: "ifq&entry.1139138403={{ email }} &entry.735882959={{ feedback }}&sumbit=Submit"
- name: Thank you
debug:
msg: Thank you for your feedback!

91
linux/README.md Normal file
View File

@@ -0,0 +1,91 @@
# Linux Demos
## Table of Contents
- [Linux Demos](#linux-demos)
- [Table of Contents](#table-of-contents)
- [About These Demos](#about-these-demos)
- [Jobs](#jobs)
- [Inventory](#inventory)
- [Post Setup Job Steps](#post-setup-job-steps)
- [Add Red Hat account details](#add-red-hat-account-details)
- [Update Credentials for Insights Inventory](#update-credentials-for-insights-inventory)
- [Add Variables for System Roles](#add-variables-for-system-roles)
- [Suggested Usage](#suggested-usage)
## About These Demos
This category of demos shows examples of linux operations and management with Ansible Automation Platform. The list of demos can be found below. See the [Suggested Usage](#suggested-usage) section of this document for recommendations on how to best use these demos.
### Jobs
- [**Linux / Register**](ec2_register.yml) - Register a RHEL server with Red Hat Portal and Insights
- [**Linux / Troubleshoot**](tshoot.yml) - Run troubleshooting commands to find top CPU and memory users on the system
- [**Linux / Temporary Sudo**](temp_sudo.yml) - Grant temporary sudo access to a user on the system with time based cleanup
- [**Linux / Patching**](patching.yml) - Apply updates and/or generate patch report for linux systems
- [**Linux / Start Service**](service_start.yml) - Start a service on a system
- [**Linux / Stop Service**](service_stop.yml) - Stop a service on a system
- [**Linux / Run Shell Script**](run_script.yml) - Run a shell script or command on a system
- [**Linux / Fact Scan**](https://github.com/ansible/awx-facts-playbooks/blob/master/scan_facts.yml) - Run a fact, package, and service scan against a system and store in fact cache
- [**Linux / Podman Webserver**](podman.yml) - Install and run a Podman webserver with given text on the home page
- [**Linux / System Roles**](system_roles.yml) - Apply Linux system roles to servers. Must provide variables and role names.
- [**Linux / Compliance Enforce**](compliance.yml) - Apply remediation to meet the requirements of a compliance baseline
- [**Linux / Insights Compliance Scan**](insights_compliance_scan.yml) - Run a Compliance scan based on the configuration in [Red Hat Insights][https://console.redhat.com]
### Inventory
A dymanic inventory is created to pull inventory hosts from Red Hat Insights. The Systems will be added by their host name therefore adding duplicate systems will cause conflicts in the inventory. Only systems with the tag `purpose=demo` in Red Hat Insights will be added to this inventory. Groups will be created for other tags given to the system.
Groups will also be created for systems with missing security, enhancement and bug updates. The inventory configuration is governed by the [inventory.insights.yml](inventory.insights.yml) file.
> Remember to delete systems from your Red Hat account when you are done with the demo to avoid conflicts with future demos using the same names.
## Post Setup Job Steps
After running the setup job template, there are a few steps required to make the demos fully functional. See the post setup steps below.
> These steps may differ in your environment
### Add Red Hat account details
To register systems to the Red Hat portal and Insights, edit `extra_vars` on the `Linux / Register` job to include your org_id and an [activation key](https://access.redhat.com/management/activation_keys) to use when registering the systems.
### Update Credentials for Insights Inventory
Navigate to the Credentials section and update the `Insights Inventory` credential with your Red Hat Portal login.
### Add Variables for System Roles
Edit the `Linux / System Roles` job to include the list of roles that you wish to apply and the variables applicable for each role. See documentation [here](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles) for configuring System Roles.
## Suggested Usage
**Linux / Register** - Use this job to register systems to Red Hat Insights for showing Advisor recommendations and dynamic inventory. Note that the "Ansible Group" will create an AAP inventory group, as well as tag hosts with that group name in Insights.
**Linux / Troubleshoot** - Use this job to show incident response troubleshooting and basic running of commands with an Ansible Playbook.
**Linux / Temporary Sudo** - Use this job to show how to grant sudo access with automated cleanup to a server. The user must exist on the system. Using the student user is a good example (ie. student1)
**Linux / Patching** - Use this job to apply updates or audit for missing updates and produce an html report of systems with missing updates. See the end of the job for the URL to view the report. In other environments this report could be uploaded to a wiki, email, other system. This demo also shows installing a webserver on a linux server. The report is places on the system defined by the `report_server` variable. By default, `report_server` is configured as `node1`. This may be overridden with `extra_vars` on the Job Template.
**Linux / Run Shell Script** - Use this job to demonstrate running shell commands or an existing shell script across a group of systems as root. This can be preferred over using Ad-Hoc commands due to the ability to control usage with RBAC. This is helpful in showing the scalable of execution of an existing shell script. It is always recommended to convert shell scripts to playbooks over time. Example usage would be getting the public key used in the environment with the command `cat .ssh/authorized_keys`.
**Linux / Fact Scan** - Use this job to demonstrate the use of the Ansible Fact Cache, Ansible facts, and the ability to query installed packages and running services on a system.
**Linux / Podman Webserver** - Use this job show managing individual containers with Podman via an Ansible Playbook.
**Linux / System Roles** - This job demonstrates running [RHEL System Roles with AAP. See the documentation [here](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles) for how to configure system roles with variables by editing the extra_vars on the job template.
Example 1:
```
system_roles:
- selinux
selinux_state: enforcing
```
Example 2 (less invasive, and runs faster):
```
system_roles:
- timesync
timesync_ntp_servers:
- hostname: pool.ntp.org
pool: yes
iburst: yes
```
**Linux / Compliance** - Apply compliance profile hardening configuration from [here](https://galaxy.ansible.com/RedHatOfficial). BE AWARE: this could have unintended results based on the current state of your machine. Always test on a single machine before distributing at scale. For example, AWS instances have NOPASSWD allowed for sudo. Running STIG compliance without adding `sudo_remove_nopasswd: false` to extra_vars on the job template will lock you out of the machine. This variable is configured on the job template by default for this reason.
**Linux / Insights Compliance Scan** - Scan the system according to the compliance profile configured via [Red Hat Insights](https://console.redhat.com). NOTE: This job will fail if the systems haven't been registered with Insights and associated with a relevant compliance profile. A survey when running the job will ask if you have configured all systems with a compliance profile, and effectively skip all tasks in the job template if the answer is "No".

14
linux/compliance.yml Normal file
View File

@@ -0,0 +1,14 @@
---
- hosts: "{{ HOSTS }}"
become: true
vars:
compliance_profile: undef
tasks:
- name: Check OS Type
assert:
that: "ansible_os_family == 'RedHat'"
- name: Run Compliance Profile
include_role:
name: "redhatofficial.rhel{{ ansible_distribution_major_version }}_{{ compliance_profile }}"

View File

@@ -3,10 +3,26 @@
become: yes
tasks:
- name: check for vars
assert:
that:
- org_id is defined
- activation_key is defined
- org_id != ''
- activation_key != ''
- org_id != 'undef'
- activation_key != 'undef'
- name: set hostname
hostname:
name: "{{ inventory_hostname | regex_replace('_','-')}}"
# Install subscription-manager if it's not there
- name: Install subscription-manager
ansible.builtin.yum:
name: subscription-manager
state: present
- name: remove rhui client packages
yum:
name: rh-amazon-rhui-client*
@@ -30,6 +46,7 @@
name: "https://{{ sat_url }}/pub/katello-ca-consumer-latest.noarch.rpm"
state: present
validate_certs: no
disable_gpg_check: true
when: sat_url is defined
- name: manage repos with subscription mangler
@@ -44,12 +61,6 @@
activationkey: "{{ activation_key }}"
org_id: "{{ org_id }}"
- name: disable htb repo
community.general.rhsm_repository:
name: rhel-7-server-htb*
state: disabled
ignore_errors: yes
- name: configure Red Hat insights
import_role:
name: redhat.insights.insights_client
@@ -58,4 +69,4 @@
insights_tags:
env: "{{ env }}"
purpose: demo
group: "{{ ansible_group }}"
group: "{{ insights_tag }}"

12
linux/fact_scan.yml Normal file
View File

@@ -0,0 +1,12 @@
---
- hosts: "{{ HOSTS }}"
become: yes
tasks:
- name: get packages
ansible.builtin.package_facts:
- name: get services
ansible.builtin.service_facts:

View File

@@ -0,0 +1,24 @@
---
- hosts: "{{ HOSTS }}"
become: true
vars:
#compliance_profile: undef
tasks:
- name: Check OS Type
assert:
that: "ansible_os_family == 'RedHat'"
- name: Check variable values
debug:
msg: "Value of compliance_profile_configured is {{ compliance_profile_configured }}"
- name: Run Insights Compliance scan
import_role:
name: redhat.insights.compliance
when: compliance_profile_configured == "Yes"
- name: Notify user that Compliance scan is not being attempted
debug:
msg: "User has not confirmed that all hosts are associated with an Insights Compliance profile. Scan aborted."
when: compliance_profile_configured == "No"

View File

@@ -5,34 +5,39 @@
report_server: node1
tasks:
# Install yum-utils if it's not there
- name: Install yum-utils
ansible.builtin.yum:
name: yum-utils
state: latest
- include_role:
name: demo.patching.patch_linux
- name: Tell user when Insights Client is not configured
debug:
msg: "Insights client does not appear to be configured. Scan will be skipped"
when:
- ansible_local.insights.system_id is not defined
- name: Run the Insights Client Scan
command: insights-client
when:
- not ansible_check_mode
- ansible_local.insights.system_id is defined
- block:
- yum:
name: httpd
state: latest
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
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.report_linux
- demo.patching.report_linux_patching
- include_role:
name: demo.patching.report_linux_patching
name: demo.patching.report_server
tasks_from: linux_landing_page
delegate_to: "{{ report_server }}"
run_once: yes
run_once: yes

View File

@@ -1,6 +1,7 @@
---
- name: Podman
hosts: "{{ HOSTS }}"
vars:
volume_path: podman
message: undef
@@ -28,7 +29,7 @@
image: docker.io/httpd
state: started
volume:
- "{{ volume_path }}:/usr/local/apache2/htdocs"
- "./{{ volume_path }}/:/usr/local/apache2/htdocs:z"
ports:
- "8080:80"
@@ -47,5 +48,7 @@
- name: Output
ansible.builtin.debug:
msg:
- "Output of podman ps command:"
- "{{ podman_output.stdout_lines }}"
- "{{ web_output.content }}"
- "Contents of web page:"
- "{{ web_output.content }}"

View File

@@ -9,7 +9,12 @@
tasks:
- name: Run Shell Script
shell: "{{ shell_script }}"
register: shell_output
- name: Print script output
debug:
var: shell_output.stdout_lines
- debug:
msg: You should really consider converting this script to a playbook!
run_once: yes
run_once: yes

View File

@@ -1,5 +1,6 @@
---
- hosts: "{{ HOSTS }}"
become: yes
vars:
service_name: undef

View File

@@ -1,5 +1,6 @@
---
- hosts: "{{ HOSTS }}"
become: yes
vars:
service_name: undef
@@ -11,4 +12,4 @@
service:
name: "{{ service_name }}"
state: stopped
when: service_name + '.service' in services
when: service_name + '.service' in services

View File

@@ -1,8 +1,8 @@
---
user_message: |
Be sure to update the 'activation_key' and 'org_id' extra variables for 'LINUX / Register'. https://access.redhat.com/management/activation_keys
Update Credential for Insights Inventory with Red Hat account.
user_message:
- Be sure to update the 'activation_key' and 'org_id' extra variables for 'LINUX / Register with Insights'. https://access.redhat.com/management/activation_keys
- Update Credential for Insights Inventory with Red Hat account.
- Add variables for system_roles. https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles
controller_components:
- projects
- credential_types
@@ -10,14 +10,8 @@ controller_components:
- inventory_sources
- job_templates
controller_projects:
- name: Fact Scan
organization: Default
scm_type: git
scm_url: 'https://github.com/ansible/awx-facts-playbooks.git'
controller_credential_types:
- name: "Insights Collection"
- name: Insights Collection
kind: cloud
inputs:
fields:
@@ -49,20 +43,21 @@ controller_inventory_sources:
source_path: linux/inventory.insights.yml
credential: Insights Inventory
controller_templates:
- name: "LINUX / Register"
- name: "LINUX / Register with Insights"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/ec2_register.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "Workshop Credential"
survey_enabled: true
extra_vars:
activation_key: undef
org_id: undef
activation_key: !unsafe "RHEL{{ ansible_distribution_major_version }}_{{ env }}"
org_id: REPLACEME
survey:
name: ''
description: ''
@@ -79,16 +74,23 @@ controller_templates:
- QA
- Prod
required: true
- question_name: Ansible Group
- question_name: Ansible Inventory Group (and Insights tag) to be created
type: text
variable: ansible_group
variable: insights_tag
required: true
- question_name: Org ID
type: text
variable: org_id
required: true
- name: "LINUX / Troubleshoot"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/tshoot.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
credentials:
- "Workshop Credential"
@@ -101,12 +103,15 @@ controller_templates:
type: text
variable: HOSTS
required: true
- name: "LINUX / Temporary Sudo"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/temp_sudo.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "Workshop Credential"
survey_enabled: true
@@ -127,14 +132,17 @@ controller_templates:
variable: sudo_time
default: 10
required: true
- name: "LINUX / Patching"
job_type: run
job_type: check
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/patching.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
job_type: check
ask_job_type_on_launch: yes
credentials:
- "Workshop Credential"
@@ -147,12 +155,15 @@ controller_templates:
type: text
variable: HOSTS
required: true
- name: "LINUX / Start Service"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/service_start.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
credentials:
- "Workshop Credential"
@@ -169,12 +180,15 @@ controller_templates:
type: text
variable: service_name
required: true
- name: "LINUX / Stop Service"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/service_stop.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
credentials:
- "Workshop Credential"
@@ -191,12 +205,15 @@ controller_templates:
type: text
variable: service_name
required: true
- name: "LINUX / Run Shell Script"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/run_script.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "Workshop Credential"
survey_enabled: true
@@ -212,21 +229,36 @@ controller_templates:
type: textarea
variable: shell_script
required: true
- name: "LINUX / Fact Scan"
project: Fact Scan
playbook: scan_facts.yml
project: "Ansible official demo project"
playbook: linux/fact_scan.yml
inventory: Workshop Inventory
execution_environment: Default execution environment
ask_limit_on_launch: true
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
credentials:
- Workshop Credential
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
- name: "LINUX / Podman Webserver"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/podman.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "Workshop Credential"
survey_enabled: true
@@ -242,16 +274,23 @@ controller_templates:
type: textarea
variable: message
required: true
default: "This is Apache webserver running in a container with podman"
- name: "LINUX / System Roles"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/system_roles.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
diff_mode: yes
ask_job_type_on_launch: yes
extra_vars:
system_roles: undef
system_roles:
- selinux
selinux_policy: targeted
selinux_state: enforcing
credentials:
- "Workshop Credential"
survey_enabled: true
@@ -262,4 +301,91 @@ controller_templates:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
required: true
- name: "LINUX / Install Web Console (cockpit)"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/system_roles.yml"
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
diff_mode: yes
ask_job_type_on_launch: yes
extra_vars:
system_roles:
- cockpit
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
- question_name: Cockpit package load
type: multiplechoice
variable: cockpit_packages
default: minimal
choices:
- default
- minimal
- full
required: true
- name: "LINUX / Compliance Enforce"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/compliance.yml"
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- "Workshop Credential"
extra_vars:
sudo_remove_nopasswd: false
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
- question_name: Compliance Profile
type: multiplechoice
variable: compliance_profile
required: true
choices:
- stig
- name: "LINUX / Insights Compliance Scan"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "linux/insights_compliance_scan.yml"
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: true
- question_name: Have you associated a compliance profile in the Insights Console for all hosts to be scanned? If not, then the scan will fail.
type: multiplechoice
variable: compliance_profile_configured
required: true
choices:
- "Yes"
- "No"
default: "No"

View File

@@ -1,6 +1,7 @@
---
- name: Apply RHEL System Roles
hosts: "{{ HOSTS }}"
become: true
vars:
system_roles: undef

View File

@@ -18,7 +18,7 @@
- name: Check Cleanup package
yum:
name: at
state: latest
state: present
- name: Check Cleanup Service
service:

38
network/README.md Normal file
View File

@@ -0,0 +1,38 @@
# Network Demos
## Table of Contents
- [Network Demos](#network-demos)
- [Table of Contents](#table-of-contents)
- [About These Demos](#about-these-demos)
- [Project](#project)
- [Inventory](#inventory)
- [Suggested Usage](#suggested-usage)
## About These Demos
This category of demos shows examples of network operations and management with Ansible Automation Platform. The list of demos can be found below. See the [Suggested Usage](#suggested-usage) section of this document for recommendations on how to best use these demos.
- [**NETWORK / Configuration**](https://github.com/nleiva/ansible-net-modules/blob/main/main.yml) - Deploy golden configurations for different resources to Cisco IOS, IOSXR, and NXOS.
### Project
These demos leverage playbooks from a [git repo](https://github.com/nleiva/ansible-net-modules) that is added as the **`Network Golden Configs`** Project in your Ansible Controller. Review this repo for the playbooks to configure different resources and network config templates that will be configured.
### Inventory
These demos leverage "always-on" instances for Cisco IOS, IOSXR, and NXOS from [Cisco DevNet Sandboxes](https://developer.cisco.com/docs/sandbox/#!getting-started/always-on-sandboxes). These instances are shared and do not provide admin access but they are instantly avaible all the time meaning not setup time is required.
A **`Network Inventory`** is created when setting up these demos and a dynamic source is added to populate the Always-On instances. Review the inventory file [here](https://github.com/nleiva/ansible-net-modules/blob/main/hosts).
## Suggested Usage
**NETWORK / Configuration** - Use this job to execute different [Ansible Network Resource Modules](https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html) to deploy golden configs. Below is a list of the different resources the can be configured with a link to their golden config.
- [acls](https://github.com/nleiva/ansible-net-modules/blob/main/acls.cfg)
- [banner](https://github.com/nleiva/ansible-net-modules/blob/main/banner.cfg)
- [bgp_global](https://github.com/nleiva/ansible-net-modules/blob/main/bgp_global.cfg)
- [hostname](https://github.com/nleiva/ansible-net-modules/blob/main/hostname.cfg)
- [l3_interface](https://github.com/nleiva/ansible-net-modules/blob/main/l3_interface.cfg)
- [logging](https://github.com/nleiva/ansible-net-modules/blob/main/logging.cfg)
- [ntp](https://github.com/nleiva/ansible-net-modules/blob/main/ntp.cfg)
- [ospfv2](https://github.com/nleiva/ansible-net-modules/blob/main/ospfv2.cfg)
- [prefix_lists](https://github.com/nleiva/ansible-net-modules/blob/main/prefix_lists.cfg)
- [snmp](https://github.com/nleiva/ansible-net-modules/blob/main/snmp.cfg)
- [user](https://github.com/nleiva/ansible-net-modules/blob/main/user.cfg)

58
network/report.yml Normal file
View File

@@ -0,0 +1,58 @@
---
# Re-write of:
# https://github.com/network-automation/toolkit/blob/master/playbooks/network_report.yml
# https://github.com/network-automation/toolkit/blob/master/roles/build_report/tasks/main.yml
- name: Collect facts
hosts: "{{ HOSTS }}"
gather_facts: false
tasks:
- name: Gather all network resource and minimal legacy facts [Cisco IOS]
cisco.ios.ios_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.ios.ios'
- name: Gather all network resource and minimal legacy facts [Cisco NX-OS]
cisco.nxos.nxos_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.nxos.nxos'
- name: Gather all network resource and minimal legacy facts [Cisco IOS XR]
cisco.iosxr.iosxr_facts:
gather_subset: min
gather_network_resources: all
when: ansible_network_os == 'cisco.iosxr.iosxr'
# The dig lookup requires the python 'dnspython' library
# - name: Resolve IP address
# ansible.builtin.set_fact:
# ansible_host: "{{ lookup('community.general.dig', inventory_hostname)}}"
- hosts: node1
become: yes
vars:
report_server: node1
web_path: /var/www/html/reports/
tasks:
- ansible.builtin.include_role:
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.build_report_network
- block:
- ansible.builtin.include_role:
name: "{{ item }}"
loop:
- demo.patching.report_server
- demo.patching.build_report_network
- ansible.builtin.include_role:
name: demo.patching.report_server
tasks_from: linux_landing_page
delegate_to: "{{ report_server }}"
run_once: yes

99
network/setup.yml Normal file
View File

@@ -0,0 +1,99 @@
---
user_message:
controller_components:
- projects
- inventories
- hosts
- inventory_sources
- inventory_source_update
- job_templates
controller_projects:
- name: Network Golden Configs
organization: Default
scm_type: git
scm_url: https://github.com/nleiva/ansible-net-modules
update_project: yes
wait: yes
controller_inventories:
- name: Network Inventory
organization: Default
controller_inventory_sources:
- name: DevNet always-on sandboxes
source: scm
inventory: Network Inventory
overwrite: true
source_project: Network Golden Configs
source_path: hosts
controller_hosts:
- name: node1
inventory: Network Inventory
variables:
ansible_user: rhel
ansible_host: node1
controller_templates:
- name: NETWORK / Configuration
organization: Default
inventory: Network Inventory
survey_enabled: true
project: Network Golden Configs
playbook: main.yml
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
ask_limit_on_launch: true
use_fact_cache: yes
survey:
name: ''
description: ''
spec:
- question_name: What resource would you like to configure?
type: multiplechoice
variable: rm
required: true
choices:
- acls
- banner
- bgp_global
- hostname
- l3_interface
- logging
- ntp
- ospfv2
- prefix_lists
- snmp
- user
- name: "NETWORK / Report"
job_type: check
organization: Default
inventory: Network Inventory
project: "Ansible official demo project"
playbook: "network/report.yml"
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
use_fact_cache: true
ask_job_type_on_launch: yes
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: What devices do you want to include in the report?
type: multiplechoice
variable: HOSTS
default: routers
required: true
choices:
- sandbox-iosxe-latest-1.cisco.com
- sandbox-iosxr-1.cisco.com
- sandbox-nxos-1.cisco.com
- routers

View File

@@ -13,7 +13,7 @@
ami_id: ami-096fda3c22c1c990a
when: aws_region == "us-east-1"
- name: Setting the correct AMI per us-east-1
- name: Setting the correct AMI per us-west-1
set_fact:
ami_id: ami-09d9c5cdcfb8fc655
when: aws_region == "us-west-1"
@@ -55,4 +55,4 @@
image_id: "{{ ami_id }}"
wait: yes
name: "{{ instance_name }}"
register: ec2
register: ec2

6
roles/requirements.yml Normal file
View File

@@ -0,0 +1,6 @@
---
roles:
- name: redhatofficial.rhel7_stig
version: 0.1.61
- name: redhatofficial.rhel8_stig
version: 0.1.60

27
satellite/README.md Normal file
View File

@@ -0,0 +1,27 @@
# Satellite Demos
## Table of Contents
- [Satellite Demos](#satellite-demos)
- [Table of Contents](#table-of-contents)
- [About These Demos](#about-these-demos)
- [Jobs](#jobs)
- [Inventory](#inventory)
- [Suggested Usage](#suggested-usage)
## About These Demos
This category of demos shows examples of linux operations and management with Ansible Automation Platform and Red Hat Satellite Server. The list of demos can be found below. See the [Suggested Usage](#suggested-usage) section of this document for recommendations on how to best use these demos.
### Jobs
- [**LINUX / Register with Satellite**](server_register.yml) - Register a RHEL server with Red Hat Satellite.
- [**LINUX / Compliance Scan with Satellite**](server_openscap.yml) - Run OpenSCAP scan and report to Satellite.
- [**SATELLITE / Publish Content View Version**](satellite_publish.yml) - Publish a new version of a content view.
- [**SATELLITE / Promote Content View Version**](satellite_promote.yml) - Promote a content view version to the next lifecycle environment.
### Inventory
A dymanic inventory is created to pull inventory hosts from Red Hat Satellite. Groups will automatically be created
## Suggested Usage
**Linux / Register with Satellite** - Register a server with Red Hat Satellite using an activation key in the format `RHEL<major version>_<environment>`.
**SATELLITE / Publish Content View Version** - Publish a new version of a content view to start a patching process. By default this will publish the version and promote to the 'Dev' environment.

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<xccdf:Tailoring xmlns:xccdf="http://checklists.nist.gov/xccdf/1.2" id="xccdf_scap-workbench_tailoring_default">
<xccdf:benchmark href="/tmp/scap-workbench-iwLkek/ssg-rhel7-ds.xml"/>
<xccdf:version time="2022-07-21T09:19:44">1</xccdf:version>
<xccdf:Profile id="xccdf_org.ssgproject.content_profile_stig_customized" extends="xccdf_org.ssgproject.content_profile_stig">
<xccdf:title xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en-US" override="true">DISA STIG for Red Hat Enterprise Linux 7 [CUSTOMIZED]</xccdf:title>
<xccdf:description xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en-US" override="true">This profile contains configuration checks that align to the
DISA STIG for Red Hat Enterprise Linux V3R7.
In addition to being applicable to Red Hat Enterprise Linux 7, DISA recognizes this
configuration baseline as applicable to the operating system tier of
Red Hat technologies that are based on Red Hat Enterprise Linux 7, such as:
- Red Hat Enterprise Linux Server
- Red Hat Enterprise Linux Workstation and Desktop
- Red Hat Enterprise Linux for HPC
- Red Hat Storage
- Red Hat Containers with a Red Hat Enterprise Linux 7 image</xccdf:description>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_rpm_verify_ownership" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_aide_use_fips_hashes" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_aide_verify_acls" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_aide_verify_ext_attributes" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_install_antivirus" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_agent_mfetpd_running" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_package_mcafeetp_installed" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_mcafee_endpoint_security_software" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_mcafee_security_software" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_endpoint_security_software" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_partition_for_home" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_partition_for_var" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_partition_for_tmp" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_partition_for_var_log_audit" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_disk_partitioning" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_sudo_remove_nopasswd" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny_root" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_interval" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_install_smartcard_packages" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_smartcard_auth" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_account_disable_post_pw_expiration" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_account_expiration" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_accounts_authorized_local_users" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_grub2_admin_username" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_grub2_password" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_service_firewalld_enabled" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_firewalld_activation" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_configure_firewalld_ports" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_set_firewalld_default_zone" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_ruleset_modifications" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_network-firewalld" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_network_configure_name_resolution" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_mount_option_home_nosuid" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_postfix_prevent_unrestricted_relay" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_postfix_server_relay" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_postfix_server_cfg" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_postfix_harden_os" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_mail" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_set_maxpoll" selected="false"/>
<xccdf:select idref="xccdf_org.ssgproject.content_group_ntp" selected="false"/>
</xccdf:Profile>
</xccdf:Tailoring>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
---
satellite_activation_keys:
# Red Hat Enterprise Linux 7
- name: "RHEL7_Dev"
lifecycle_environment: "RHEL7_Dev"
content_view: "RHEL7"
- name: "RHEL7_QA"
lifecycle_environment: "RHEL7_QA"
content_view: "RHEL7"
- name: "RHEL7_Prod"
lifecycle_environment: "RHEL7_Prod"
content_view: "RHEL7"
# Red Hat Enterprise Linux 8
- name: "RHEL8_Dev"
lifecycle_environment: "RHEL8_Dev"
content_view: "RHEL8"
- name: "RHEL8_QA"
lifecycle_environment: "RHEL8_QA"
content_view: "RHEL8"
- name: "RHEL8_Prod"
lifecycle_environment: "RHEL8_Prod"
content_view: "RHEL8"

View File

@@ -0,0 +1,29 @@
---
satellite_content_views:
# Red Hat Enterprise Linux 7
- name: RHEL7
content_view: RHEL7
repositories:
- name: Red Hat Enterprise Linux 7 Server (RPMs)
basearch: x86_64
releasever: 7Server
product: 'Red Hat Enterprise Linux Server'
- name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
basearch: x86_64
product: 'Red Hat Enterprise Linux Server'
- name: Red Hat Satellite Tools 6.8 (for RHEL 7 Server) (RPMs)
basearch: x86_64
product: 'Red Hat Enterprise Linux Server'
# Red Hat Enterprise Linux 8
- name: RHEL8
content_view: RHEL8
content_view_update: true
repositories:
- name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
releasever: 8
product: Red Hat Enterprise Linux for x86_64
- name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
releasever: 8
product: Red Hat Enterprise Linux for x86_64
- name: Red Hat Satellite Tools 6.8 for RHEL 8 x86_64 (RPMs)
product: Red Hat Enterprise Linux for x86_64

View File

@@ -0,0 +1,3 @@
---
satellite_organization: "Default Organization"
satellite_validate_certs: false

View File

@@ -0,0 +1,16 @@
---
satellite_lifecycle_environments:
# Red Hat Enterprise Linux 7
- name: "RHEL7_Dev"
prior: "Library"
- name: "RHEL7_QA"
prior: "RHEL7_Dev"
- name: "RHEL7_Prod"
prior: "RHEL7_QA"
# Red Hat Enterprise Linux 8
- name: "RHEL8_Dev"
prior: "Library"
- name: "RHEL8_QA"
prior: "RHEL8_Dev"
- name: "RHEL8_Prod"
prior: "RHEL8_QA"

View File

@@ -0,0 +1,17 @@
---
- hosts: localhost
connection: local
gather_facts: no
vars:
organization: Default Organization
lifecycle_environment: undef
current_lifecycle_environment: undef
content_view: undef
tasks:
- name: Promote Content View
redhat.satellite.content_view_version:
content_view: "{{ content_view }}"
organization: "{{ organization }}"
lifecycle_environments: "{{ lifecycle_environment }}"
current_lifecycle_environment: "{{ current_lifecycle_environment }}"

View File

@@ -0,0 +1,29 @@
---
- hosts: localhost
connection: local
gather_facts: no
vars:
content_view: undef
env: undef
organization: Default Organization
lifecycle_environment: "{{ content_view }}_{{ env }}"
publish_timeout: 14400
publish_retry_interval: 15
tasks:
- name: publish content view
redhat.satellite.content_view_version:
content_view: "{{ content_view }}"
organization: "{{ organization }}"
lifecycle_environments: "{{ lifecycle_environment }}"
# async: "{{ publish_timeout }}"
# poll: 0
# register: publish_async
# - name: check if content view is finished
# async_status:
# jid: "{{ publish_async.ansible_job_id }}"
# register: job_result
# until: job_result.finished
# retries: "{{ ( publish_timeout / publish_retry_interval ) | int }}"
# delay: "{{ publish_retry_interval }}"

View File

@@ -0,0 +1,16 @@
---
- hosts: "{{ HOSTS }}"
become: yes
vars:
policy_name: all
roles:
- demo.satellite.scap_client
tasks:
- name: Randomized startup delay...
pause: seconds="{{ 5 | random }}"
- name: "Run SCAP Scan"
shell: "/usr/bin/foreman_scap_client {{ item.id }}"
loop: "{{ policy }}"
when: policy_scan == 'all' or item.name in policy_scan

View File

@@ -0,0 +1,8 @@
---
- hosts: "{{ HOSTS }}"
become: yes
vars:
# env: undef
satellite_url: "{{ lookup('ansible.builtin.env', 'SATELLITE_SERVER') }}"
roles:
- demo.satellite.register_host

275
satellite/setup.yml Normal file
View File

@@ -0,0 +1,275 @@
user_message:
controller_components:
- credential_types
- credentials
- inventory_sources
- job_templates
- job_launch
# - workflow_job_templates
controller_credential_types:
- name: Satellite Collection
kind: cloud
inputs:
fields:
- id: username
type: string
label: Satellite Username
- id: password
type: string
label: Satellite Password
secret: true
- id: host
type: string
label: Satellite Hostname
required:
- username
- password
- host
injectors:
env:
SATELLITE_SERVER: "{% raw %}{ { host }}{% endraw %}"
SATELLITE_USERNAME: "{% raw %}{ { username }}{% endraw %}"
SATELLITE_PASSWORD: "{% raw %}{ { password }}{% endraw %}"
SATELLITE_VALIDATE_CERTS: 'false'
controller_credentials:
- name: Satellite Inventory
credential_type: Red Hat Satellite 6
organization: Default
inputs:
host: https://satellite.example.com
username: admin
password: ansible123!
- name: Satellite Credential
credential_type: Satellite Collection
organization: Default
inputs:
host: https://satellite.example.com
username: admin
password: ansible123!
controller_inventory_sources:
- name: Satellite Inventory
inventory: Workshop Inventory
credential: Satellite Inventory
source: satellite6
update_on_launch: false
execution_environment: Control Plane Execution Environment
overwrite: true
source_vars:
hostnames:
- name.split('.')[0]
groups:
patch_bugs: foreman_content_facet_attributes.errata_counts.bugfix
patch_enhancements: foreman_content_facet_attributes.errata_counts.enhancement
patch_security: foreman_content_facet_attributes.errata_counts.security
keyed_groups:
- prefix: env
key: foreman_content_facet_attributes.lifecycle_environment_name
- prefix: cv
key: foreman_content_facet_attributes.content_view_name
- prefix: os
key: foreman_operatingsystem_name
- prefix: scap
key: foreman_compliance_status_label
validate_certs: no
controller_templates:
- name: LINUX / Register with Satellite
project: Ansible official demo project
playbook: satellite/server_register.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- Workshop Credential
- Satellite Credential
extra_vars:
org_id: "Default_Organization"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- question_name: Choose Environment
type: multiplechoice
variable: env
choices:
- Dev
- QA
- Prod
required: true
- name: LINUX / Compliance Scan with Satellite
project: Ansible official demo project
playbook: satellite/server_openscap.yml
inventory: Workshop Inventory
execution_environment: Ansible Engine 2.9 execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- Satellite Credential
- Workshop Credential
extra_vars:
policy_scan: all
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- name: SATELLITE / Publish Content View Version
project: Ansible official demo project
playbook: satellite/satellite_publish.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- Satellite Credential
extra_vars:
env: Dev
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Select Content View
variable: content_view
type: multiplechoice
choices: "{{ satellite_content_views | selectattr('name', 'match', '^RHEL.*$') | map(attribute='name') | list}}"
required: true
- name: SATELLITE / Promote Content View Version
project: Ansible official demo project
playbook: satellite/satellite_promote.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- Satellite Credential
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Select Content View
variable: content_view
type: multiplechoice
choices: "{{ satellite_content_views | selectattr('name', 'match', '^RHEL.*$') | map(attribute='name') | list}}"
required: true
- question_name: Current Lifecycle Environment
variable: current_lifecycle_environment
type: multiplechoice
choices: "{{ satellite_lifecycle_environments | selectattr('name', 'match', '^RHEL.*$') | map(attribute='name') | list}}"
required: true
- question_name: Next Lifecycle Environment
variable: lifecycle_environment
type: multiplechoice
choices: "{{ satellite_lifecycle_environments | selectattr('name', 'match', '^RHEL.*$') | map(attribute='name') | list}}"
required: true
- name: SETUP / Satellite
project: Ansible official demo project
playbook: satellite/setup_satellite.yml
inventory: Workshop Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
credentials:
- Satellite Credential
controller_launch_jobs:
- name: SETUP
wait: false
extra_vars:
demo: linux
- name: SETUP / Satellite
wait: false
#######################
### Satellite Vars ###
######################
satellite_components:
- content_views
#- content_view_publish
- lifecycle_environments
- activation_keys
satellite_organization: "Default Organization"
satellite_validate_certs: false
satellite_content_views:
# Red Hat Enterprise Linux 7
- name: RHEL7
content_view: RHEL7
repositories:
- name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
product: 'Red Hat Enterprise Linux Server'
- name: Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64
product: 'Red Hat Enterprise Linux Server'
- name: Red Hat Satellite Client 6 for RHEL 7 Server RPMs x86_64
product: 'Red Hat Enterprise Linux Server'
# Red Hat Enterprise Linux 8
- name: RHEL8
content_view: RHEL8
repositories:
- name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8
product: Red Hat Enterprise Linux for x86_64
- name: Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8
product: Red Hat Enterprise Linux for x86_64
- name: Red Hat Satellite Client 6 for RHEL 8 x86_64 RPMs
product: Red Hat Enterprise Linux for x86_64
satellite_lifecycle_environments:
# Red Hat Enterprise Linux 7
- name: "RHEL7_Dev"
prior: "Library"
- name: "RHEL7_QA"
prior: "RHEL7_Dev"
- name: "RHEL7_Prod"
prior: "RHEL7_QA"
# Red Hat Enterprise Linux 8
- name: "RHEL8_Dev"
prior: "Library"
- name: "RHEL8_QA"
prior: "RHEL8_Dev"
- name: "RHEL8_Prod"
prior: "RHEL8_QA"
satellite_activation_keys:
# Red Hat Enterprise Linux 7
- name: "RHEL7_Dev"
lifecycle_environment: "RHEL7_Dev"
content_view: "RHEL7"
- name: "RHEL7_QA"
lifecycle_environment: "RHEL7_QA"
content_view: "RHEL7"
- name: "RHEL7_Prod"
lifecycle_environment: "RHEL7_Prod"
content_view: "RHEL7"
# Red Hat Enterprise Linux 8
- name: "RHEL8_Dev"
lifecycle_environment: "RHEL8_Dev"
content_view: "RHEL8"
- name: "RHEL8_QA"
lifecycle_environment: "RHEL8_QA"
content_view: "RHEL8"
- name: "RHEL8_Prod"
lifecycle_environment: "RHEL8_Prod"
content_view: "RHEL8"

View File

@@ -0,0 +1,54 @@
---
- hosts: localhost
gather_facts: no
vars_files: setup.yml
vars:
refresh_satellite_manifest: true
tasks:
- name: refresh manifest
redhat.satellite.subscription_manifest:
organization: "Default Organization"
state: refreshed
when: refresh_satellite_manifest
- name: Setup CV
include_role:
name: redhat.satellite.content_views
- name: Publish CV
include_role:
name: redhat.satellite.content_view_publish
vars:
satellite_content_views:
- RHEL7
- RHEL8
- name: Setup Lifecycle Environment
include_role:
name: redhat.satellite.lifecycle_environments
- name: redhat.satellite.content_view_publish CV
redhat.satellite.content_view_version:
organization: "{{ satellite_organization }}"
content_view: "{{ item }}"
lifecycle_environments:
- "{{ item }}_Dev"
- "{{ item }}_QA"
- "{{ item }}_Prod"
loop:
- RHEL7
- RHEL8
- name: Setup activation_keys
include_role:
name: redhat.satellite.activation_keys
- name: Add SCAP Tailoring File
redhat.satellite.scap_tailoring_file:
name: RHEL7_STIG
organizations: "{{ satellite_organization }}"
scap_file: "{{ item }}"
loop:
- files/ssg-rhel7-ds-tailoring.xml
- files/ssg-rhel8-ds-tailoring-stig-gui.xml

View File

@@ -1,20 +1,77 @@
---
- hosts: localhost
gather_facts: no
vars_files:
- "{{demo}}/setup.yml"
vars:
controller_validate_certs: false
- name: Setup demo
hosts: localhost
gather_facts: false
tasks:
- name: Setup Components
include_role:
- name: Default Components
ansible.builtin.include_role:
name: "redhat_cop.controller_configuration.{{ item }}"
loop: "{{ controller_components }}"
vars:
controller_components:
- notification_templates
- job_templates
- settings
controller_execution_environments:
- name: product-demos
image: http://quay.io/acme_corp/product-demos-ee:latest
controller_organizations:
- name: Default
default_environment: product-demos
controller_notifications:
- name: Telemetry
organization: Default
notification_type: webhook
notification_configuration:
url: https://script.google.com/macros/s/AKfycbzxUObvCJ6ZbzfJyicw4RvxlGE3AZdrK4AR5-TsedCYd7O-rtTOVjvsRvqyb3rx6B0g8g/exec
http_method: POST
headers: {}
controller_templates:
- name: "SUBMIT FEEDBACK"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "feedback.yml"
execution_environment: Default execution environment
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Name/Email/Contact
type: text
variable: email
required: true
- question_name: Issue or Feedback
type: textarea
variable: feedback
required: true
controller_settings:
- name: "SESSION_COOKIE_AGE"
value: 180000
- name: "include configuration for {{ demo }}"
ansible.builtin.include_vars: "{{ demo }}/setup.yml"
- name: Demo Components
ansible.builtin.include_role:
name: "redhat_cop.controller_configuration.{{ item }}"
loop: "{{ controller_components }}"
when:
- controller_components | d("") | length > 0
- name: Log Demo
ansible.builtin.uri:
url: https://docs.google.com/forms/d/e/1FAIpQLSdIZ77YpETjEfGOoYlXtMnQiU-6M7QFlb2hJA4ujo25QYb2jw/formResponse
method: POST
body: "ifq&entry.1569353616={{ demo }} &entry.498055740={{ lookup('ansible.builtin.env', 'AWX_HOST') }}&sumbit=Submit"
ignore_errors: true
- name: Print Message
debug:
ansible.builtin.debug:
msg: "{{ user_message }}"
when: user_message is defined
when: user_message is defined

29
windows/README.md Normal file
View File

@@ -0,0 +1,29 @@
# Windows Demos
## Table of Contents
- [Windows Demos](#windows-demos)
- [Table of Contents](#table-of-contents)
- [About These Demos](#about-these-demos)
- [Jobs](#jobs)
- [Suggested Usage](#suggested-usage)
## About These Demos
This category of demos shows examples of Windows Server operations and management with Ansible Automation Platform. The list of demos can be found below. See the [Suggested Usage](#suggested-usage) section of this document for recommendations on how to best use these demos.
### Jobs
- [**WINDOWS / Install IIS**](install_iis.yml) - Install IIS feature with a configurable index.html
- [**WINDOWS / Patching**](patching.yml) - Apply Windows updates by category and create report
- [**WINDOWS / Chocolatey install multiple**](windows_choco_multiple.yml) - Install multiple packages using Chocolatey and check versions
- [**WINDOWS / Chocolatey install specific**](windows_choco_specific.yml) - Install a single given package using Chocolatey
- [**WINDOWS / Arbitrary Powershell**](arbitrary_powershell.yml) - Run given Powershell script (default: retrieve cat fact from API)
- [**WINDOWS / Powershell Script**](powershell_script.yml) - Run a Powershell script stored in source control to query services
- [**WINDOWS / Powershell DSC configuring password requirements**](powershell_dsc.yml) - Configure password complexity with Powershell desired state config
- [**WINDOWS / Create Active Directory Domain**](active_directory/create_ad_domain.yml) - Create a new AD Domain
- [**WINDOWS / Helpdesk new user portal**](active_directory/helpdesk_new_user_portal.yml) - Create user in AD Domain
## Suggested Usage
**WINDOWS / Create Active Directory Domain** - This job can take some to complete. It is recommended to run ahead of time if you would like to demo creating a helpdesk user.
**WINDOWS / Helpdesk new user portal** - This job is dependant on the Create Active Directory Domain completing before users can be created.

Some files were not shown because too many files have changed in this diff Show More