Skip to content

Instantly share code, notes, and snippets.

Avatar
☠️
Working from somewhere

Nicolas Leiva nleiva

☠️
Working from somewhere
  • Red Hat, Inc.
  • Marlton, NJ
  • Twitter @nleiv4
View GitHub Profile
View delete_key_pair.yml
- name: Delete SSH Key Pair for instance
amazon.aws.ec2_key:
name: "{{ ec2_resource_prefix }}-key"
region: "{{ ec2_region }}"
state: absent
View delete_vpc.yml
- name: Delete AWS VPC
amazon.aws.ec2_vpc_net:
name: "{{ ec2_resource_prefix }}-vpc"
cidr_block: "{{ ec2_cidr_block }}"
region: "{{ ec2_region }}"
state: absent
View delete_rt_table.yml
- name: Delete Route Table
community.aws.ec2_vpc_route_table:
region: "{{ ec2_region }}"
vpc_id: "{{ all_vpcs.vpcs[0].vpc_id }}"
tags:
Environment: "{{ ec2_environment }}"
Name: "{{ ec2_resource_prefix }}-route-table"
state: absent
View delete_igw.yml
- name: Delete internet gateway in Environment {{ ec2_environment }}
community.aws.ec2_vpc_igw:
region: "{{ ec2_region }}"
vpc_id: "{{ item.vpc_id }}"
state: absent
loop: '{{ all_vpcs.vpcs }}'
View delete_subnet.yml
- name: Delete Subnet
amazon.aws.ec2_vpc_subnet:
region: "{{ ec2_region }}"
vpc_id: "{{ all_vpcs.vpcs[0].vpc_id }}"
cidr: "{{ ec2_subnet }}"
state: absent
View delete_security_group.yml
- name: Gather information about all Security Groups in Environment {{ ec2_environment }}
amazon.aws.ec2_group_info:
region: "{{ ec2_region }}"
filters:
vpc-id: "{{ all_vpcs.vpcs[0].vpc_id }}"
register: all_sg
- name: Delete Security Groups in VPC {{ all_vpcs.vpcs[0].vpc_id }} by ID
amazon.aws.ec2_group:
region: "{{ ec2_region }}"
View search_vpc.yml
- name: Grab VPC details
amazon.aws.ec2_vpc_net_info:
region: "{{ ec2_region }}"
filters:
"tag:Environment": "{{ ec2_environment }}"
register: all_vpcs
View delete_ec2.yml
- name: Delete EC2 instance
community.aws.ec2_instance:
region: "{{ ec2_region }}"
state: absent
filters:
instance-state-name: running
"tag:Name": "{{ ec2_name_tag }}"
"tag:Environment": "{{ ec2_environment }}"
View reboot.yml
- name: Reboot machine
ansible.builtin.reboot:
View docker_repo.yml
- name: Add Docker repo on Fedora
block:
- name: Add Docker GPG key
ansible.builtin.rpm_key:
key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg"
state: present
- name: Add Docker repository
ansible.builtin.get_url:
url: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/docker-ce.repo"