-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
505d122
commit f65d405
Showing
14 changed files
with
337 additions
and
280 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# This file contains ignores rule violations for ansible-lint | ||
meta/main.yml schema[meta] | ||
molecule/common/cleanup.yml no-changed-when | ||
molecule/common/converge.yml ignore-errors | ||
molecule/common/converge.yml no-changed-when | ||
molecule/common/converge.yml run-once[task] | ||
molecule/common/create.yml risky-file-permissions | ||
molecule/common/kvm.yml no-changed-when | ||
molecule/common/prepare.yml ignore-errors | ||
molecule/common/prepare.yml no-changed-when | ||
molecule/common/prepare.yml run-once[task] | ||
molecule/common/verify.yml no-changed-when | ||
molecule/common/verify.yml risky-file-permissions | ||
molecule/common/verify.yml run-once[task] | ||
tasks/lvm.yml jinja[invalid] | ||
tasks/lvm.yml no-changed-when | ||
tasks/lvm.yml risky-file-permissions | ||
tasks/metadata/storage.yml jinja[invalid] | ||
tasks/static.yml no-changed-when |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
--- | ||
- name: Add guests to inventory | ||
|
||
hosts: localhost | ||
|
||
become: true | ||
|
||
tasks: | ||
|
||
- name: Add guest to inventory | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
- name: Prepare host networking | ||
hosts: localhost | ||
become: true | ||
tasks: | ||
|
||
- name: Update apt package cache | ||
ansible.builtin.apt: | ||
update_cache: true | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Create molecule cache dir | ||
ansible.builtin.file: | ||
path: "{{ cache_dir }}" | ||
state: directory | ||
mode: 0777 | ||
become: false | ||
|
||
- name: Create KVM keypair | ||
ansible.builtin.command: | ||
cmd: "ssh-keygen -t rsa -f {{ kvm_keypair }} -q -P '' -C ''" | ||
creates: "{{ kvm_keypair }}" | ||
become: false | ||
|
||
- name: Create dummy bridge | ||
ansible.builtin.command: "ip link add {{ bridge_name }} type bridge" | ||
failed_when: false | ||
|
||
- name: Create dummy interface | ||
ansible.builtin.command: "ip link add {{ bridge_iface }} type dummy" | ||
failed_when: false | ||
|
||
- name: Create dummy bridge slave | ||
ansible.builtin.command: "ip link set {{ bridge_iface }} master {{ bridge_name }}" | ||
failed_when: false | ||
|
||
- name: Set bridge interface ip address | ||
ansible.builtin.command: "ip addr add {{ bridge_host }}/{{ bridge_prefix }} dev {{ bridge_name }}" | ||
failed_when: false | ||
|
||
- name: Start bridge interface | ||
ansible.builtin.command: "ip link set dev {{ bridge_name }} up" | ||
failed_when: false | ||
|
||
- name: Masquerade bridge | ||
ansible.builtin.iptables: | ||
table: nat | ||
chain: POSTROUTING | ||
out_interface: "{{ ansible_default_ipv4.interface }}" | ||
source: "{{ bridge_net }}" | ||
destination: 0.0.0.0/0 | ||
jump: MASQUERADE | ||
protocol: all | ||
state: present | ||
|
||
- name: Enable ipv4 forwarding | ||
ansible.posix.sysctl: | ||
name: net.ipv4.ip_forward | ||
value: '1' | ||
state: present | ||
reload: True | ||
|
||
- name: Install Debian packages | ||
when: ansible_os_family == 'Debian' | ||
block: | ||
|
||
- name: Install libvirt packages | ||
ansible.builtin.apt: | ||
name: | ||
- libvirt-clients | ||
- libvirt-daemon-system | ||
- libvirt-daemon-system-systemd | ||
- python3-libvirt | ||
|
||
- name: Install qemu packages | ||
ansible.builtin.apt: | ||
name: | ||
- qemu-efi | ||
- qemu-system-x86 | ||
- qemu-utils |
Oops, something went wrong.