This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: PULL AND CUSTOMIZE CLOUD IMAGE | |
hosts: hypervisors | |
tasks: | |
- name: DOWNLOAD DEBIAN CLOUD IMAGE QCOW2 FILE | |
ansible.builtin.get_url: | |
url: "https://{{ cloud_url }}" | |
dest: "{{ ansible_env.HOME }}/vm/{{ lab_name }}/{{ image_name }}" | |
mode: "0644" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: CONFIGURE SYSTEM BITS AND PIECES | |
hosts: vms | |
become: true | |
tasks: | |
- name: CONFIGURE VM LOCALES | |
community.general.locale_gen: | |
name: fr_FR.UTF-8 | |
state: present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
lab_name: iac_lab01 | |
cloud_url: cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-amd64-daily.qcow2 | |
image_name: debian-13-amd64.qcow2 | |
filesystem_resize: 32G | |
oob_vlan: 28 | |
taps: | |
- name: tapXXX | |
vlan_mode: trunk | |
trunks: [0, 28, 230] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: ADD IN BAND VLAN ACCESS | |
hosts: vms | |
become: true | |
tasks: | |
- name: CHECK IF SYSTEMD NETDEV FILE EXISTS FOR IN BAND VLAN | |
ansible.builtin.stat: | |
path: /etc/systemd/network/30-{{ item.interface_type }}{{ item.interface_id }}.netdev | |
register: netdev_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
hypervisors: | |
hosts: | |
bob: | |
ansible_host: fe80:1c::1%enp0s1 | |
vars: | |
ansible_ssh_user: "{{ hypervisor_user }}" | |
ansible_ssh_pass: "{{ hypervisor_pass }}" | |
ansible_ssh_port: 2222 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
hypervisors: | |
hosts: | |
bob: | |
ansible_host: fe80:1c::1%enp0s1 | |
vars: | |
ansible_ssh_user: "{{ hypervisor_user }}" | |
ansible_ssh_pass: "{{ hypervisor_pass }}" | |
ansible_ssh_port: 2222 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
lab_name: iac_lab03 | |
image_name: c8000v-universalk9.17.13.01a | |
oob_vlan: 28 | |
taps: | |
- name: tapXX3 | |
vlan_mode: access | |
tag: "{{ oob_vlan }}" | |
link: RXXX_mgmt | |
switch: dsw-host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[defaults] | |
# Use inventory/ folder files as source | |
inventory = inventory/ | |
host_key_checking = False # Don't worry about RSA Fingerprints | |
retry_files_enabled = False # Do not create them | |
deprecation_warnings = False # Do not show warnings | |
interpreter_python = /usr/bin/python3 | |
[inventory] | |
enable_plugins = auto, host_list, yaml, ini, toml, script | |
[persistent_connection] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: PREPARE LAB ENVIRONMENT | |
hosts: hypervisors | |
tasks: | |
- name: ENSURE SYMLINK TO MASTERS DIRECTORY EXISTS | |
ansible.builtin.file: | |
src: /var/cache/kvm/masters | |
dest: "{{ ansible_env.HOME }}/masters" | |
state: link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: COPY MASTER IMAGE AND RUN ROUTERS | |
hosts: hypervisors | |
tasks: | |
- name: COPY MASTER IMAGE TO LAB DIRECTORY | |
ansible.builtin.copy: | |
src: "{{ item }}" | |
dest: "{{ ansible_env.HOME }}/vm/{{ lab_name }}/" | |
mode: "0644" | |
remote_src: true |