4 Commits

Author SHA1 Message Date
matt
b5399283a1 try this 2025-07-11 16:06:24 -06:00
matt
b9054543cb syntax issue 2025-07-11 16:03:16 -06:00
matt
beb47d4f8e attempt to fix annoying snapshot/inventory sync issue with CNV 2025-07-11 16:00:06 -06:00
Chris Edillon
a7b79faf34 Refer to bootstrap repo for initial APD setup (#257) 2025-07-09 13:07:17 -06:00
8 changed files with 42 additions and 280 deletions

View File

@@ -1,6 +1,6 @@
# GitHub Actions # GitHub Actions
## Background ## Background
We want to make attempts to run our integration tests in the same manner wether using GitHub actions or on a developers's machine locally. For this reason, the tests are curated to run using conatiner images. As of this writing, two images exist which we would like to test against: We want to make attempts to run our integration tests in the same manner wether using GitHub actions or on a developers's machine locally. For this reason, the tests are curated to run using container images. As of this writing, two images exist which we would like to test against:
- quay.io/ansible-product-demos/apd-ee-24:latest - quay.io/ansible-product-demos/apd-ee-24:latest
- quay.io/ansible-product-demos/apd-ee-25:latest - quay.io/ansible-product-demos/apd-ee-25:latest

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ roles/*
.cache/ .cache/
.ansible/ .ansible/
**/tmp/ **/tmp/
execution_environments/context/

View File

@@ -1,10 +1,9 @@
[![Lab](https://img.shields.io/badge/Try%20Me-EE0000?style=for-the-badge&logo=redhat&logoColor=white)](https://red.ht/aap-product-demos)
[![Dev Spaces](https://img.shields.io/badge/Customize%20Here-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white)](https://workspaces.openshift.com/f?url=https://github.com/ansible/product-demos)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Dev Spaces](https://img.shields.io/badge/Customize%20Here-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white)](https://workspaces.openshift.com/f?url=https://github.com/ansible/product-demos)
# Official Ansible Product Demos # APD - Ansible Product Demos
This is a centralized location for Ansible Product Demos. This project is a collection of use cases implemented with Ansible for use with the [Ansible Automation Platform](https://www.redhat.com/en/technologies/management/ansible). The Ansible Product Demos (APD) project is a set of Ansible demos that are deployed using [Red Hat Ansible Automation Platform](https://www.redhat.com/en/technologies/management/ansible). It uses configuraton-as-code to create AAP resources such as projects, templates, and credentials that form the basis for demonstrating automation use cases in several technology domains:
| Demo Name | Description | | Demo Name | Description |
|-----------|-------------| |-----------|-------------|
@@ -15,54 +14,21 @@ This is a centralized location for Ansible Product Demos. This project is a coll
| [OpenShift](openshift/README.md) | OpenShift automation demos | | [OpenShift](openshift/README.md) | OpenShift automation demos |
| [Satellite](satellite/README.md) | Demos of automation with Red Hat Satellite Server | | [Satellite](satellite/README.md) | Demos of automation with Red Hat Satellite Server |
## Contributions
If you would like to contribute to this project please refer to [contribution guide](CONTRIBUTING.md) for best practices.
## Using this project ## Using this project
This project is tested for compatibility with the [demo.redhat.com Ansible Product Demos](https://demo.redhat.com/catalog?search=product+demos&item=babylon-catalog-prod%2Fopenshift-cnv.aap-product-demos-cnv.prod) lab environment. To use with other Ansible Automation Platform installations, review the [prerequisite documentation](https://github.com/ansible/product-demos-bootstrap). Use the [APD bootstrap](https://github.com/ansible/product-demos-bootstrap) repo to add APD to an existing Ansible Automation Platform deployment. The bootstrap repo provides the initial manual prerequisite steps as well as a playbook for adding APD to the existing deployment.
> NOTE: demo.redhat.com is available to Red Hat Associates and Partners with a valid account. For Red Hat associates and partners, there is an Ansible Product Demos catalog item [available on demo.redhat.com](https://red.ht/apd-sandbox) (account required).
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.
1. In the Credentials section of the Controller UI, add a new Credential called `Automation Hub` with the type `Ansible Galaxy/Automation Hub API Token`
2. You can obtain a token [here](https://console.redhat.com/ansible/automation-hub/token). This page will also provide the Server URL and Auth Server URL.
3. Next, click on Organizations and edit the `Default` organization. Add your `Automation Hub` credential to the `Galaxy Credentials` section. Don't forget to click **Save**!!
> You can also use an execution environment for disconnected environments. To do this, you must disable collection downloads in the Controller. This can be done in `Settings` > `Job Settings`. This setting prevents the controller from downloading collections listed in the [collections/requirements.yml](collections/requirements.yml) file.
2. If it is not already created for you, add an Execution Environment called `product-demos`
- Name: product-demos
- Image: quay.io/acme_corp/product-demos-ee:latest
- Pull: Only pull the image if not present before running
3. If it is not already created for you, create a Project called `Ansible Product Demos` with this repo as a source. NOTE: if you are using a fork, be sure that you have the correct URL. Update the project.
4. Finally, Create a Job Template called `Setup` with the following configuration:
- Name: Setup
- Inventory: Demo Inventory
- Exec Env: product-demos
- Playbook: setup_demo.yml
- Credentials:
- Type: Red Hat Ansible Automation Platform
- Name: Controller Credential
- Extra vars:
demo: <linux or windows or cloud or network>
## Bring Your Own Demo ## Bring Your Own Demo
Can't find what you're looking for? Customize this repo to make it your own. Can't find what you're looking for? Customize this repo to make it your own.
1. Create a fork of this repo. 1. Create a fork of this repo.
2. Update the URL of the `Ansible Project Demos` in the Controller. 2. Update the URL of the `Ansible Project Demos` project your Ansible Automation Platform controller.
3. Make changes as needed and run the **Product Demos | Single demo setup** job 3. Make changes to your fork as needed and run the **Product Demos | Single demo setup** job
See the [contribution guide](CONTRIBUTING.md) for more details on how to customize the project. See the [contributing guide](CONTRIBUTING.md) for more details on how to customize the project.
--- ---

View File

@@ -27,7 +27,7 @@
- us-east-2b - us-east-2b
- us-east-2c - us-east-2c
us-west-1: us-west-1:
# us-west-1a not available when last checked 20250618 # us-west-1a not available when last checked 20250218
- us-west-1b - us-west-1b
- us-west-1c - us-west-1c
us-west-2: us-west-2:

View File

@@ -1,22 +0,0 @@
---
- name: Delete AWS keypair
hosts: localhost
vars:
aws_key_name: aws-test-key
tasks:
- name: Fail if variables not defined
ansible.builtin.assert:
that:
- aws_key_name is defined
- create_vm_aws_region is defined
fail_msg: "Required variables not set"
- name: Delete AWS keypair
amazon.aws.ec2_key:
name: "{{ aws_key_name }}"
region: "{{ create_vm_aws_region }}"
state: absent
...

View File

@@ -1,83 +0,0 @@
---
- name: Delete cloud stack VPC
hosts: localhost
gather_facts: false
vars:
aws_vpc_name: aws-test-vpc
aws_sg_name: aws-test-sg
aws_subnet_name: aws-test-subnet
aws_subnet_cidr: 10.0.1.0/24
aws_rt_name: aws-test-rt
aws_purpose_tag: ansible_demo
tasks:
- name: Verify the VPC name
ansible.builtin.assert:
that:
- aws_vpc_name == "aws-test-vpc"
fail_msg: 'Only the VPC "aws-test-vpc" can be deleted with this playbook'
- name: Retrieve VPC info
amazon.aws.ec2_vpc_net_info:
region: "{{ create_vm_aws_region }}"
filters:
"tag:Name": "{{ aws_vpc_name }}"
"tag:purpose": "{{ aws_purpose_tag }}"
register: _vpc
- name: Retrieve internet gateway info
amazon.aws.ec2_vpc_igw_info:
region: "{{ create_vm_aws_region }}"
filters:
"tag:Name": "{{ aws_vpc_name }}"
"tag:purpose": "{{ aws_purpose_tag }}"
register: _igw
- name: Retrieve route table info
amazon.aws.ec2_vpc_route_table_info:
region: "{{ create_vm_aws_region }}"
filters:
"tag:Name": "{{ aws_rt_name }}"
"tag:purpose": "{{ aws_purpose_tag }}"
register: _rt
- name: Delete demo security group
amazon.aws.ec2_security_group:
name: "{{ aws_sg_name }}"
region: "{{ create_vm_aws_region }}"
vpc_id: "{{ _vpc.vpcs.0.id }}"
state: absent
when: _vpc.vpcs
- name: Delete subnet in the VPC
amazon.aws.ec2_vpc_subnet:
vpc_id: "{{ _vpc.vpcs.0.id }}"
cidr: "{{ aws_subnet_cidr }}"
region: "{{ create_vm_aws_region }}"
state: absent
when: _vpc.vpcs
- name: Delete the subnet route table
amazon.aws.ec2_vpc_route_table:
route_table_id: "{{ _rt.route_tables.0.route_table_id }}"
region: "{{ create_vm_aws_region }}"
lookup: id
state: absent
when: _rt.route_tables
- name: Delete internet gateway
amazon.aws.ec2_vpc_igw:
internet_gateway_id: "{{ _igw.internet_gateways.0.internet_gateway_id }}"
region: "{{ create_vm_aws_region }}"
state: absent
when: _igw.internet_gateways
- name: Delete VPC
amazon.aws.ec2_vpc_net:
vpc_id: "{{ _vpc.vpcs.0.id }}"
region: "{{ create_vm_aws_region }}"
state: absent
when: _vpc.vpcs
...

View File

@@ -171,63 +171,6 @@ controller_templates:
variable: _hosts variable: _hosts
required: false required: false
- name: Cloud / AWS / Delete Keypair
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Product Demos
playbook: cloud/delete_aws_key.yml
inventory: Demo Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: AWS Region
type: multiplechoice
variable: create_vm_aws_region
required: true
choices:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- question_name: Keypair Name
type: text
variable: aws_key_name
required: true
default: aws-test-key
- name: Cloud / AWS / Delete VPC
job_type: run
organization: Default
credentials:
- AWS
project: Ansible Product Demos
playbook: cloud/delete_vpc.yml
inventory: Demo Inventory
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: AWS Region
type: multiplechoice
variable: create_vm_aws_region
required: true
choices:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- name: Cloud / AWS / Display EC2 Stats - name: Cloud / AWS / Display EC2 Stats
job_type: run job_type: run
organization: Default organization: Default
@@ -449,74 +392,3 @@ controller_workflows:
unified_job_template: 'SUBMIT FEEDBACK' unified_job_template: 'SUBMIT FEEDBACK'
extra_data: extra_data:
feedback: Cloud / AWS / Patch EC2 Workflow | Failed to restore ec2 from snapshot feedback: Cloud / AWS / Patch EC2 Workflow | Failed to restore ec2 from snapshot
- name: Delete AWS Cloud Stack
description: >
Delete the AWS cloud stack created by the "Deploy Cloud Stack in AWS" workflow
organization: Default
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: AWS Region
type: multiplechoice
variable: create_vm_aws_region
required: true
choices:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- question_name: Instances to delete
type: text
variable: _hosts
required: true
default: aws-dc,aws_win1,aws_rhel8,aws_rhel9,reports
- question_name: Keypair to delete
type: text
variable: aws_key_name
required: true
default: aws-test-key
- question_name: VPC to delete
type: text
variable: aws_vpc_name
required: true
default: aws-test-vpc
simplified_workflow_nodes:
- identifier: Delete AWS Instances
unified_job_template: Cloud / AWS / Delete VM
success_nodes:
- Inventory Sync
failure_nodes:
- Ticket - Delete AWS Instances Failed
- identifier: Inventory Sync
unified_job_template: AWS Inventory
success_nodes:
- Delete AWS Keypair
- Delete AWS VPC
- identifier: Delete AWS Keypair
unified_job_template: Cloud / AWS / Delete Keypair
failure_nodes:
- Ticket - Delete AWS Keypair Failed
- identifier: Delete AWS VPC
unified_job_template: Cloud / AWS / Delete VPC
failure_nodes:
- Ticket - Delete AWS VPC Failed
- identifier: Ticket - Delete AWS Instances Failed
unified_job_template: 'SUBMIT FEEDBACK'
extra_data:
feedback: Failed to delete one or more AWS instances
- identifier: Ticket - Delete AWS Keypair Failed
unified_job_template: 'SUBMIT FEEDBACK'
extra_data:
feedback: Failed to delete AWS keypair
- identifier: Ticket - Delete AWS VPC Failed
unified_job_template: 'SUBMIT FEEDBACK'
extra_data:
feedback: Failed to delete AWS VPC
...

View File

@@ -245,6 +245,34 @@ controller_templates:
- "OpenShift Credential" - "OpenShift Credential"
controller_workflows: controller_workflows:
- name: OpenShift / CNV / Sync Hosts
description: A workflow to update dynamic CNV inventory and wait for hosts to become avilable
organization: Default
notification_templates_started: Telemetry
notification_templates_success: Telemetry
notification_templates_error: Telemetry
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Specify target hosts
type: text
variable: _hosts
required: true
default: "openshift-cnv-rhel*"
simplified_workflow_nodes:
- identifier: Inventory Sync
unified_job_template: OpenShift CNV Inventory
success_nodes:
- Wait Hosts
- identifier: Wait Hosts
unified_job_template: OpenShift / CNV / Wait Hosts
failure_nodes:
- Second Inventory Sync
- identifier: Second Inventory Sync
unified_job_template: OpenShift CNV Inventory
- name: OpenShift / CNV / Infra Stack - name: OpenShift / CNV / Infra Stack
description: A workflow to deploy Virtualized infra in OCP Virtalization description: A workflow to deploy Virtualized infra in OCP Virtalization
organization: Default organization: Default
@@ -320,15 +348,15 @@ controller_workflows:
success_nodes: success_nodes:
- Patch Instance - Patch Instance
# We need to do an invnetory sync *after* creating snapshots, as turning VMs on/off changes their IP # We need to do an invnetory sync *after* creating snapshots, as turning VMs on/off changes their IP
- identifier: Inventory Sync - identifier: Sync Hosts
unified_job_template: OpenShift CNV Inventory unified_job_template: OpenShift / CNV / Sync Hosts
success_nodes: success_nodes:
- Patch Instance - Patch Instance
- identifier: Take Snapshot - identifier: Take Snapshot
unified_job_template: OpenShift / CNV / Create VM Snapshots unified_job_template: OpenShift / CNV / Create VM Snapshots
success_nodes: success_nodes:
- Project Sync - Project Sync
- Inventory Sync - Sync Hosts
- identifier: Patch Instance - identifier: Patch Instance
unified_job_template: OpenShift / CNV / Patch unified_job_template: OpenShift / CNV / Patch
job_type: run job_type: run