Merge of RedHatGov/product-demos (#56)
Co-authored-by: MKletz <michael.kletz.27@gmail.com> Co-authored-by: Ajay Chenampara <ajay.chenampara@gmail.com> Co-authored-by: dlemons-redhat <69318976+dlemons-redhat@users.noreply.github.com> Co-authored-by: Nicolas Leiva <nicolasleiva@gmail.com> Co-authored-by: benblasco <42140583+benblasco@users.noreply.github.com> Co-authored-by: Benjamin Blasco <bblasco@redhat.com> Co-authored-by: calvingsmith <4283930+calvingsmith@users.noreply.github.com> Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com> Co-authored-by: Hicham Mourad <43329991+HichamMourad@users.noreply.github.com>
6
.github/linters/.markdown-lint.yml
vendored
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"default": true,
|
||||
"MD003": false,
|
||||
"MD013": false,
|
||||
"MD033": false
|
||||
}
|
||||
52
.github/linters/ansible-lint.yml
vendored
@@ -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
|
||||
35
.github/linters/markdown-lint.yml
vendored
@@ -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
|
||||
23
.github/workflows/ansible-lint.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Ansible Lint
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
ANSIBLE_GALAXY_SERVER_LIST: ah,galaxy
|
||||
ANSIBLE_GALAXY_SERVER_AH_URL: https://console.redhat.com/api/automation-hub/
|
||||
ANSIBLE_GALAXY_SERVER_AH_AUTH_URL: https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
|
||||
ANSIBLE_GALAXY_SERVER_AH_TOKEN: ${{ secrets.ANSIBLE_GALAXY_SERVER_AH_TOKEN }}
|
||||
ANSIBLE_GALAXY_SERVER_GALAXY_URL: https://galaxy.ansible.com/
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Important: This sets up your GITHUB_WORKSPACE environment variable
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # needed for progressive mode to work
|
||||
|
||||
- name: Run ansible-lint
|
||||
uses: ansible/ansible-lint-action@v6.11.0
|
||||
46
CONTRIBUTING.md
Normal 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
|
||||
24
README.md
@@ -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.
|
||||
|
||||
[](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>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"default": true,
|
||||
"MD003": false,
|
||||
"MD013": false,
|
||||
"MD033": false
|
||||
}
|
||||
50
aap-on-crc/.github/workflows/linter.yml
vendored
@@ -1,50 +0,0 @@
|
||||
---
|
||||
###########################
|
||||
###########################
|
||||
## Linter GitHub Actions ##
|
||||
###########################
|
||||
###########################
|
||||
name: Lint Code Base
|
||||
|
||||
#
|
||||
# Documentation:
|
||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||
#
|
||||
|
||||
#############################
|
||||
# Start the job on all push #
|
||||
#############################
|
||||
on: [push, pull_request]
|
||||
|
||||
###############
|
||||
# Set the Job #
|
||||
###############
|
||||
jobs:
|
||||
build:
|
||||
# Name the Job
|
||||
name: Lint Code Base
|
||||
# Set the agent to run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
##################
|
||||
# Load all steps #
|
||||
##################
|
||||
steps:
|
||||
##########################
|
||||
# Checkout the code base #
|
||||
##########################
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# Full git history is needed to get a proper list of changed files within `super-linter`
|
||||
fetch-depth: 0
|
||||
|
||||
################################
|
||||
# Run Linter against code base #
|
||||
################################
|
||||
- name: Lint Code Base
|
||||
uses: github/super-linter@v3
|
||||
env:
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
DEFAULT_BRANCH: main
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,162 +0,0 @@
|
||||
# How to deploy Ansible Automation Platform via the Operator on CodeReady Containers
|
||||
|
||||
This is a quick how to deploy Ansible Automation platform locally on Code Ready Containers for a quick demo, or home lab.
|
||||
|
||||
## Definitions
|
||||
|
||||
[Red Hat CodeReady Containers aka CRC](https://developers.redhat.com/products/codeready-containers/overview) is a very easy to install local OpenShift cluster that runs on your laptop. This works for any operating system and can be downloaded from [here.](https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/)
|
||||
|
||||
[Ansible Automation Platform (AAP)](https://www.ansible.com/products/automation-platform) is the latest release of what was formerly known as Ansible Tower with many new features.
|
||||
|
||||
## CodeReady Containers Installation
|
||||
|
||||
Instructions to install crc are [here](https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.35/html/getting_started_guide/installation_gsg)
|
||||
|
||||
TL;DR if you are on a mac you must be on 10.14 or above and you can just need to run crc binary you installed. (for Linux you will need to install libvirt via ```yum install virt-manager or apt if on debian``` and windows hyper-v must be enabled see install instructions above)
|
||||
|
||||
### From terminal
|
||||
|
||||
Untar files
|
||||
|
||||
```shell
|
||||
tar -xvf crc-linux-amd64.tar.xz
|
||||
```
|
||||
|
||||
Copy files to bin
|
||||
|
||||
```shell
|
||||
sudo cp crc-linux-*1.36.0*-amd64/crc /bin/.
|
||||
```
|
||||
|
||||
Run setup
|
||||
|
||||
```shell
|
||||
crc setup
|
||||
```
|
||||
|
||||
Increase default cpus so you can run AAP. `Note:` You can sometimes get away with 6, however 8 has worked best for most people
|
||||
|
||||
```shell
|
||||
crc config set cpus 8
|
||||
```
|
||||
|
||||
Increase default memory so you can run AAP.
|
||||
|
||||
```shell
|
||||
crc config set memory 12288
|
||||
```
|
||||
|
||||
Then to run it:
|
||||
|
||||
```shell
|
||||
crc start
|
||||
```
|
||||
|
||||
>>Note: If this is the first time you are installing CodeReady it will ask for a pull secret. You will need to get this from [https://cloud.redhat.com](https://cloud.redhat.com) once logged in choose openshift on the left followed by local install and click copy pull secret and paste it into the terminal.
|
||||
|
||||

|
||||
|
||||
Once it is installed it should give you information to log in, however you can always retrieve this with:
|
||||
|
||||
```shell
|
||||
crc console --credentials
|
||||
```
|
||||
|
||||
## Installing the Ansible Automation Platform Operator
|
||||
|
||||
---
|
||||
|
||||
## Login to the crc console as kubeadmin
|
||||
|
||||
[https://console-openshift-console.apps-crc.testing](https://console-openshift-console.apps-crc.testing) (get password via ```crc console --credentials``` )
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Once logged into the CRC/Openshift local instance click on OperatorHub on the left
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### Type Ansible into the filter window and choose Ansible Automation Platform
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Click install
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Allow all the defaults and click install again
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Once it is installed click view operator
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Click Create Instance in the Automation Controller box (third from left)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Click Create (you can rename to whatever you want default is example)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Click on instance you created
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Loging to AAP console (click on URL link on right. The password is in the Admin Password link below the URL)
|
||||
|
||||

|
||||
|
||||
## Add Subscription via your redhat login (if you dont have one click the request trial button at the top)
|
||||
|
||||
`Note:` Some users have reported that `request subscription` takes a little time to populate, so if you don't see your trial in the next step please try again a little later.
|
||||
|
||||

|
||||
|
||||
## Select the subscription (then next, next, submit)
|
||||
|
||||

|
||||
|
||||
Now you have a fully functional AAP instance to test with.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Known Issues and fixes
|
||||
|
||||
### AAP Memory Requirements
|
||||
|
||||
The AAP operator by default assigns 2gib to each container. Due to this your deployment of AAP may fail with only 12gib assigned to CRC. You can see the failure under pods in the Ansible Automation Project like this:
|
||||
|
||||

|
||||
|
||||
To fix this you have a few options:
|
||||
|
||||
1. Add more ram via crc setup set memory 16384
|
||||
2. Change the memory resource limits to the pod (Deployments >> Edit Resource limits)
|
||||
|
||||

|
||||
|
||||
Change to 500 millicores and 1mib like below:
|
||||
|
||||

|
||||
|
Before Width: | Height: | Size: 302 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 23 KiB |
3
ansible.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[defaults]
|
||||
collections_paths=./collections
|
||||
roles_path=./roles
|
||||
109
azure/setup.yml
@@ -1,109 +0,0 @@
|
||||
---
|
||||
user_message: |
|
||||
Be sure to update the public_key extra_var on the 'Azure RHEL 8 VM' Template
|
||||
The Azure Infrastructure credential must be updated with your service principal credentials to access Azure API
|
||||
azure_public_key: undef
|
||||
controller_components:
|
||||
- projects
|
||||
- credentials
|
||||
- inventories
|
||||
- inventory_sources
|
||||
- job_templates
|
||||
|
||||
controller_projects:
|
||||
- name: Azure Repo
|
||||
description: Azure Demo Repo
|
||||
organization: Default
|
||||
scm_type: git
|
||||
scm_url: https://github.com/ansible-cloud/azure.git
|
||||
|
||||
controller_credentials:
|
||||
- name: Azure Infrastructure
|
||||
credential_type: Microsoft Azure Resource Manager
|
||||
organization: Default
|
||||
inputs:
|
||||
subscription: REPLACEME
|
||||
|
||||
controller_inventories:
|
||||
- name: Workshop Inventory
|
||||
organization: Default
|
||||
|
||||
controller_inventory_sources:
|
||||
- name: Azure Inventory
|
||||
inventory: Workshop Inventory
|
||||
source: azure_rm
|
||||
credential: Azure Infrastructure
|
||||
overwrite: true
|
||||
update_on_launch: true
|
||||
source_vars:
|
||||
include_vm_resource_groups:
|
||||
- ansible_test
|
||||
|
||||
hostnames:
|
||||
- computer_name
|
||||
- default
|
||||
|
||||
keyed_groups:
|
||||
- prefix: azure_loc
|
||||
key: location
|
||||
- prefix: azure_os
|
||||
key: os_profile.system
|
||||
|
||||
controller_templates:
|
||||
- name: "AZURE / RHEL 8 VM"
|
||||
job_type: run
|
||||
inventory: "Workshop Inventory"
|
||||
project: "Azure Repo"
|
||||
playbook: "project/create_rhel_vm_demo.yml"
|
||||
credentials:
|
||||
- "Azure Infrastructure"
|
||||
extra_vars:
|
||||
resource_group_name: "ansible_test"
|
||||
region: "eastus"
|
||||
vnet_cidr: "10.0.0.0/16"
|
||||
subnet_cidr: "10.0.1.0/24"
|
||||
vnet_name: "demo_vnet"
|
||||
subnet_name: "demo_subnet"
|
||||
network_sec_group_name: "demo_sec_group"
|
||||
rhel_admin_user: "azureuser"
|
||||
rhel_public_ip_name: "rhel_demo_ip"
|
||||
rhel_nic_name: "rhel_demo_nic"
|
||||
rhel_vm_name: "RHEL8-ansible"
|
||||
rhel_vm_size: "Standard_DS1_v2"
|
||||
rhel_vm_sku: "8_5"
|
||||
rhel_public_key: "{{ azure_public_key }}"
|
||||
survey_public_ip: "True"
|
||||
|
||||
- name: "AZURE / Windows VM"
|
||||
job_type: run
|
||||
inventory: "Workshop Inventory"
|
||||
project: "Azure Repo"
|
||||
playbook: "project/create_windows_vm_demo.yml"
|
||||
credentials:
|
||||
- "Azure Infrastructure"
|
||||
extra_vars:
|
||||
resource_group_name: "ansible_test"
|
||||
region: "eastus"
|
||||
vnet_cidr: "10.0.0.0/16"
|
||||
subnet_cidr: "10.0.1.0/24"
|
||||
vnet_name: "demo_vnet"
|
||||
subnet_name: "demo_subnet"
|
||||
network_sec_group_name: "demo_sec_group"
|
||||
win_vm_name: "WIN-ansible"
|
||||
win_vm_size: "Standard_DS1_v2"
|
||||
win_vm_sku: "2022-Datacenter"
|
||||
win_public_ip_name: "win_demo_ip"
|
||||
win_nic_name: "win_demo_nic"
|
||||
win_admin_user: "azureuser"
|
||||
win_admin_password: "AnsibleTest@123"
|
||||
|
||||
- name: "AZURE / Destroy Resource Group"
|
||||
job_type: run
|
||||
inventory: "Workshop Inventory"
|
||||
project: "Azure Repo"
|
||||
playbook: "project/destroy_resource_group.yml"
|
||||
credentials:
|
||||
- "Azure Infrastructure"
|
||||
extra_vars:
|
||||
resource_group_name: "ansible_test"
|
||||
region: "eastus"
|
||||
25
cloud/aws_key.yml
Normal 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 }}"
|
||||
@@ -4,4 +4,4 @@ vm_providers:
|
||||
aws_image_owners: 309956199498
|
||||
aws_instance_size: t2.medium
|
||||
aws_image_architecture: x86_64
|
||||
aws_image_filter: 'RHEL-7.9_HVM*'
|
||||
aws_image_filter: 'RHEL-7.9_HVM*'
|
||||
|
||||
@@ -4,4 +4,4 @@ vm_providers:
|
||||
aws_image_owners: 309956199498
|
||||
aws_instance_size: t3.micro
|
||||
aws_image_architecture: x86_64
|
||||
aws_image_filter: 'RHEL-8*HVM-*Hourly*'
|
||||
aws_image_filter: 'RHEL-8*HVM-*Hourly*'
|
||||
|
||||
7
cloud/blueprints/rhel9.yml
Normal 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*'
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
vm_blueprint_providers:
|
||||
- aws
|
||||
- azure
|
||||
- aws
|
||||
- azure
|
||||
aws_image_filter: 'Windows_Server-2019-English-Core-Base*'
|
||||
aws_instance_size: t3.medium
|
||||
aws_userdata_template: aws_windows_userdata
|
||||
@@ -11,4 +11,4 @@ az_vm_image:
|
||||
offer: WindowsServer
|
||||
publisher: MicrosoftWindowsServer
|
||||
sku: 2022-Datacenter
|
||||
version: latest
|
||||
version: latest
|
||||
|
||||
@@ -3,4 +3,4 @@ vm_blueprint_providers:
|
||||
- aws
|
||||
aws_image_filter: 'Windows_Server-2019-English-Core-Base*'
|
||||
aws_instance_size: t3.medium
|
||||
aws_userdata_template: aws_windows_userdata
|
||||
aws_userdata_template: aws_windows_userdata
|
||||
|
||||
@@ -3,4 +3,4 @@ vm_blueprint_providers:
|
||||
- aws
|
||||
aws_image_filter: 'Windows_Server-2019-English-Full-Base*'
|
||||
aws_instance_size: t3.medium
|
||||
aws_userdata_template: aws_windows_userdata
|
||||
aws_userdata_template: aws_windows_userdata
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
- name: Create Cloud Infra
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
vars:
|
||||
infra_provider: undef
|
||||
aws_public_key: undef
|
||||
tasks:
|
||||
- include_role:
|
||||
name: "demo.cloud.{{ infra_provider }}"
|
||||
tasks_from: create_infra
|
||||
- name: Include provider role
|
||||
ansible.builtin.include_role:
|
||||
name: "demo.cloud.{{ infra_provider }}"
|
||||
tasks_from: create_infra
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Create Cloud Infra
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
vars:
|
||||
vm_name: undef
|
||||
vm_owner: undef
|
||||
@@ -9,17 +9,17 @@
|
||||
vm_blueprint: undef
|
||||
|
||||
tasks:
|
||||
- name: "Importing {{ vm_blueprint | upper }} Blueprint"
|
||||
include_vars:
|
||||
file: "blueprints/{{ vm_blueprint }}.yml"
|
||||
- name: "Importing {{ vm_blueprint | upper }}"
|
||||
ansible.builtin.include_vars:
|
||||
file: "blueprints/{{ vm_blueprint }}.yml"
|
||||
|
||||
- name: "Check Provider Compatibility"
|
||||
assert:
|
||||
that: "'{{ vm_provider }}' in {{ vm_blueprint_providers }}"
|
||||
fail_msg: "{{ vm_blueprint | upper }} is not available for {{ vm_provider | upper }}"
|
||||
when: "vm_blueprint_providers is defined"
|
||||
- name: "Check Provider Compatibility"
|
||||
ansible.builtin.assert:
|
||||
that: "'{{ vm_provider }}' in {{ vm_blueprint_providers }}"
|
||||
fail_msg: "{{ vm_blueprint | upper }} is not available for {{ vm_provider | upper }}"
|
||||
when: "vm_blueprint_providers is defined"
|
||||
|
||||
- name: "Building {{ vm_blueprint | upper }} in {{ vm_provider | upper }}"
|
||||
include_role:
|
||||
name: "demo.cloud.{{ vm_provider }}"
|
||||
tasks_from: create_vm
|
||||
- name: "Building {{ vm_blueprint | upper }}"
|
||||
ansible.builtin.include_role:
|
||||
name: "demo.cloud.{{ vm_provider }}"
|
||||
tasks_from: create_vm
|
||||
|
||||
125
cloud/create_vpc.yml
Normal file
@@ -0,0 +1,125 @@
|
||||
---
|
||||
- name: Create Cloud Infra
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
aws_vpc_name: aws-test-vpc
|
||||
aws_owner_tag: default
|
||||
aws_purpose_tag: ansible_demo
|
||||
aws_tenancy: default
|
||||
aws_vpc_cidr_block: 10.0.0.0/16
|
||||
aws_subnet_cidr: 10.0.1.0/24
|
||||
aws_region: us-east-1
|
||||
aws_sg_name: aws-test-sg
|
||||
aws_subnet_name: aws-test-subnet
|
||||
aws_rt_name: aws-test-rt
|
||||
|
||||
tasks:
|
||||
- name: Create VPC
|
||||
amazon.aws.ec2_vpc_net:
|
||||
state: present
|
||||
name: "{{ aws_vpc_name }}"
|
||||
cidr_block: "{{ aws_vpc_cidr_block }}"
|
||||
tenancy: "{{ aws_tenancy }}"
|
||||
region: "{{ aws_region }}"
|
||||
tags:
|
||||
owner: "{{ aws_owner_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
register: aws_vpc
|
||||
|
||||
- name: Create internet gateway
|
||||
amazon.aws.ec2_vpc_igw:
|
||||
state: present
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
region: "{{ aws_region }}"
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}"
|
||||
owner: "{{ aws_owner_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
register: aws_gateway
|
||||
|
||||
- name: Create security group internal
|
||||
amazon.aws.ec2_security_group:
|
||||
state: present
|
||||
name: "{{ aws_sg_name }}"
|
||||
region: "{{ aws_region }}"
|
||||
description: Inbound WinRM and RDP, http for demo servers and internal AD ports
|
||||
rules:
|
||||
- proto: tcp
|
||||
ports:
|
||||
- 80 # HTTP
|
||||
- 443 # HTTPS
|
||||
- 22 # SSH
|
||||
- 5986 # WinRM
|
||||
- 3389 # RDP
|
||||
- 9090 # Cockpit
|
||||
cidr_ip: 0.0.0.0/0
|
||||
- proto: icmp
|
||||
to_port: -1
|
||||
from_port: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
- proto: tcp
|
||||
ports:
|
||||
- 80 # HTTP
|
||||
- 5986 # WinRM
|
||||
- 3389 # RDP
|
||||
- 53 # DNS
|
||||
- 88 # Kerberos Authentication
|
||||
- 135 # RPC
|
||||
- 139 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 445 # SMB
|
||||
- 464 # Kerberos Authentication
|
||||
- 5432 # PostgreSQL
|
||||
- 636 # LDAPS (LDAP over TLS)
|
||||
- 873 # Rsync
|
||||
- 3268-3269 # Global Catalog
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
cidr_ip: "{{ aws_vpc_cidr_block }}"
|
||||
- proto: udp
|
||||
ports:
|
||||
- 53 # DNS
|
||||
- 88 # Kerberos Authentication
|
||||
- 123 # NTP
|
||||
- 137-138 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 445 # SMB
|
||||
- 464 # Kerberos Authentication
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
cidr_ip: "{{ aws_vpc_cidr_block }}"
|
||||
rules_egress:
|
||||
- proto: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
tags:
|
||||
Name: "{{ aws_sg_name }}"
|
||||
owner: "{{ aws_owner_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
|
||||
- name: Create a subnet on the VPC
|
||||
amazon.aws.ec2_vpc_subnet:
|
||||
state: present
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
cidr: "{{ aws_subnet_cidr }}"
|
||||
region: "{{ aws_region }}"
|
||||
map_public: true
|
||||
tags:
|
||||
Name: "{{ aws_subnet_name }}"
|
||||
owner: "{{ aws_owner_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
register: aws_subnet
|
||||
|
||||
- name: Create a subnet route table
|
||||
amazon.aws.ec2_vpc_route_table:
|
||||
state: present
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
region: "{{ aws_region }}"
|
||||
subnets:
|
||||
- "{{ aws_subnet.subnet.id }}"
|
||||
routes:
|
||||
- dest: 0.0.0.0/0
|
||||
gateway_id: "{{ aws_gateway.gateway_id }}"
|
||||
tags:
|
||||
Name: "{{ aws_rt_name }}"
|
||||
owner: "{{ aws_owner_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
- hosts: "{{ HOSTS }}"
|
||||
gather_facts: no
|
||||
|
||||
tasks:
|
||||
- name: list systems to be destroyed
|
||||
debug:
|
||||
msg: "{{ inventory_hostname }}"
|
||||
|
||||
- name: pause for review...
|
||||
pause:
|
||||
seconds: 30
|
||||
prompt: "Systems listed above will be DESTROYED in 30 seconds. Cancel the job to Abort."
|
||||
|
||||
- name: destroy vm
|
||||
include_role:
|
||||
name: "demo.cloud.aws"
|
||||
tasks_from: destroy_vm
|
||||
when: "'cloud_aws' in group_names or 'cloud_azure' in group_names"
|
||||
399
cloud/setup.yml
@@ -1,12 +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
|
||||
- workflow_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: true
|
||||
# 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
|
||||
@@ -17,12 +32,12 @@ controller_credentials:
|
||||
username: REPLACEME
|
||||
password: REPLACEME
|
||||
|
||||
#- name: Azure
|
||||
# credential_type: Microsoft Azure Resource Manager
|
||||
# organization: Default
|
||||
# update_secrets: false
|
||||
# inputs:
|
||||
# subscription: REPLACEME
|
||||
# - name: Azure
|
||||
# credential_type: Microsoft Azure Resource Manager
|
||||
# organization: Default
|
||||
# update_secrets: false
|
||||
# inputs:
|
||||
# subscription: REPLACEME
|
||||
|
||||
controller_inventory_sources:
|
||||
- name: AWS Inventory
|
||||
@@ -36,72 +51,142 @@ 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
|
||||
# source: azure_rm
|
||||
# inventory: Workshop Inventory
|
||||
# credential: Azure
|
||||
# execution_environment: Ansible Engine 2.9 execution environment
|
||||
# overwrite: true
|
||||
# source_vars:
|
||||
# hostnames:
|
||||
# - tags.Name
|
||||
# - default
|
||||
# keyed_groups:
|
||||
# - key: os_profile.system
|
||||
# prefix: os
|
||||
# conditional_groups:
|
||||
# cloud_azure: true
|
||||
# - name: Azure Inventory
|
||||
# organization: Default
|
||||
# source: azure_rm
|
||||
# inventory: Workshop Inventory
|
||||
# credential: Azure
|
||||
# execution_environment: Ansible Engine 2.9 execution environment
|
||||
# overwrite: true
|
||||
# source_vars:
|
||||
# hostnames:
|
||||
# - tags.Name
|
||||
# - default
|
||||
# keyed_groups:
|
||||
# - key: os_profile.system
|
||||
# prefix: os
|
||||
# conditional_groups:
|
||||
# cloud_azure: true
|
||||
|
||||
controller_groups:
|
||||
- name: cloud_aws
|
||||
inventory: Workshop Inventory
|
||||
variables:
|
||||
ansible_user: ec2-user
|
||||
|
||||
controller_templates:
|
||||
- name: Cloud / Create Infra
|
||||
- name: Cloud / AWS / Create Peer Infrastructure
|
||||
job_type: run
|
||||
organization: Default
|
||||
credentials:
|
||||
- AWS
|
||||
#- Azure
|
||||
project: Ansible official demo project
|
||||
playbook: cloud/create_infra.yml
|
||||
- AWS
|
||||
project: Ansible Cloud Content Lab - AWS
|
||||
playbook: playbook_create_peer_network.yml
|
||||
inventory: Workshop Inventory
|
||||
execution_environment: Default execution environment
|
||||
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 / AWS / Create VPC
|
||||
job_type: run
|
||||
organization: Default
|
||||
credentials:
|
||||
- AWS
|
||||
project: Ansible official demo project
|
||||
playbook: cloud/create_vpc.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-2
|
||||
aws_region: us-east-1
|
||||
survey:
|
||||
name: ''
|
||||
description: ''
|
||||
spec:
|
||||
- question_name: Infra Provider
|
||||
type: multiplechoice
|
||||
variable: infra_provider
|
||||
- question_name: Owner
|
||||
type: text
|
||||
variable: aws_owner_tag
|
||||
required: true
|
||||
choices:
|
||||
- aws
|
||||
#- azure
|
||||
- question_name: AWS Public Key (only required for aws provider)
|
||||
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
|
||||
credentials:
|
||||
- AWS
|
||||
- Workshop Credential
|
||||
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
|
||||
allow_simultaneous: true
|
||||
extra_vars:
|
||||
aws_region: us-east-2
|
||||
aws_region: us-east-1
|
||||
aws_keypair_name: aws-test-key
|
||||
survey:
|
||||
name: ''
|
||||
description: ''
|
||||
@@ -114,42 +199,226 @@ 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: aws-test-subnet
|
||||
- question_name: Security Group
|
||||
type: text
|
||||
variable: aws_securitygroup_name
|
||||
required: true
|
||||
default: aws-test-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
|
||||
credentials:
|
||||
- AWS
|
||||
- Workshop Credential
|
||||
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
|
||||
|
||||
controller_workflows:
|
||||
- name: Deploy Cloud Stack in AWS
|
||||
description: A workflow to deploy a cloud stack
|
||||
organization: Default
|
||||
notification_templates_started: Telemetry
|
||||
notification_templates_success: Telemetry
|
||||
notification_templates_error: Telemetry
|
||||
extra_vars:
|
||||
vm_deployment: cloud_stack
|
||||
survey_enabled: true
|
||||
survey:
|
||||
name: ''
|
||||
description: ''
|
||||
spec:
|
||||
- question_name: Owner
|
||||
type: text
|
||||
variable: aws_owner_tag
|
||||
required: true
|
||||
- question_name: Environment
|
||||
type: multiplechoice
|
||||
variable: vm_environment
|
||||
required: true
|
||||
choices:
|
||||
- Dev
|
||||
- QA
|
||||
- Prod
|
||||
- question_name: Keypair Public Key
|
||||
type: textarea
|
||||
variable: aws_public_key
|
||||
required: true
|
||||
- question_name: Email
|
||||
type: text
|
||||
variable: email
|
||||
required: true
|
||||
simplified_workflow_nodes:
|
||||
- identifier: Create Keypair
|
||||
unified_job_template: Cloud / AWS / Create Keypair
|
||||
extra_data:
|
||||
aws_keypair_owner: !unsafe "{{ aws_owner_tag }}"
|
||||
success_nodes:
|
||||
- VPC Report
|
||||
failure_nodes:
|
||||
- Ticket - Keypair Failed
|
||||
- identifier: Create VPC
|
||||
unified_job_template: Cloud / AWS / Create VPC
|
||||
success_nodes:
|
||||
- VPC Report
|
||||
failure_nodes:
|
||||
- Ticket - VPC Failed
|
||||
- identifier: Ticket - Keypair Failed
|
||||
unified_job_template: 'SUBMIT FEEDBACK'
|
||||
extra_data:
|
||||
feedback: Failed to create AWS keypair
|
||||
- identifier: VPC Report
|
||||
unified_job_template: Cloud / AWS / VPC Report
|
||||
all_parents_must_converge: true
|
||||
success_nodes:
|
||||
- Deploy Windows Blueprint
|
||||
- Deploy RHEL8 Blueprint
|
||||
- Deploy RHEL9 Blueprint
|
||||
- identifier: Deploy Windows Blueprint
|
||||
unified_job_template: Cloud / AWS / Create VM
|
||||
extra_data:
|
||||
vm_name: aws_win
|
||||
vm_blueprint: windows_full
|
||||
vm_owner: !unsafe "{{ aws_owner_tag }}"
|
||||
success_nodes:
|
||||
- Update Inventory
|
||||
failure_nodes:
|
||||
- Ticket - Instance Failed
|
||||
- identifier: Deploy RHEL8 Blueprint
|
||||
unified_job_template: Cloud / AWS / Create VM
|
||||
extra_data:
|
||||
vm_name: aws_rhel8
|
||||
vm_blueprint: rhel8
|
||||
vm_owner: !unsafe "{{ aws_owner_tag }}"
|
||||
success_nodes:
|
||||
- Update Inventory
|
||||
failure_nodes:
|
||||
- Ticket - Instance Failed
|
||||
- identifier: Deploy RHEL9 Blueprint
|
||||
unified_job_template: Cloud / AWS / Create VM
|
||||
extra_data:
|
||||
vm_name: aws_rhel9
|
||||
vm_blueprint: rhel9
|
||||
vm_owner: !unsafe "{{ aws_owner_tag }}"
|
||||
success_nodes:
|
||||
- Update Inventory
|
||||
failure_nodes:
|
||||
- Ticket - Instance Failed
|
||||
- identifier: Ticket - VPC Failed
|
||||
unified_job_template: 'SUBMIT FEEDBACK'
|
||||
extra_data:
|
||||
feedback: Failed to create AWS VPC
|
||||
- identifier: Update Inventory
|
||||
unified_job_template: AWS Inventory
|
||||
success_nodes:
|
||||
- Tag Report
|
||||
- identifier: Ticket - Instance Failed
|
||||
unified_job_template: 'SUBMIT FEEDBACK'
|
||||
extra_data:
|
||||
feedback: Failed to create AWS instance
|
||||
- identifier: Tag Report
|
||||
unified_job_template: Cloud / AWS / Tags Report
|
||||
|
||||
@@ -10,10 +10,10 @@ aws_region: us-east-1
|
||||
aws_vm_name: "{{ vm_name }}"
|
||||
aws_vm_owner: "{{ vm_owner }}"
|
||||
aws_blueprint: "{{ vm_blueprint }}"
|
||||
#aws_image_filter: "{{ omit }}"
|
||||
#aws_instance_size: "{{ omit }}"
|
||||
#aws_image_architecture: "{{ omit }}"
|
||||
#aws_image_owners: "{{ omit }} "
|
||||
# aws_image_filter: "{{ omit }}"
|
||||
# aws_instance_size: "{{ omit }}"
|
||||
# aws_image_architecture: "{{ omit }}"
|
||||
# aws_image_owners: "{{ omit }} "
|
||||
aws_userdata_template: default
|
||||
aws_keypair_name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-demo-key"
|
||||
aws_securitygroup_name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-sec-group"
|
||||
@@ -21,4 +21,3 @@ aws_env_tag: prod
|
||||
aws_purpose_tag: ansible_demo
|
||||
aws_ansiblegroup_tag: cloud
|
||||
aws_ec2_wait: true
|
||||
|
||||
|
||||
@@ -17,19 +17,19 @@
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
region: "{{ aws_region }}"
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-vpc-igw"
|
||||
Name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-vpc-igw"
|
||||
owner: "{{ aws_vpc_name }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
register: aws_gateway
|
||||
|
||||
- name: Create security group internal
|
||||
amazon.aws.ec2_group:
|
||||
amazon.aws.ec2_security_group:
|
||||
state: present
|
||||
name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-sec-group"
|
||||
name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-sec-group"
|
||||
region: "{{ aws_region }}"
|
||||
description: Inbound WinRM and RDP, http for demo servers and internal AD ports
|
||||
description: Inbound WinRM and RDP, http for demo servers and internal AD ports
|
||||
rules:
|
||||
- proto: tcp
|
||||
- proto: tcp
|
||||
ports:
|
||||
- 80 # HTTP
|
||||
- 443 # HTTPS
|
||||
@@ -42,7 +42,7 @@
|
||||
from_port: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
- proto: tcp
|
||||
ports:
|
||||
ports:
|
||||
- 80 # HTTP
|
||||
- 5986 # WinRM
|
||||
- 3389 # RDP
|
||||
@@ -55,27 +55,27 @@
|
||||
- 464 # Kerberos Authentication
|
||||
- 5432 # PostgreSQL
|
||||
- 636 # LDAPS (LDAP over TLS)
|
||||
- 873 # Rsync
|
||||
- 3268-3269 # Global Catalog
|
||||
- 873 # Rsync
|
||||
- 3268-3269 # Global Catalog
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
cidr_ip: 10.0.0.0/16
|
||||
- proto: udp
|
||||
ports:
|
||||
- proto: udp
|
||||
ports:
|
||||
- 53 # DNS
|
||||
- 88 # Kerberos Authentication
|
||||
- 123 # NTP
|
||||
- 137-138 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 137-138 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 445 # SMB
|
||||
- 464 # Kerberos Authentication
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
cidr_ip: 10.0.0.0/16
|
||||
rules_egress:
|
||||
- proto: -1
|
||||
- proto: -1
|
||||
cidr_ip: 0.0.0.0/0
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-sec-group"
|
||||
Name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-sec-group"
|
||||
owner: "{{ aws_vpc_name }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
|
||||
@@ -85,34 +85,34 @@
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
cidr: "{{ aws_subnet_cidr }}"
|
||||
region: "{{ aws_region }}"
|
||||
map_public: yes
|
||||
map_public: true
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-subnet"
|
||||
Name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-subnet"
|
||||
owner: "{{ aws_vpc_name }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
register: aws_subnet
|
||||
|
||||
- name: Create a subnet route table
|
||||
- name: Create a subnet route table
|
||||
amazon.aws.ec2_vpc_route_table:
|
||||
state: present
|
||||
state: present
|
||||
vpc_id: "{{ aws_vpc.vpc.id }}"
|
||||
region: "{{ aws_region }}"
|
||||
subnets:
|
||||
- "{{ aws_subnet.subnet.id }}"
|
||||
routes:
|
||||
- dest: 0.0.0.0/0
|
||||
- dest: 0.0.0.0/0
|
||||
gateway_id: "{{ aws_gateway.gateway_id }}"
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-vpc-rtbl"
|
||||
tags:
|
||||
Name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-vpc-rtbl"
|
||||
owner: "{{ aws_vpc_name }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
|
||||
- name: Create AWS keypair
|
||||
amazon.aws.ec2_key:
|
||||
name: "{{ aws_vpc_name }}-{{aws_vpc_prefix }}-demo-key"
|
||||
name: "{{ aws_vpc_name }}-{{ aws_vpc_prefix }}-demo-key"
|
||||
region: "{{ aws_region }}"
|
||||
key_material: "{{ aws_public_key }}"
|
||||
state: present
|
||||
tags:
|
||||
owner: "{{ aws_vpc_name }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
purpose: "{{ aws_purpose_tag }}"
|
||||
|
||||
@@ -7,27 +7,27 @@
|
||||
register: aws_subnet
|
||||
|
||||
- name: AWS | CREATE VM | save subnet id
|
||||
set_fact:
|
||||
aws_subnet_id: "{{ aws_subnet.subnets|map(attribute='id')| list | last }}"
|
||||
ansible.builtin.set_fact:
|
||||
aws_subnet_id: "{{ aws_subnet.subnets | map(attribute='id') | list | last }}"
|
||||
|
||||
- name: AWS| CREATE VM | find ami
|
||||
amazon.aws.ec2_ami_info:
|
||||
region: "{{ aws_region }}"
|
||||
owners: "{{ aws_image_owners | default(omit)}}"
|
||||
owners: "{{ aws_image_owners | default(omit) }}"
|
||||
filters:
|
||||
name: "{{ aws_image_filter }}"
|
||||
architecture: "{{ aws_image_architecture | default(omit) }}"
|
||||
register: amis
|
||||
|
||||
- name: AWS| CREATE VM | save ami
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
aws_instance_ami: >
|
||||
{{ (amis.images | selectattr('name', 'defined') | sort(attribute='creation_date'))[-2] }}
|
||||
|
||||
- name: AWS| CREATE VM | create instance
|
||||
amazon.aws.ec2_instance:
|
||||
network:
|
||||
assign_public_ip: yes
|
||||
assign_public_ip: true
|
||||
key_name: "{{ aws_keypair_name }}"
|
||||
instance_type: "{{ aws_instance_size }}"
|
||||
image_id: "{{ aws_instance_ami.image_id }}"
|
||||
@@ -43,5 +43,5 @@
|
||||
Name: "{{ aws_vm_name }}"
|
||||
wait: "{{ aws_ec2_wait }}"
|
||||
vpc_subnet_id: "{{ aws_subnet_id }}"
|
||||
user_data: "{{ lookup('template', aws_userdata_template+'.j2', template_vars=dict(aws_vm_name=vm_name)) }}"
|
||||
register: aws_vm_output
|
||||
user_data: "{{ lookup('template', aws_userdata_template + '.j2', template_vars=dict(aws_vm_name=vm_name)) }}"
|
||||
register: aws_vm_output
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
state: absent
|
||||
instance_ids: "{{ instance_id }}"
|
||||
region: "{{ placement.region }}"
|
||||
delegate_to: localhost
|
||||
delegate_to: localhost
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
##############
|
||||
# Azure Vars
|
||||
##############
|
||||
az_region: eastus
|
||||
az_rg_name: ansible
|
||||
az_rg_prefix: demo
|
||||
az_vnet_cidr_block: 10.0.0.0/16
|
||||
az_subnet_cidr: 10.0.1.0/24
|
||||
az_vm_name: "{{ vm_name }}"
|
||||
az_vm_owner: "{{ vm_owner }}"
|
||||
az_blueprint: "{{ vm_blueprint }}"
|
||||
az_vm_username: "{{ ansible_user }}"
|
||||
az_vm_password: "{{ ansible_password }}"
|
||||
az_env_tag: prod
|
||||
az_purpose_tag: ansible_demo
|
||||
az_ansiblegroup_tag: cloud
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
- name: AZURE | CREATE INFRA | resource group
|
||||
azure.azcollection.azure_rm_resourcegroup:
|
||||
name: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
location: "{{ az_region }}"
|
||||
|
||||
- name: AZURE | CREATE INFRA | virtual network
|
||||
azure.azcollection.azure_rm_virtualnetwork:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ az_rg_name }}-{{ az_rg_prefix }}-vnet"
|
||||
address_prefixes: "{{ az_vnet_cidr }}"
|
||||
|
||||
- name: AZURE | CREATE INFRA | subnet
|
||||
azure.azcollection.azure_rm_subnet:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ az_rg_name }}-{{ az_rg_prefix }}-subnet }}"
|
||||
address_prefix: "{{ az_subnet_cidr }}"
|
||||
virtual_network: "{{ az_rg_name }}-{{ az_rg_prefix }}-vnet"
|
||||
|
||||
- name: AZURE | CREATE INFRA | security group
|
||||
azure.azcollection.azure_rm_securitygroup:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ az_rg_name }}-{{ az_rg_prefix }}-sec-group"
|
||||
rules:
|
||||
- name: External
|
||||
protocol: Tcp
|
||||
destination_port_range:
|
||||
- 80 # HTTP
|
||||
- 443 # HTTPS
|
||||
- 5986 # WinRM
|
||||
- 3389 # RDP
|
||||
access: Allow
|
||||
priority: 1001
|
||||
direction: Inbound
|
||||
- name: Ping
|
||||
protocol: Icmp
|
||||
access: Allow
|
||||
priority: 1002
|
||||
direction: Inbound
|
||||
- name: Internal TCP
|
||||
protocol: Tcp
|
||||
destination_port_range:
|
||||
- 80 # HTTP
|
||||
- 5986 # WinRM
|
||||
- 3389 # RDP
|
||||
- 53 # DNS
|
||||
- 88 # Kerberos Authentication
|
||||
- 135 # RPC
|
||||
- 139 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 445 # SMB
|
||||
- 464 # Kerberos Authentication
|
||||
- 5432 # PostgreSQL
|
||||
- 636 # LDAPS (LDAP over TLS)
|
||||
- 873 # Rsync
|
||||
- 3268-3269 # Global Catalog
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
access: Allow
|
||||
priority: 1003
|
||||
direction: Inbound
|
||||
source_address_prefix: "{{ az_vnet_cidr_block }}"
|
||||
- name: Internal UDP
|
||||
protocol: Udp
|
||||
destination_port_range:
|
||||
- 53 # DNS
|
||||
- 88 # Kerberos Authentication
|
||||
- 123 # NTP
|
||||
- 137-138 # Netlogon
|
||||
- 389 # LDAP
|
||||
- 445 # SMB
|
||||
- 464 # Kerberos Authentication
|
||||
- 1024-65535 # Ephemeral RPC ports
|
||||
access: Allow
|
||||
priority: 1004
|
||||
direction: Inbound
|
||||
source_address_prefix: "{{ az_vnet_cidr_block }}"
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
- name: AZURE | CREATE VM | vnet interface
|
||||
azure.azcollection.azure_rm_networkinterface:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ az_vm_name }}_nic"
|
||||
public_ip_name: "{{ az_vm_name }}_ip"
|
||||
virtual_network: "{{ az_rg_name }}-{{ az_rg_prefix }}-vnet"
|
||||
subnet: "{{ az_rg_name }}-{{ az_rg_prefix }}-subnet }}"
|
||||
security_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-sec-group"
|
||||
|
||||
- name: AZURE | CREATE VM | vm
|
||||
azure.azcollection.azure_rm_virtualmachine:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ az_vm_name }}"
|
||||
os_type: "{{ az_vm_os_type }}"
|
||||
vm_size: "{{ az_vm_size }}"
|
||||
admin_username: "{{ az_vm_username }}"
|
||||
admin_password: "{{ az_vm_password }}"
|
||||
network_interfaces: "{{ az_vm_name }}_nic"
|
||||
image: "{{ az_vm_image }}"
|
||||
tags:
|
||||
blueprint: "{{ az_blueprint }}"
|
||||
purpose: "{{ az_purpose_tag }}"
|
||||
env: "{{ az_env_tag }}"
|
||||
ansible_group: "{{ az_ansiblegroup_tag }}"
|
||||
owner: "{{ az_vm_owner }}"
|
||||
info: "This instance was built by Red Hat Product Demos"
|
||||
Name: "{{ az_vm_name }}"
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
- name: Destroy VM
|
||||
azure.azcollection.azure_rm_virtualmachine:
|
||||
resource_group: "{{ az_rg_name }}-{{ az_rg_prefix }}-rg"
|
||||
name: "{{ inventory_hostname }}"
|
||||
state: absent
|
||||
remove_on_absent: all_autocreated
|
||||
delegate_to: localhost
|
||||
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 168 KiB |
@@ -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;
|
||||
}
|
||||
@@ -1,24 +1,36 @@
|
||||
- name: create HTML report
|
||||
- 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"
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: copy CSS over
|
||||
- name: Copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- name: copy logos over
|
||||
- name: Copy logos over
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
src: "{{ item }}"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "router.png"
|
||||
check_mode: false
|
||||
|
||||
- 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"
|
||||
|
||||
@@ -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 -->
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<div class="wrapper">
|
||||
<header>
|
||||
<div class="header-container">
|
||||
@@ -12,4 +10,4 @@
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 -->
|
||||
@@ -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>
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
---
|
||||
detailedreport: True
|
||||
detailedreport: true
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
- name: create HTML report
|
||||
- name: Create HTML report
|
||||
ansible.builtin.template:
|
||||
src: report.j2
|
||||
dest: "{{ file_path }}/windows.html"
|
||||
mode: "0644"
|
||||
|
||||
- name: copy CSS over
|
||||
- name: Copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
mode: "0755"
|
||||
|
||||
- name: copy logos over
|
||||
- name: Copy logos over
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
src: "{{ item }}"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "server.png"
|
||||
|
||||
- name: display link to inventory report
|
||||
- name: Display link to inventory report
|
||||
ansible.builtin.debug:
|
||||
msg: "Please go to http://{{ ansible_host }}/windows.html"
|
||||
msg: "Please go to http://{{ ansible_host }}/windows.html"
|
||||
|
||||
@@ -1 +1 @@
|
||||
file_path: /var/www/html
|
||||
file_path: /var/www/html
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EMAIL_FROM: tower@shadowman.dev
|
||||
email_from: tower@shadowman.dev
|
||||
to_emails: alex@shadowman.dev,tower@shadowman.dev
|
||||
EMAIL_TO: "{{ to_emails.split(',') }}"
|
||||
to_emails_list: "{{ to_emails.split(',') }}"
|
||||
|
||||
@@ -2,37 +2,25 @@
|
||||
ansible.builtin.template:
|
||||
src: report.j2
|
||||
dest: "{{ file_path }}/windowspatch.html"
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy logo over
|
||||
ansible.builtin.copy:
|
||||
src: "webpage_logo.png"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: Display link to Patch report
|
||||
ansible.builtin.debug:
|
||||
msg: "Please go to http://{{ ansible_host }}/windowspatch.html"
|
||||
|
||||
- name: Send Report via E-mail
|
||||
community.general.mail:
|
||||
host: "{{ EMAIL_HOST }}"
|
||||
username: "{{ EMAIL_USERNAME }}"
|
||||
password: "{{ EMAIL_PASSWORD }}"
|
||||
port: "{{ EMAIL_PORT }}"
|
||||
subject: "Windows Patching Report"
|
||||
body: "{{ lookup('template', 'report.j2') }}"
|
||||
from: "{{ EMAIL_FROM }}"
|
||||
to: "{{ EMAIL_TO }}"
|
||||
subtype: html
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
check_mode: no
|
||||
@@ -1 +1 @@
|
||||
file_path: /var/www/html
|
||||
file_path: /var/www/html
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
---
|
||||
exclude_packages: []
|
||||
allow_reboot: true
|
||||
allow_reboot: true
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
---
|
||||
- name: Scan packages
|
||||
demo.patching.scan_packages:
|
||||
os_family: "{{ ansible_os_family }}"
|
||||
check_mode: no
|
||||
- name: Get packages
|
||||
ansible.builtin.package_facts:
|
||||
check_mode: false
|
||||
|
||||
- name: Scan services
|
||||
demo.patching.scan_services:
|
||||
check_mode: no
|
||||
- name: Get services
|
||||
ansible.builtin.service_facts:
|
||||
check_mode: false
|
||||
|
||||
- name: upgrade packages (yum)
|
||||
yum:
|
||||
- name: Upgrade packages (yum)
|
||||
ansible.builtin.yum:
|
||||
name: '*'
|
||||
state: latest
|
||||
state: latest # noqa: package-latest - Intended to update packages to latest
|
||||
exclude: "{{ exclude_packages }}"
|
||||
when: ansible_pkg_mgr == "yum"
|
||||
register: patchingresult_yum
|
||||
|
||||
- name: upgrade packages (dnf)
|
||||
- name: Upgrade packages (dnf)
|
||||
ansible.builtin.dnf:
|
||||
name: '*'
|
||||
state: latest
|
||||
state: latest # noqa: package-latest - Intended to update packages to latest
|
||||
exclude: "{{ exclude_packages }}"
|
||||
when: ansible_pkg_mgr == "dnf"
|
||||
register: patchingresult_dnf
|
||||
@@ -29,10 +28,10 @@
|
||||
register: result
|
||||
changed_when: result.rc == 1
|
||||
failed_when: result.rc > 1
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Reboot Server if Necessary
|
||||
ansible.builtin.reboot:
|
||||
when:
|
||||
- result.rc == 1
|
||||
- allow_reboot == true
|
||||
- result.rc == 1
|
||||
- allow_reboot
|
||||
|
||||
@@ -11,4 +11,4 @@ win_update_categories:
|
||||
- Tools
|
||||
- UpdateRollups
|
||||
- Updates
|
||||
allow_reboot: true
|
||||
allow_reboot: true
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
- name: Scan packages
|
||||
demo.patching.win_scan_packages:
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Scan Services
|
||||
demo.patching.win_scan_services:
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Install Windows Updates
|
||||
ansible.windows.win_updates:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
---
|
||||
detailedreport: True
|
||||
detailedreport: true
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
- name: create HTML report
|
||||
- name: Create HTML report
|
||||
ansible.builtin.template:
|
||||
src: report.j2
|
||||
dest: "{{ file_path }}/linux.html"
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: copy CSS over
|
||||
- name: Copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- name: copy logos over
|
||||
- name: Copy logos over
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
src: "{{ item }}"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "server.png"
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: display link to inventory report
|
||||
- name: Display link to inventory report
|
||||
ansible.builtin.debug:
|
||||
msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/linux.html"
|
||||
|
||||
@@ -1 +1 @@
|
||||
file_path: /var/www/html/reports
|
||||
file_path: /var/www/html/reports
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EMAIL_FROM: tower@shadowman.dev
|
||||
email_from: tower@shadowman.dev
|
||||
to_emails: alex@shadowman.dev,tower@shadowman.dev
|
||||
EMAIL_TO: "{{ to_emails.split(',') }}"
|
||||
to_emails_list: "{{ to_emails.split(',') }}"
|
||||
|
||||
@@ -2,38 +2,41 @@
|
||||
ansible.builtin.template:
|
||||
src: report.j2
|
||||
dest: "{{ file_path }}/linuxpatch.html"
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy CSS over
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy logo over
|
||||
ansible.builtin.copy:
|
||||
src: "webpage_logo.png"
|
||||
dest: "{{ file_path }}"
|
||||
directory_mode: true
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: Display link to Linux patch report
|
||||
ansible.builtin.debug:
|
||||
msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/linuxpatch.html"
|
||||
|
||||
|
||||
#- name: Send Report via E-mail
|
||||
# community.general.mail:
|
||||
# host: "{{ EMAIL_HOST }}"
|
||||
# username: "{{ EMAIL_USERNAME }}"
|
||||
# password: "{{ EMAIL_PASSWORD }}"
|
||||
# port: "{{ EMAIL_PORT }}"
|
||||
# subject: "Linux Patching Report"
|
||||
# body: "{{ lookup('template', 'report.j2') }}"
|
||||
# from: "{{ EMAIL_FROM }}"
|
||||
# to: "{{ EMAIL_TO }}"
|
||||
# subtype: html
|
||||
# delegate_to: localhost
|
||||
# become: false
|
||||
# check_mode: no
|
||||
# - name: Send Report via E-mail
|
||||
# community.general.mail:
|
||||
# host: "{{ EMAIL_HOST }}"
|
||||
# username: "{{ EMAIL_USERNAME }}"
|
||||
# password: "{{ EMAIL_PASSWORD }}"
|
||||
# port: "{{ EMAIL_PORT }}"
|
||||
# subject: "Linux Patching Report"
|
||||
# body: "{{ lookup('template', 'report.j2') }}"
|
||||
# from: "{{ EMAIL_FROM }}"
|
||||
# to: "{{ EMAIL_TO }}"
|
||||
# subtype: html
|
||||
# delegate_to: localhost
|
||||
# become: false
|
||||
# check_mode: no
|
||||
|
||||
@@ -1 +1 @@
|
||||
file_path: /var/www/html/reports
|
||||
file_path: /var/www/html/reports
|
||||
|
||||
@@ -29,7 +29,7 @@ p.hostname {
|
||||
}
|
||||
|
||||
a {
|
||||
color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -199,4 +199,4 @@ table.net_info {
|
||||
|
||||
p.internal_label {
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
@@ -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 |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 45 KiB |
@@ -1,20 +1,29 @@
|
||||
---
|
||||
- yum:
|
||||
- name: Inlcude system variables
|
||||
ansible.builtin.include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: Install httpd package
|
||||
ansible.builtin.yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
check_mode: no
|
||||
state: installed
|
||||
check_mode: false
|
||||
|
||||
- file:
|
||||
path: /var/www/html/reports/
|
||||
- name: Create reports directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ doc_root }}/{{ reports_dir }}"
|
||||
state: directory
|
||||
check_mode: no
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- copy:
|
||||
dest: /var/www/html/reports/.htaccess
|
||||
- name: Copy .htaccess
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ doc_root }}/{{ reports_dir }}/.htaccess"
|
||||
content: Options +Indexes
|
||||
check_mode: no
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- service:
|
||||
- name: Install httpd service
|
||||
ansible.builtin.service:
|
||||
name: httpd
|
||||
state: started
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
---
|
||||
- name: Include system vars
|
||||
ansible.builtin.include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: Install IIS
|
||||
ansible.windows.win_feature:
|
||||
name: Web-Server
|
||||
state: present
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Start IIS service
|
||||
ansible.windows.win_service:
|
||||
name: W3Svc
|
||||
state: started
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- name: Create Directory
|
||||
ansible.windows.win_file:
|
||||
path: C:\Inetpub\wwwroot\reports
|
||||
path: "{{ doc_root }}\\{{ reports_dir }}"
|
||||
state: directory
|
||||
check_mode: no
|
||||
check_mode: false
|
||||
|
||||
- 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'"
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Include system vars
|
||||
ansible.builtin.include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: Get reports
|
||||
ansible.builtin.find:
|
||||
paths: "{{ doc_root }}/{{ reports_dir }}"
|
||||
patterns: '*.html'
|
||||
register: reports
|
||||
check_mode: false
|
||||
|
||||
- name: Publish landing page
|
||||
ansible.builtin.template:
|
||||
src: linux_report.j2
|
||||
dest: "{{ doc_root }}/index.html"
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy CSS
|
||||
ansible.builtin.copy:
|
||||
src: "css"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
mode: "0775"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy logos
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
mode: "0775"
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "report.png"
|
||||
check_mode: false
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Include Linux tasks
|
||||
ansible.builtin.include_tasks: apache.yml
|
||||
when: ansible_system == 'Linux'
|
||||
|
||||
- name: Include Windows tasks
|
||||
ansible.builtin.include_tasks: iis.yml
|
||||
when: ansible_system == 'Win32NT'
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
- name: Include system variables
|
||||
ansible.builtin.include_vars: "{{ ansible_system }}.yml"
|
||||
|
||||
- name: Get reports
|
||||
ansible.windows.win_find:
|
||||
paths: "{{ doc_root }}/{{ reports_dir }}"
|
||||
patterns: '*.html'
|
||||
register: reports
|
||||
check_mode: false
|
||||
|
||||
- name: Publish landing page
|
||||
ansible.windows.win_template:
|
||||
src: windows_report.j2
|
||||
dest: "{{ doc_root }}/index.html"
|
||||
check_mode: false
|
||||
|
||||
- name: Copy CSS
|
||||
ansible.windows.win_copy:
|
||||
src: "css"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
check_mode: false
|
||||
|
||||
- name: Copy logos
|
||||
ansible.windows.win_copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ doc_root }}"
|
||||
directory_mode: true
|
||||
loop:
|
||||
- "webpage_logo.png"
|
||||
- "redhat-ansible-logo.svg"
|
||||
- "report.png"
|
||||
check_mode: false
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
doc_root: /var/www/html
|
||||
reports_dir: reports
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
doc_root: C:\Inetpub\wwwroot
|
||||
reports_dir: reports
|
||||
@@ -1,2 +1,2 @@
|
||||
---
|
||||
detailedreport: True
|
||||
detailedreport: true
|
||||
|
||||