diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml deleted file mode 100644 index a0bc47d..0000000 --- a/.github/linters/.markdown-lint.yml +++ /dev/null @@ -1,6 +0,0 @@ -{ - "default": true, - "MD003": false, - "MD013": false, - "MD033": false -} \ No newline at end of file diff --git a/.github/linters/ansible-lint.yml b/.github/linters/ansible-lint.yml deleted file mode 100644 index 1339519..0000000 --- a/.github/linters/ansible-lint.yml +++ /dev/null @@ -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 diff --git a/.github/linters/markdown-lint.yml b/.github/linters/markdown-lint.yml deleted file mode 100644 index 89963f4..0000000 --- a/.github/linters/markdown-lint.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -########################### -########################### -## Markdown Linter rules ## -########################### -########################### - -# Linter rules doc: -# - https://github.com/DavidAnson/markdownlint -# -# Note: -# To comment out a single error: -# -# any violations you want -# -# - -############### -# 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 diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml new file mode 100644 index 0000000..b0e4d28 --- /dev/null +++ b/.github/workflows/ansible-lint.yml @@ -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 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml.old similarity index 100% rename from .github/workflows/linter.yml rename to .github/workflows/linter.yml.old diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ba6ee68 --- /dev/null +++ b/CONTRIBUTING.md @@ -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 `/setup.yml`. +- PRs should include documentation in corresponding `/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 `) +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 diff --git a/README.md b/README.md index d490a3b..665c9da 100644 --- a/README.md +++ b/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. - -[![GitHub Super-Linter](https://github.com/ansible/ansible-demos/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter) - +If you would like to contribute to this project please refer to [contribution guide](CONTRIBUTING.md) for best practices. ## Using this project - > This project is tested for compatibility with AAP2 Linux Automation Workshop available to Red Hat Employees and Partners. + > This project is tested for compatibility with AAP2 Linux Automation Workshop available to Red Hat Employees and Partners. To use with other Ansible Controller installations, review the [pre-requisite documentation](https://github.com/RedHatGov/ansible-tower-samples/tree/product-demos). 1. First you must create a credential for [Automation Hub](https://console.redhat.com/ansible/automation-hub/) to successfully sync collections used by this project. @@ -40,6 +36,4 @@ Please push contributions via a pull request following the naming convention of - Name: Controller Credential - Extra vars: - demo: - -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. \ No newline at end of file + demo: diff --git a/aap-on-crc/.github/linters/.markdown-lint.yml b/aap-on-crc/.github/linters/.markdown-lint.yml deleted file mode 100644 index a0bc47d..0000000 --- a/aap-on-crc/.github/linters/.markdown-lint.yml +++ /dev/null @@ -1,6 +0,0 @@ -{ - "default": true, - "MD003": false, - "MD013": false, - "MD033": false -} \ No newline at end of file diff --git a/aap-on-crc/.github/workflows/linter.yml b/aap-on-crc/.github/workflows/linter.yml deleted file mode 100644 index 592937a..0000000 --- a/aap-on-crc/.github/workflows/linter.yml +++ /dev/null @@ -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 }} diff --git a/aap-on-crc/README.md b/aap-on-crc/README.md deleted file mode 100644 index 169c89a..0000000 --- a/aap-on-crc/README.md +++ /dev/null @@ -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. - -![pull_secret](images/pull_secret.png) - -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``` ) - - ![crc_login](images/crc_login.png) - ---- - -## Once logged into the CRC/Openshift local instance click on OperatorHub on the left - - ![choose_operators](images/choose_operators.png) - ---- - -### Type Ansible into the filter window and choose Ansible Automation Platform - - ![choose_aap](images/choose_aap.png) - ---- - -## Click install - - ![click_install](images/click_install.png) - ---- - -## Allow all the defaults and click install again - - ![all_defaults](images/all_defaults.png) - ---- - -## Once it is installed click view operator - - ![view_operator](images/view_oper.png) - ---- - -## Click Create Instance in the Automation Controller box (third from left) - - ![create_controller](images/create_controller.png) - ---- - -## Click Create (you can rename to whatever you want default is example) - - ![create_example](images/create-example.png) - ---- - -## Click on instance you created - - ![click on instance](images/click_instance.png) - ---- - -## Loging to AAP console (click on URL link on right. The password is in the Admin Password link below the URL) - - ![aap_login](images/login_aap.png) - -## 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. - - ![subscription](images/subscription.png) - -## Select the subscription (then next, next, submit) - - ![select_sub](images/select_sub.png) - -Now you have a fully functional AAP instance to test with. - - ![aap_dashboard](images/aap_dash.png) - ---- - -## 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: - -![pod_failure](images/podfailure.png) - -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) - -![resources](images/resources.png) - -Change to 500 millicores and 1mib like below: - -![resources2](images/resources2.png) diff --git a/aap-on-crc/images/aap_dash.png b/aap-on-crc/images/aap_dash.png deleted file mode 100644 index 447474c..0000000 Binary files a/aap-on-crc/images/aap_dash.png and /dev/null differ diff --git a/aap-on-crc/images/all_defaults.png b/aap-on-crc/images/all_defaults.png deleted file mode 100644 index 84b6a92..0000000 Binary files a/aap-on-crc/images/all_defaults.png and /dev/null differ diff --git a/aap-on-crc/images/choose_aap.png b/aap-on-crc/images/choose_aap.png deleted file mode 100644 index 64718cb..0000000 Binary files a/aap-on-crc/images/choose_aap.png and /dev/null differ diff --git a/aap-on-crc/images/choose_operators.png b/aap-on-crc/images/choose_operators.png deleted file mode 100644 index 6e13d05..0000000 Binary files a/aap-on-crc/images/choose_operators.png and /dev/null differ diff --git a/aap-on-crc/images/click_install.png b/aap-on-crc/images/click_install.png deleted file mode 100644 index 2eb04e2..0000000 Binary files a/aap-on-crc/images/click_install.png and /dev/null differ diff --git a/aap-on-crc/images/click_instance.png b/aap-on-crc/images/click_instance.png deleted file mode 100644 index 19fbf3d..0000000 Binary files a/aap-on-crc/images/click_instance.png and /dev/null differ diff --git a/aap-on-crc/images/crc_login.png b/aap-on-crc/images/crc_login.png deleted file mode 100644 index 34b0efe..0000000 Binary files a/aap-on-crc/images/crc_login.png and /dev/null differ diff --git a/aap-on-crc/images/create-example.png b/aap-on-crc/images/create-example.png deleted file mode 100644 index 7ee3d91..0000000 Binary files a/aap-on-crc/images/create-example.png and /dev/null differ diff --git a/aap-on-crc/images/create_controller.png b/aap-on-crc/images/create_controller.png deleted file mode 100644 index d260639..0000000 Binary files a/aap-on-crc/images/create_controller.png and /dev/null differ diff --git a/aap-on-crc/images/instance.png b/aap-on-crc/images/instance.png deleted file mode 100644 index bee400e..0000000 Binary files a/aap-on-crc/images/instance.png and /dev/null differ diff --git a/aap-on-crc/images/login_aap.png b/aap-on-crc/images/login_aap.png deleted file mode 100644 index 67f1845..0000000 Binary files a/aap-on-crc/images/login_aap.png and /dev/null differ diff --git a/aap-on-crc/images/podfailure.png b/aap-on-crc/images/podfailure.png deleted file mode 100644 index 3b79d01..0000000 Binary files a/aap-on-crc/images/podfailure.png and /dev/null differ diff --git a/aap-on-crc/images/pull_secret.png b/aap-on-crc/images/pull_secret.png deleted file mode 100644 index 813aa20..0000000 Binary files a/aap-on-crc/images/pull_secret.png and /dev/null differ diff --git a/aap-on-crc/images/resources.png b/aap-on-crc/images/resources.png deleted file mode 100644 index 75e7d83..0000000 Binary files a/aap-on-crc/images/resources.png and /dev/null differ diff --git a/aap-on-crc/images/resources2.png b/aap-on-crc/images/resources2.png deleted file mode 100644 index b688fd1..0000000 Binary files a/aap-on-crc/images/resources2.png and /dev/null differ diff --git a/aap-on-crc/images/select_sub.png b/aap-on-crc/images/select_sub.png deleted file mode 100644 index ac3d886..0000000 Binary files a/aap-on-crc/images/select_sub.png and /dev/null differ diff --git a/aap-on-crc/images/spec_update.png b/aap-on-crc/images/spec_update.png deleted file mode 100644 index b1bc2db..0000000 Binary files a/aap-on-crc/images/spec_update.png and /dev/null differ diff --git a/aap-on-crc/images/subscription.png b/aap-on-crc/images/subscription.png deleted file mode 100644 index 8444c48..0000000 Binary files a/aap-on-crc/images/subscription.png and /dev/null differ diff --git a/aap-on-crc/images/view_oper.png b/aap-on-crc/images/view_oper.png deleted file mode 100644 index 60be825..0000000 Binary files a/aap-on-crc/images/view_oper.png and /dev/null differ diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..5bd4066 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +collections_paths=./collections +roles_path=./roles diff --git a/azure/setup.yml b/azure/setup.yml deleted file mode 100644 index 7e434f7..0000000 --- a/azure/setup.yml +++ /dev/null @@ -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" diff --git a/cloud/aws_key.yml b/cloud/aws_key.yml new file mode 100644 index 0000000..82e1802 --- /dev/null +++ b/cloud/aws_key.yml @@ -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 }}" diff --git a/cloud/blueprints/rhel7.yml b/cloud/blueprints/rhel7.yml index 8739d89..15a9ac7 100644 --- a/cloud/blueprints/rhel7.yml +++ b/cloud/blueprints/rhel7.yml @@ -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*' \ No newline at end of file +aws_image_filter: 'RHEL-7.9_HVM*' diff --git a/cloud/blueprints/rhel8.yml b/cloud/blueprints/rhel8.yml index cb94a93..56301f4 100644 --- a/cloud/blueprints/rhel8.yml +++ b/cloud/blueprints/rhel8.yml @@ -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*' \ No newline at end of file +aws_image_filter: 'RHEL-8*HVM-*Hourly*' diff --git a/cloud/blueprints/rhel9.yml b/cloud/blueprints/rhel9.yml new file mode 100644 index 0000000..edad985 --- /dev/null +++ b/cloud/blueprints/rhel9.yml @@ -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*' diff --git a/cloud/blueprints/windows.yml b/cloud/blueprints/windows.yml index d70ca69..df4da7c 100644 --- a/cloud/blueprints/windows.yml +++ b/cloud/blueprints/windows.yml @@ -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 \ No newline at end of file + version: latest diff --git a/cloud/blueprints/windows_core.yml b/cloud/blueprints/windows_core.yml index 2c000f5..305500f 100644 --- a/cloud/blueprints/windows_core.yml +++ b/cloud/blueprints/windows_core.yml @@ -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 \ No newline at end of file +aws_userdata_template: aws_windows_userdata diff --git a/cloud/blueprints/windows_full.yml b/cloud/blueprints/windows_full.yml index 92546f5..1862a24 100644 --- a/cloud/blueprints/windows_full.yml +++ b/cloud/blueprints/windows_full.yml @@ -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 \ No newline at end of file +aws_userdata_template: aws_windows_userdata diff --git a/cloud/create_infra.yml b/cloud/create_infra.yml index 1f48725..85797dc 100644 --- a/cloud/create_infra.yml +++ b/cloud/create_infra.yml @@ -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 diff --git a/cloud/create_vm.yml b/cloud/create_vm.yml index 9e1836b..941fddc 100644 --- a/cloud/create_vm.yml +++ b/cloud/create_vm.yml @@ -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 \ No newline at end of file + - name: "Building {{ vm_blueprint | upper }}" + ansible.builtin.include_role: + name: "demo.cloud.{{ vm_provider }}" + tasks_from: create_vm diff --git a/cloud/create_vpc.yml b/cloud/create_vpc.yml new file mode 100644 index 0000000..bb6005c --- /dev/null +++ b/cloud/create_vpc.yml @@ -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 }}" diff --git a/cloud/destroy_vm.yml b/cloud/destroy_vm.yml deleted file mode 100644 index fe73c58..0000000 --- a/cloud/destroy_vm.yml +++ /dev/null @@ -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" diff --git a/cloud/setup.yml b/cloud/setup.yml index dc61b61..cc7ba11 100644 --- a/cloud/setup.yml +++ b/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 diff --git a/collections/ansible_collections/demo/cloud/roles/aws/defaults/main.yml b/collections/ansible_collections/demo/cloud/roles/aws/defaults/main.yml index 997346e..b152f7e 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/defaults/main.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/defaults/main.yml @@ -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 - diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_infra.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_infra.yml index 510aed5..04ce474 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_infra.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_infra.yml @@ -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 }}" \ No newline at end of file + purpose: "{{ aws_purpose_tag }}" diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml index 9c3a781..61e4779 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/create_vm.yml @@ -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 \ No newline at end of file + user_data: "{{ lookup('template', aws_userdata_template + '.j2', template_vars=dict(aws_vm_name=vm_name)) }}" + register: aws_vm_output diff --git a/collections/ansible_collections/demo/cloud/roles/aws/tasks/destroy_vm.yml b/collections/ansible_collections/demo/cloud/roles/aws/tasks/destroy_vm.yml index 7b5093b..ad31142 100644 --- a/collections/ansible_collections/demo/cloud/roles/aws/tasks/destroy_vm.yml +++ b/collections/ansible_collections/demo/cloud/roles/aws/tasks/destroy_vm.yml @@ -4,4 +4,4 @@ state: absent instance_ids: "{{ instance_id }}" region: "{{ placement.region }}" - delegate_to: localhost \ No newline at end of file + delegate_to: localhost diff --git a/collections/ansible_collections/demo/cloud/roles/azure/defaults/main.yml b/collections/ansible_collections/demo/cloud/roles/azure/defaults/main.yml deleted file mode 100644 index 085623d..0000000 --- a/collections/ansible_collections/demo/cloud/roles/azure/defaults/main.yml +++ /dev/null @@ -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 diff --git a/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_infra.yml b/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_infra.yml deleted file mode 100644 index c7f5804..0000000 --- a/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_infra.yml +++ /dev/null @@ -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 }}" \ No newline at end of file diff --git a/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_vm.yml b/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_vm.yml deleted file mode 100644 index 560bdc2..0000000 --- a/collections/ansible_collections/demo/cloud/roles/azure/tasks/create_vm.yml +++ /dev/null @@ -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 }}" diff --git a/collections/ansible_collections/demo/cloud/roles/azure/tasks/destroy_vm.yml b/collections/ansible_collections/demo/cloud/roles/azure/tasks/destroy_vm.yml deleted file mode 100644 index 9be4644..0000000 --- a/collections/ansible_collections/demo/cloud/roles/azure/tasks/destroy_vm.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png b/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png index d766491..2cfac3a 100644 Binary files a/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png and b/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png differ diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css b/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css new file mode 100644 index 0000000..d978eb3 --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css @@ -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; +} diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml b/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml index accaeba..882f641 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml @@ -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" \ No newline at end of file +# - name: Display link to Linux patch report +# ansible.builtin.debug: +# msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/network.html" diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 new file mode 100644 index 0000000..01386bf --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 @@ -0,0 +1,41 @@ + +
+
+

Ansible Automation Info

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ansible user{{ hostvars[network_switch]['ansible_user'] }}
Transport{% set ansible_connection = hostvars[network_switch]['ansible_net_api'] %}{{ transport[ansible_connection] }}
Ansible Mgmt IP{{ hostvars[network_switch]['ansible_host'] | default('N/A') }}
Ansible groups{% for group in hostvars[network_switch]['group_names'] %}{{ group }} {% endfor %}
Ansible core version{% for group in hostvars[network_switch]['ansible_version']['string']|default("Unknown") %}{{ group }} {% endfor %}
Ansible Python{{ hostvars[network_switch]['ansible_playbook_python']|default("Unknown") }}
Python version{{ hostvars[network_switch]['ansible_net_python_version']|default("Unknown") }}
+
+
+
+ diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp.j2 index d6b0f67..97d1b5a 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp.j2 @@ -1,25 +1,46 @@ - +
-
- - - \ No newline at end of file + diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp_address_family.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp_address_family.j2 new file mode 100644 index 0000000..94686a7 --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/bgp_address_family.j2 @@ -0,0 +1,46 @@ + +
+
+

BGP Address Family

+
+{% 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'] %} +

Address Family {{ address_family['afi'] }}

+ + + + + + + + + {% if hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']['networks'] is defined %} + {% for bgp_network in address_family['networks'] %} + + + + {% endfor %} + {% elif hostvars[network_switch]['ansible_network_resources']['bgp_address_family']['address_family']['network'] is defined %} + {% for bgp_network in address_family['network'] %} + + + + + {% endfor %} + {% else %} + No BGP networks information available + {% endif %} + +
Network
{{ bgp_network['prefix']|default("Not Configured") }}
{{ bgp_network['address']|default("Not Configured") }}{{ bgp_network['mask']|default("Not Configured") }}
+{% 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 %} +
+
+
+ diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/header.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/header.j2 index 6d504d0..25265ce 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/header.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/header.j2 @@ -1,5 +1,3 @@ - -
@@ -12,4 +10,4 @@ />
-
\ No newline at end of file + diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/interfaces.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/interfaces.j2 index bf13414..ef80194 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/interfaces.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/interfaces.j2 @@ -1,10 +1,8 @@ - +
-
- - - \ No newline at end of file + diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/lldp_interfaces.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/lldp_interfaces.j2 index 3ad0852..6e4393a 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/lldp_interfaces.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/lldp_interfaces.j2 @@ -1,9 +1,9 @@ - +
-
- - - \ No newline at end of file + diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ospf.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ospf.j2 index d06ff5b..25ce225 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ospf.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ospf.j2 @@ -1,8 +1,8 @@ - +
-
- - - \ No newline at end of file + diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/report.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/report.j2 index f00eac7..c2e55e1 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/report.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/report.j2 @@ -1,13 +1,12 @@ - Ansible Network Automation Report + Network Automation Report - - - - + + + - -
{% include 'header.j2' %}
-

Ansible Network Automation Report

-

+

Ansible Network Automation Example Report

- +
@@ -75,35 +33,71 @@ collapsible: true -{% 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 %} - - - - +

picture of network device{{ hostvars[network_switch].ansible_net_hostname }}

+ +
+
Network Device
-

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

-
-{% include 'summary.j2' %} -
-{% include 'interfaces.j2' %} - -{% include 'vlans.j2' %} -{% include 'lldp_interfaces.j2' %} -{% include 'l2_interfaces.j2' %} - -{% include 'l3_interfaces.j2' %} -{% include 'lacp.j2' %} -{% include 'bgp.j2' %} -{% include 'ospf.j2' %} -
+ + + + + + + + + + + + + + + + + + +
Platform{% set ansible_network_os = hostvars[network_switch]['ansible_net_system'] %}{{ vendor[ansible_network_os]}} {{hostvars[network_switch]['ansible_net_system'] }}
Code Version{{ hostvars[network_switch]['ansible_net_version'] }}
Model{{ hostvars[network_switch]['ansible_net_model'] }}
Serial Number{{ hostvars[network_switch]['ansible_net_serialnum'] | default('N/A') }}
+ + + {% include 'ansible.j2' %} +
+ + + + + + + {% include 'interfaces.j2' %} + + + {% include 'vlans.j2' %} + {% include 'lldp_interfaces.j2' %} + {% include 'l2_interfaces.j2' %} + + + {% include 'l3_interfaces.j2' %} + {% include 'lacp.j2' %} + {% include 'static.j2' %} + {% include 'bgp.j2' %} + {% include 'bgp_address_family.j2' %} + {% include 'ospf.j2' %} + +{% endif %} {% endfor %} -

Created with


+

Created with


red hat ansible automation platform logo +

The source code to create this report can be found at https://github.com/network-automation/toolkit

+If you are new to Ansible Automation check out the following links:
+Getting Started
+Free hands-on workshops
+Youtube Videos
+

diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/static.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/static.j2 new file mode 100644 index 0000000..33ce549 --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/static.j2 @@ -0,0 +1,45 @@ + +
+
+

Static Routes

+
+{% if hostvars[network_switch]['ansible_network_resources']['static_routes'] is defined and hostvars[network_switch]['ansible_network_resources']['static_routes']|length > 0 %} + + + + + + + + + + + + +{% for net_route in hostvars[network_switch]['ansible_network_resources']['static_routes'] %} + + +{% for address_family in net_route.address_families|default([]) %} + +{% for routes in address_family['routes'] %} + +{% for next_hops in routes['next_hops'] %} + + + +{% endfor %} +{% endfor %} +{% endfor %} + +{% endfor %} + +
VRFAddress-FamilyRouteInterfaceNext-Hop AddressGlobal
{{ net_route['vrf']|default("N/A") }}{{ address_family['afi'] }}{{ routes['dest'] }}{{ next_hops['interface']|default("N/A") }}{{ next_hops['forward_router_address']|default("N/A") }}{{ next_hops['global']|default("N/A") }}
+{% 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 %} +
+
+
+ diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/summary.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/summary.j2 deleted file mode 100644 index 5f643e4..0000000 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/summary.j2 +++ /dev/null @@ -1,25 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - -
Platform{{hostvars[network_switch]['ansible_net_system']}}
Code Version{{hostvars[network_switch]['ansible_net_version']}}
Model{{hostvars[network_switch]['ansible_net_model']|default("N/A")}}
Serial Number{{hostvars[network_switch]['ansible_net_serialnum']}}
Transport{{hostvars[network_switch]['ansible_net_api']}}
-
diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/vlans.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/vlans.j2 index 044a334..a01d56c 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/vlans.j2 +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/vlans.j2 @@ -1,8 +1,8 @@ - +
-
- -