Skip to content

Instantly share code, notes, and snippets.

View nleiva's full-sized avatar
☠️
Working from somewhere

Nicolas Leiva nleiva

☠️
Working from somewhere
View GitHub Profile
- 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 }}"
- name: Grab VPC details
amazon.aws.ec2_vpc_net_info:
region: "{{ ec2_region }}"
filters:
"tag:Environment": "{{ ec2_environment }}"
register: all_vpcs
- 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 }}"
- name: Reboot machine
ansible.builtin.reboot:
- 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"
base_software:
Debian:
- dnsutils
- build-essential
- python3-dev
RedHat:
- bind-utils
- gcc
- python3-devel
- name: Setup custom prompt
ansible.builtin.copy:
src: prompt.sh
dest: /etc/profile.d/prompt.sh
owner: root
group: root
mode: '0644'
- name: Make Ubuntu source the prompt file
ansible.builtin.lineinfile:
- name: Install Python dependencies
ansible.builtin.pip:
name: "{{ python_libraries }}"
executable: pip3
- name: Configure systemd.unified_cgroup_hierarchy=0 in kernelopts
ansible.builtin.command:
cmd: grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
notify: Reboot machine
when: ansible_distribution == "Fedora"
- name: Download Containerlab
ansible.builtin.get_url:
url: "{{ clab_download_url }}"
dest: "/tmp/clab.tar.gz"
mode: '0644'
- name: Unarchive Containerlab
ansible.builtin.unarchive:
src: "/tmp/clab.tar.gz"
dest: "/tmp"