Compare commits
2 Commits
jce/cloud-
...
jce/multi-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc9c621ecf | ||
|
|
c96096c2c9 |
@@ -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:
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|
||||||
...
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
...
|
|
||||||
128
cloud/setup.yml
128
cloud/setup.yml
@@ -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
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|||||||
@@ -44,13 +44,14 @@ controller_inventory_sources:
|
|||||||
- tag:Name
|
- tag:Name
|
||||||
compose:
|
compose:
|
||||||
ansible_host: public_ip_address
|
ansible_host: public_ip_address
|
||||||
ansible_user: ec2-user
|
ansible_user: 'ec2-user'
|
||||||
groups:
|
groups:
|
||||||
cloud_aws: true
|
cloud_aws: true
|
||||||
os_linux: "platform_details == 'Red Hat Enterprise Linux'"
|
os_linux: tags.blueprint.startswith('rhel')
|
||||||
os_windows: "platform_details == 'Windows'"
|
os_windows: tags.blueprint.startswith('win')
|
||||||
|
|
||||||
keyed_groups:
|
keyed_groups:
|
||||||
|
- key: platform
|
||||||
|
prefix: os
|
||||||
- key: tags.blueprint
|
- key: tags.blueprint
|
||||||
prefix: blueprint
|
prefix: blueprint
|
||||||
- key: tags.owner
|
- key: tags.owner
|
||||||
@@ -61,7 +62,6 @@ controller_inventory_sources:
|
|||||||
prefix: deployment
|
prefix: deployment
|
||||||
- key: tags.Compliance
|
- key: tags.Compliance
|
||||||
separator: ''
|
separator: ''
|
||||||
|
|
||||||
controller_groups:
|
controller_groups:
|
||||||
- name: cloud_aws
|
- name: cloud_aws
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
|
|||||||
@@ -52,9 +52,7 @@
|
|||||||
state: enabled
|
state: enabled
|
||||||
immediate: true
|
immediate: true
|
||||||
permanent: true
|
permanent: true
|
||||||
when:
|
when: "'firewalld.service' in ansible_facts.services"
|
||||||
- "'firewalld.service' in ansible_facts.services"
|
|
||||||
- ansible_facts.services["firewalld.service"].state == "running"
|
|
||||||
|
|
||||||
- name: Disable httpd welcome page
|
- name: Disable httpd welcome page
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|||||||
@@ -46,17 +46,15 @@
|
|||||||
- name: Create some users
|
- name: Create some users
|
||||||
microsoft.ad.user:
|
microsoft.ad.user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
groups:
|
groups: "{{ item.groups }}"
|
||||||
set:
|
|
||||||
- "{{ item.group }}"
|
|
||||||
password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
|
password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
|
||||||
update_password: on_create
|
update_password: on_create
|
||||||
loop:
|
loop:
|
||||||
- name: "UserA"
|
- name: "UserA"
|
||||||
group: "GroupA"
|
groups: "GroupA"
|
||||||
- name: "UserB"
|
- name: "UserB"
|
||||||
group: "GroupB"
|
groups: "GroupB"
|
||||||
- name: "UserC"
|
- name: "UserC"
|
||||||
group: "GroupC"
|
groups: "GroupC"
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 10
|
delay: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user