From a6cb97286f71cf3481eca3f8594a33b1160e845d Mon Sep 17 00:00:00 2001 From: Ted Cook Date: Sun, 25 Feb 2024 22:06:03 -0600 Subject: [PATCH] Update default ubuntu image url --- .github/workflows/molecule.yml | 2 - .talismanrc | 2 + Makefile | 11 +- molecule/default/cleanup.yml | 51 ----- molecule/default/converge.yml | 46 ++-- molecule/default/destroy.yml | 65 ++++++ molecule/default/molecule.yml | 64 +++--- molecule/default/prepare.yml | 122 +++++------ molecule/default/templates/meta-data.yml.j2 | 2 + molecule/default/templates/network.j2.xml | 14 ++ molecule/default/templates/pool.j2.xml | 11 + molecule/default/templates/user-data.yml.j2 | 8 + molecule/default/templates/vm.xml.j2 | 7 +- molecule/default/vars.yml | 7 + molecule/default/verify.yml | 44 +--- poetry.lock | 225 ++++---------------- pyproject.toml | 7 +- requirements.yml | 3 - 18 files changed, 285 insertions(+), 406 deletions(-) delete mode 100644 molecule/default/cleanup.yml create mode 100644 molecule/default/destroy.yml create mode 100644 molecule/default/templates/meta-data.yml.j2 create mode 100644 molecule/default/templates/network.j2.xml create mode 100644 molecule/default/templates/pool.j2.xml create mode 100644 molecule/default/templates/user-data.yml.j2 create mode 100644 molecule/default/vars.yml diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 69009c6..c01a44c 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -21,10 +21,8 @@ jobs: matrix: include: - distro: 'jammy' - url: 'https://releases.ubuntu.com/jammy/ubuntu-22.04.3-live-server-amd64.iso' net: '192.168.255.0/24' - distro: 'focal' - url: 'https://releases.ubuntu.com/focal/ubuntu-20.04.6-live-server-amd64.iso' net: '192.168.254.0/24' steps: diff --git a/.talismanrc b/.talismanrc index 8513c44..1bc28fe 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,8 @@ fileignoreconfig: - filename: poetry.lock ignore_detectors: [filecontent] +- filename: pyproject.toml + ignore_detectors: [filecontent] - filename: molecule/templates/vm.xml.j2 ignore_detectors: [filecontent] - filename: molecule/default/molecule.yml diff --git a/Makefile b/Makefile index 71dd8ab..efd88f7 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,21 @@ .PHONY: all ${MAKECMDGOALS} MOLECULE_SCENARIO ?= default -MOLECULE_DOCKER_IMAGE ?= ubuntu2004 GALAXY_API_KEY ?= GITHUB_REPOSITORY ?= $$(git config --get remote.origin.url | cut -d: -f 2 | cut -d. -f 1) GITHUB_ORG = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 1) GITHUB_REPO = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 2) REQUIREMENTS = requirements.yml +UBUNTU_DISTRO = jammy +UBUNTU_SHASUMS = https://releases.ubuntu.com/${UBUNTU_DISTRO}/SHA256SUMS +UBUNTU_MIRROR = $$(dirname ${UBUNTU_SHASUMS}) +UBUNTU_ISO = $$(curl -s ${UBUNTU_SHASUMS} | grep "live-server" | awk '{print $$2}' | sed -e 's/\*//g') all: install version lint test test: lint + MOLECULE_DISTRO=${UBUNTU_DISTRO} \ + MOLECULE_ISO=${UBUNTU_MIRROR}/${UBUNTU_ISO} \ poetry run molecule $@ -s ${MOLECULE_SCENARIO} install: @@ -34,7 +39,9 @@ collections: requirements: roles collections dependency create prepare converge idempotence side-effect verify destroy login reset: - MOLECULE_DOCKER_IMAGE=${MOLECULE_DOCKER_IMAGE} poetry run molecule $@ -s ${MOLECULE_SCENARIO} + MOLECULE_DISTRO=${UBUNTU_DISTRO} \ + MOLECULE_ISO=${UBUNTU_MIRROR}/${UBUNTU_ISO} \ + poetry run molecule $@ -s ${MOLECULE_SCENARIO} ignore: poetry run ansible-lint --generate-ignore diff --git a/molecule/default/cleanup.yml b/molecule/default/cleanup.yml deleted file mode 100644 index 393aebc..0000000 --- a/molecule/default/cleanup.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- name: Destroy KVM guests - - hosts: localhost - - become: true - - tasks: - - - name: Destroy KVM guest - community.libvirt.virt: - state: destroyed - name: "{{ guest.installer_hostname }}" - loop_control: - loop_var: guest - label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" - failed_when: false - - - name: Undefine KVM guest - community.libvirt.virt: - command: undefine - name: "{{ guest.installer_hostname }}" - loop_control: - loop_var: guest - label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" - failed_when: false - - - name: Destroy KVM guest disks - ansible.builtin.file: - path: "{{ guest_disk }}" - state: absent - vars: - guest_disk: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" - loop_control: - loop_var: guest - label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" - - - name: Destroy dummy bridge - ansible.builtin.command: "nmcli con del {{ bridge_name }}" - failed_when: false - - - name: Destroy dummy interface - ansible.builtin.command: "ip link del {{ bridge_iface }}" - failed_when: false - - - name: Destroy dummy bridge - ansible.builtin.command: "ip link del {{ bridge_name }} type bridge" - failed_when: false diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 9d553d4..6a605c9 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -1,43 +1,39 @@ --- - name: Spawn KVM guests - hosts: localhost - become: true - + vars_files: + - vars.yml pre_tasks: - - name: Install disk utils ansible.builtin.apt: name: - parted - lvm2 - tasks: - - name: Cache installer iso ansible.builtin.get_url: - url: "{{ iso_installer.url }}" - dest: "{{ iso_installer.dest | urlsplit('path') }}" + url: "{{ ubuntu_installer_url }}" + dest: "{{ ubuntu_installer_dest | urlsplit('path') }}" - name: Build guest installer isos ansible.builtin.include_role: name: nephelaiio.ubuntu_installer vars: ubuntu_installer_interface_name: enp1s0 - ubuntu_installer_target_dir: "{{ cache_dir }}" - ubuntu_installer_image_url: "{{ iso_installer.dest }}" + ubuntu_installer_target_dir: "{{ molecule_libvirt_path }}" + ubuntu_installer_image_url: "{{ ubuntu_installer_dest }}" ubuntu_installer_hostname: "{{ guest.installer_hostname }}" ubuntu_installer_username: molecule ubuntu_installer_password: "{{ 'molecule' | password_hash('sha512') }}" ubuntu_installer_sshkey: - - "{{ lookup('file', kvm_keypair + '.pub') }}" + - "{{ lookup('file', molecule_kvm_keypair + '.pub') }}" ubuntu_installer_interface: "{{ guest.installer_interface }}" ubuntu_installer_partman_method: "{{ guest.installer_partitioning_method }}" loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Destroy KVM guest community.libvirt.virt: @@ -46,7 +42,7 @@ loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" failed_when: false - name: Undefine KVM guest @@ -56,7 +52,7 @@ loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" failed_when: false - name: Destroy KVM guest disks @@ -64,23 +60,23 @@ path: "{{ guest_disk }}" state: absent vars: - guest_disk: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" + guest_disk: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Create KVM guest disks ansible.builtin.command: "qemu-img create {{ guest_disk }} {{ guest_disk_size }}" args: creates: "{{ guest_disk }}" vars: - guest_disk: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" + guest_disk: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" guest_disk_size: "{{ guest.installer_disk_size }}" loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Manage permissions for KVM guest disks ansible.builtin.file: @@ -89,11 +85,11 @@ group: kvm mode: 0666 vars: - guest_disk: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" + guest_disk: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Create KVM guest community.libvirt.virt: @@ -101,16 +97,16 @@ command: define vars: guest_hostname: "{{ guest.installer_hostname }}" - guest_bridge: "{{ bridge_name }}" - guest_iso: "{{ cache_dir }}/{{ guest_hostname }}.iso" - guest_disk_path: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" + guest_network: "{{ molecule_libvirt_network }}" + guest_iso: "{{ molecule_libvirt_path }}/{{ guest_hostname }}.iso" + guest_disk_path: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" guest_mac: "{{ '52:54:00' | random_mac(seed=guest_hostname) }}" guest_disk_format: raw xml_template: "{{ lookup('template', 'vm.xml.j2') }}" loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Start KVM guest community.libvirt.virt: @@ -121,4 +117,4 @@ loop_control: loop_var: guest label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml new file mode 100644 index 0000000..6148f70 --- /dev/null +++ b/molecule/default/destroy.yml @@ -0,0 +1,65 @@ +--- +- name: Destroy KVM guests + hosts: localhost + become: true + tasks: + - name: Destroy KVM guest + community.libvirt.virt: + state: destroyed + name: "{{ guest.installer_hostname }}" + loop_control: + loop_var: guest + label: "{{ guest.installer_hostname }}" + loop: "{{ molecule_kvm_guests }}" + failed_when: false + + - name: Undefine KVM guest + community.libvirt.virt: + command: undefine + name: "{{ guest.installer_hostname }}" + loop_control: + loop_var: guest + label: "{{ guest.installer_hostname }}" + loop: "{{ molecule_kvm_guests }}" + failed_when: false + + - name: Destroy KVM guest disks + ansible.builtin.file: + path: "{{ guest_disk }}" + state: absent + vars: + guest_disk: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" + loop_control: + loop_var: guest + label: "{{ guest.installer_hostname }}" + loop: "{{ molecule_kvm_guests }}" + + +- name: Destroy libvirt network and storage + hosts: localhost + become: true + vars_files: + - vars.yml + tasks: + - name: Stop libvirt network + community.libvirt.virt_net: + command: destroy + name: "{{ _libvirt_network }}" + when: _libvirt_network != "default" + failed_when: false + + - name: Delete libvirt network + community.libvirt.virt_net: + command: undefine + name: "{{ _libvirt_network }}" + when: _libvirt_network != "default" + + - name: Undefine libvirt pool + community.libvirt.virt_pool: + state: undefined + name: "{{ _libvirt_pool }}" + + - name: Destroy libvirt pool + ansible.builtin.file: + path: "{{ _libvirt_pool }}" + state: absent diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 8d96733..12ee2f8 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -26,37 +26,29 @@ provisioner: hosts: all: vars: - molecule_distro: "{{ lookup('env', 'MOLECULE_DISTRO', default='jammy') }}" - molecule_iso_default: 'https://releases.ubuntu.com/jammy/ubuntu-22.04.3-live-server-amd64.iso' - molecule_iso: "{{ lookup('env', 'MOLECULE_ISO', default=molecule_iso_default) }}" - molecule_debug: "{{ lookup('env', 'GITHUB_ACTIONS', default='false') | bool }}" - cache_dir: "/tmp/{{ molecule_distro }}" - output_dir: "{{ lookup('env', 'MOLECULE_OUTPUT_DIR', default='/tmp/logs') }}" - - molecule_net: "{{ lookup('env', 'MOLECULE_NET', default='192.168.255.0/24') }}" - bridge_net: "{{ molecule_net | ansible.utils.ipv4('network/prefix') }}" - bridge_host: "{{ bridge_net | ansible.utils.nthhost(1) }}" - bridge_prefix: "{{ bridge_net | ansible.utils.ipaddr('prefix') }}" - bridge_name: "{{ molecule_distro }}br0" - bridge_iface: "{{ molecule_distro }}0" - - kvm_keypair: "{{ cache_dir }}/kvm_key" ansible_ssh_common_args: '-o StrictHostKeyChecking=no' - iso_installer: - dest: "file://{{ cache_dir }}/server-live.iso" - url: "{{ molecule_iso }}" - - guests: + ubuntu_installer_dest: "file://{{ molecule_libvirt_path }}/server-live.iso" + ubuntu_installer_url: "{{ molecule_iso }}" + molecule_libvirt_netaddr: "{{ lookup('env', 'MOLECULE_NET', default='192.168.245.0/24') | ansible.utils.ipv4('network/prefix') }}" + molecule_libvirt_netsize: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('prefix') }}" + molecule_libvirt_address: "{{ molecule_libvirt_netaddr | ansible.utils.nthhost(1) }}/{{ molecule_libvirt_netsize }}" + molecule_libvirt_network: "molecule" + molecule_libvirt_path: "/var/lib/libvirt/ubuntu" + molecule_distro: "{{ lookup('env', 'MOLECULE_DISTRO', default='jammy') }}" + molecule_iso: "{{ lookup('env', 'MOLECULE_ISO') }}" + molecule_install_dir: "{{ lookup('env', 'MOLECULE_OUTPUT_DIR', default='/tmp/logs') }}" + molecule_kvm_keypair: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/kvm_key" + molecule_kvm_guests: - installer_hostname: "{{ molecule_distro }}-lvm-10g" installer_disk_size: "{{ 10*(1024**3) }}" installer_interface: static: true - ipaddress: "{{ bridge_net | ansible.utils.nthhost(2) }}" - network: "{{ bridge_net | ansible.utils.ipaddr('network') }}" - netmask: "{{ bridge_net | ansible.utils.ipaddr('netmask') }}" - gateway: "{{ bridge_host }}" + ipaddress: "{{ molecule_libvirt_netaddr | ansible.utils.nthhost(2) }}" + network: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('network') }}" + netmask: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('netmask') }}" + gateway: "{{ molecule_libvirt_address | ansible.utils.ipaddr('address') }}" nameservers: - 1.1.1.1 - 8.8.8.8 @@ -66,10 +58,10 @@ provisioner: installer_disk_size: "{{ 10*(1024**3) }}" installer_interface: static: true - ipaddress: "{{ bridge_net | ansible.utils.nthhost(3) }}" - network: "{{ bridge_net | ansible.utils.ipaddr('network') }}" - netmask: "{{ bridge_net | ansible.utils.ipaddr('netmask') }}" - gateway: "{{ bridge_host }}" + ipaddress: "{{ molecule_libvirt_netaddr | ansible.utils.nthhost(3) }}" + network: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('network') }}" + netmask: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('netmask') }}" + gateway: "{{ molecule_libvirt_address | ansible.utils.ipaddr('address') }}" nameservers: - 1.1.1.1 - 8.8.8.8 @@ -79,10 +71,10 @@ provisioner: installer_disk_size: "{{ 50*(1024**3) }}" installer_interface: static: true - ipaddress: "{{ bridge_net | ansible.utils.nthhost(4) }}" - network: "{{ bridge_net | ansible.utils.ipaddr('network') }}" - netmask: "{{ bridge_net | ansible.utils.ipaddr('netmask') }}" - gateway: "{{ bridge_host }}" + ipaddress: "{{ molecule_libvirt_netaddr | ansible.utils.nthhost(4) }}" + network: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('network') }}" + netmask: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('netmask') }}" + gateway: "{{ molecule_libvirt_address | ansible.utils.ipaddr('address') }}" nameservers: - 1.1.1.1 - 8.8.8.8 @@ -92,10 +84,10 @@ provisioner: installer_disk_size: "{{ 50*(1024**3) }}" installer_interface: static: true - ipaddress: "{{ bridge_net | ansible.utils.nthhost(5) }}" - network: "{{ bridge_net | ansible.utils.ipaddr('network') }}" - netmask: "{{ bridge_net | ansible.utils.ipaddr('netmask') }}" - gateway: "{{ bridge_host }}" + ipaddress: "{{ molecule_libvirt_netaddr | ansible.utils.nthhost(5) }}" + network: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('network') }}" + netmask: "{{ molecule_libvirt_netaddr | ansible.utils.ipaddr('netmask') }}" + gateway: "{{ molecule_libvirt_address | ansible.utils.ipaddr('address') }}" nameservers: - 1.1.1.1 - 8.8.8.8 diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index cc464c0..c7fbc62 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -1,76 +1,72 @@ --- -- name: Prepare host networking - +- name: Configure KVM host hosts: localhost - become: true - + vars_files: + - vars.yml tasks: + - name: Install package requirements + ansible.builtin.package: + name: + - qemu-kvm + - qemu-efi + - libvirt-clients + - libvirt-daemon-system + - libvirt-daemon-system-systemd + - python3-libvirt + become: true - - name: Update apt package cache - ansible.builtin.apt: - update_cache: true - when: ansible_os_family == 'Debian' + - name: Query libvirt pools + community.libvirt.virt_pool: + command: list_pools + register: _pools - - name: Create molecule cache dir + - name: Create libvirt path ansible.builtin.file: - path: "{{ cache_dir }}" + path: "{{ _libvirt_path }}" 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 + owner: libvirt-qemu + group: kvm + mode: 0755 + become: true - - name: Set bridge interface ip address - ansible.builtin.command: "ip addr add {{ bridge_host }}/{{ bridge_prefix }} dev {{ bridge_name }}" - failed_when: false + - name: Define libvirt pool + community.libvirt.virt_pool: + command: define + name: "{{ _libvirt_pool }}" + xml: "{{ lookup('ansible.builtin.template', 'pool.j2.xml') }}" + vars: + _pool: "{{ _libvirt_pool }}" + _path: "{{ _libvirt_path }}" - - name: Start bridge interface - ansible.builtin.command: "ip link set dev {{ bridge_name }} up" - failed_when: false + - name: Activate libvirt pool + community.libvirt.virt_pool: + state: active + name: "{{ _libvirt_pool }}" - - 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: Add libvirt network + community.libvirt.virt_net: + command: define + name: "{{ _libvirt_network }}" + xml: "{{ lookup('ansible.builtin.template', 'network.j2.xml') }}" + vars: + _network: "{{ _libvirt_network }}" + _address: "{{ _libvirt_address }}" + _dhcp: "{{ _libvirt_dhcp }}" + _net_address: "{{ _address | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}" + _net_mask: "{{ _address | ansible.utils.ipaddr('netmask') }}" + _net_dhcp_start: "{{ _dhcp | ansible.utils.ipaddr('2') | ansible.utils.ipaddr('address') }}" + _net_dhcp_end: "{{ _dhcp | ansible.utils.ipaddr('-2') | ansible.utils.ipaddr('address') }}" + when: _libvirt_network != "default" - - name: Enable ipv4 forwarding - ansible.posix.sysctl: - name: net.ipv4.ip_forward - value: '1' - state: present - reload: True + - name: Start libvirt network + community.libvirt.virt_net: + command: create + name: "{{ _libvirt_network }}" + when: _libvirt_network != "default" - - name: Install KVM requirements - ansible.builtin.apt: - name: - - qemu - - qemu-kvm - - qemu-efi - - libvirt-clients - - libvirt-daemon-system - - libvirt-daemon-system-systemd - - python3-libvirt - when: ansible_os_family == 'Debian' + - name: Create KVM keypair + ansible.builtin.command: + cmd: "ssh-keygen -t rsa -f {{ molecule_kvm_keypair }} -q -P '' -C ''" + creates: "{{ molecule_kvm_keypair }}" + become: false diff --git a/molecule/default/templates/meta-data.yml.j2 b/molecule/default/templates/meta-data.yml.j2 new file mode 100644 index 0000000..d2a729f --- /dev/null +++ b/molecule/default/templates/meta-data.yml.j2 @@ -0,0 +1,2 @@ +instance-id: {{ inventory_hostname }} +local-hostname: {{ inventory_hostname }} diff --git a/molecule/default/templates/network.j2.xml b/molecule/default/templates/network.j2.xml new file mode 100644 index 0000000..be95b60 --- /dev/null +++ b/molecule/default/templates/network.j2.xml @@ -0,0 +1,14 @@ + + {{ _network }} + + + + + + + + + + + + diff --git a/molecule/default/templates/pool.j2.xml b/molecule/default/templates/pool.j2.xml new file mode 100644 index 0000000..03109ed --- /dev/null +++ b/molecule/default/templates/pool.j2.xml @@ -0,0 +1,11 @@ + + {{ _pool }} + + {{ _path }} + + 0711 + 0 + 0 + + + diff --git a/molecule/default/templates/user-data.yml.j2 b/molecule/default/templates/user-data.yml.j2 new file mode 100644 index 0000000..954bde0 --- /dev/null +++ b/molecule/default/templates/user-data.yml.j2 @@ -0,0 +1,8 @@ +#cloud-config +users: + - name: {{ guest_user }} + ssh_authorized_keys: + - {{ guest_key }} + sudo: "ALL=(ALL) NOPASSWD:ALL" + groups: sudo + shell: /bin/bash diff --git a/molecule/default/templates/vm.xml.j2 b/molecule/default/templates/vm.xml.j2 index db89e4f..a2b10f5 100644 --- a/molecule/default/templates/vm.xml.j2 +++ b/molecule/default/templates/vm.xml.j2 @@ -1,4 +1,4 @@ - + {{ guest_hostname }} 4194304 4194304 @@ -146,9 +146,10 @@
- - + +
+ diff --git a/molecule/default/vars.yml b/molecule/default/vars.yml new file mode 100644 index 0000000..208bdf4 --- /dev/null +++ b/molecule/default/vars.yml @@ -0,0 +1,7 @@ +--- +_libvirt_network: "{{ molecule_libvirt_network | default('rke') }}" +_libvirt_address: "{{ molecule_libvirt_address | default('172.31.255.1/24') }}" +_libvirt_dhcp: "{{ molecule_libvirt_dhcp | default(_libvirt_address) }}" +_libvirt_user: "{{ molecule_libvirt_user | default('molecule') }}" +_libvirt_pool: "{{ molecule_libvirt_pool | default('molecule') }}" +_libvirt_path: "{{ molecule_libvirt_path | default('/var/lib/libvirt/molecule') }}" diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index d8371e9..83e464a 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -1,17 +1,12 @@ --- - name: Verify ISO creation - hosts: localhost - tasks: - - name: Retrieve guest ISO status ansible.builtin.stat: - path: "{{ cache_dir }}/{{ guest.installer_hostname }}.iso" - loop_control: - loop_var: guest - label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + path: "{{ molecule_libvirt_path }}/{{ item }}.iso" + loop: "{{ molecule_kvm_guests | map(attribute='installer_hostname') }}" + become: true register: guest_isos - name: Verify ISO creation @@ -25,13 +20,9 @@ - name: Add guests to inventory - hosts: localhost - become: true - tasks: - - name: Add guest to inventory ansible.builtin.add_host: name: "{{ guest_hostname }}" @@ -39,43 +30,34 @@ - install ansible_user: molecule ansible_host: "{{ guest_address }}" - ansible_port: "{{ guest_port }}" - ansible_ssh_private_key_file: "{{ kvm_keypair }}" + ansible_ssh_private_key_file: "{{ molecule_kvm_keypair }}" partitioning_method: "{{ guest.installer_partitioning_method }}" - disk_location: "{{ cache_dir }}/{{ guest.installer_hostname }}.img" + disk_location: "{{ molecule_libvirt_path }}/{{ guest.installer_hostname }}.img" disk_size: "{{ guest.installer_disk_size }}" disk_index: "{{ disk_index }}" vars: guest_hostname: "{{ guest.installer_hostname }}" - bridge_address: "{{ guest.installer_interface.ipaddress }}" - guest_address: "{{ bridge_address }}" - guest_port: 22 + guest_address: "{{ guest.installer_interface.ipaddress }}" loop_control: loop_var: guest index_var: disk_index label: "{{ guest.installer_hostname }}" - loop: "{{ guests }}" + loop: "{{ molecule_kvm_guests }}" - name: Verify guests - hosts: install - gather_facts: false - tasks: - - name: Debug connection parameters ansible.builtin.debug: msg: > ssh {{ ansible_user }}@{{ ansible_host }} {{ ansible_ssh_common_args | default('') }} -i {{ ansible_ssh_private_key_file }} - -p {{ ansible_port }} - name: Wait for connection block: - - name: Wait for guest ansible.builtin.wait_for_connection: sleep: 10 @@ -105,7 +87,6 @@ - name: Check lvm partitioning when: partitioning_method == 'lvm' block: - - name: Check lvm partitioning ansible.builtin.fail: msg: "lvm partitioning failed: {{ lsblk_output.stdout }}" @@ -129,18 +110,17 @@ when: (installer_root_size | int) < (installer_root_threshold | int) always: - - name: Set debug facts ansible.builtin.set_fact: debug_disk: "{{ disk_location }}.debug" debug_hostdir: "{{ _hostdir }}" debug_logfile: "{{ _logfile }}" debug_crashdir: "{{ _crashdir }}" - debug_output_dir: "{{ output_dir }}" - debug_output_curtin: "{{ output_dir }}/{{ inventory_hostname }}.curtin.log" - debug_output_screenshot: "{{ output_dir }}/{{ inventory_hostname }}.png" + debug_output_dir: "{{ molecule_install_dir }}" + debug_output_curtin: "{{ molecule_install_dir }}/{{ inventory_hostname }}.curtin.log" + debug_output_screenshot: "{{ molecule_install_dir }}/{{ inventory_hostname }}.png" vars: - _hostdir: "{{ cache_dir }}/{{ inventory_hostname }}" + _hostdir: "{{ molecule_libvirt_path }}/{{ inventory_hostname }}" _logfile: "{{ _hostdir }}/var/log/installer/curtin-install.log" _crashdir: "{{ _hostdir }}/var/crash/" @@ -154,7 +134,6 @@ - name: Take guest screenshot ansible.builtin.command: "virsh screenshot {{ inventory_hostname }} {{ debug_output_screenshot }}" delegate_to: localhost - when: molecule_debug become: true - name: End play for lvm guests @@ -171,7 +150,6 @@ delegate_to: localhost become: true block: - - name: Create output hostname directory ansible.builtin.file: state: directory diff --git a/poetry.lock b/poetry.lock index 4936fc9..851d10f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -16,13 +16,13 @@ ansible-core = ">=2.15.7,<2.16.0" [[package]] name = "ansible-compat" -version = "4.1.10" +version = "4.1.11" description = "Ansible compatibility goodies" optional = false python-versions = ">=3.9" files = [ - {file = "ansible-compat-4.1.10.tar.gz", hash = "sha256:2be8c7b510d2e15eed1e9ef443209d67d9aec8f427026b88936d4535ff59863d"}, - {file = "ansible_compat-4.1.10-py3-none-any.whl", hash = "sha256:f09c3137c9f5f65d38caed44f1a1565c0e7170df720d461e76839beda6018edb"}, + {file = "ansible-compat-4.1.11.tar.gz", hash = "sha256:b3e9f9d7c3a1ce6222de444e9dc6fece7eba70ac64f2a0befdc4e2d542018b4a"}, + {file = "ansible_compat-4.1.11-py3-none-any.whl", hash = "sha256:74a91807808a39af48ab6595811b9340d1458db26b138362f48bf39292190705"}, ] [package.dependencies] @@ -34,7 +34,7 @@ subprocess-tee = ">=0.4.1" [package.extras] docs = ["argparse-manpage", "black", "mkdocs-ansible[lock] (>=0.1.2)"] -test = ["coverage", "pip-tools", "pytest (>=7.2.0)", "pytest-mock", "pytest-plus"] +test = ["coverage", "pip-tools", "pytest (>=7.2.0)", "pytest-mock", "pytest-plus (>=0.6.1)"] [[package]] name = "ansible-core" @@ -56,17 +56,17 @@ resolvelib = ">=0.5.3,<1.1.0" [[package]] name = "ansible-lint" -version = "6.20.3" +version = "24.2.0" description = "Checks playbooks for practices and behavior that could potentially be improved" optional = false -python-versions = ">=3.9" +python-versions = ">=3.10" files = [ - {file = "ansible-lint-6.20.3.tar.gz", hash = "sha256:7cb8efffad21cb869b0b58894e5cfe3437014ba7c61812c956c72dfebc99a0b8"}, - {file = "ansible_lint-6.20.3-py3-none-any.whl", hash = "sha256:166b66c41212b350665e0fc35497d33a05c7b90a6ed4ab01ed0f381cdeadbbef"}, + {file = "ansible-lint-24.2.0.tar.gz", hash = "sha256:6bc5d6273f33711ec6d370dfe5fdbe97a64b4c36c2a7a19a249401326eb03616"}, + {file = "ansible_lint-24.2.0-py3-none-any.whl", hash = "sha256:755f369c6baf601b09c4931a4e6bd0df3d79c54eb519f093e5db6ab52ad03e0c"}, ] [package.dependencies] -ansible-compat = ">=4.1.10" +ansible-compat = ">=4.1.11" ansible-core = ">=2.12.0" black = ">=22.8.0" filelock = ">=3.3.0" @@ -74,17 +74,15 @@ jsonschema = ">=4.10.0" packaging = ">=21.3" pathspec = ">=0.10.3" pyyaml = ">=5.4.1" -requests = ">=2.31.0" rich = ">=12.0.0" -"ruamel.yaml" = ">=0.17.0,<0.17.29 || >0.17.29,<0.17.30 || >0.17.30,<0.18" +"ruamel.yaml" = ">=0.18.5" subprocess-tee = ">=0.4.1" wcmatch = ">=8.1.2" yamllint = ">=1.30.0" [package.extras] -docs = ["mkdocs-ansible[lock] (>=0.2.0)", "pipdeptree (>=2.7.1)"] -lock = ["ansible-compat (==4.1.10)", "ansible-core (==2.15.4)", "attrs (==23.1.0)", "black (==23.9.1)", "bracex (==2.4)", "certifi (==2023.7.22)", "cffi (==1.16.0)", "charset-normalizer (==3.2.0)", "click (==8.1.7)", "cryptography (==41.0.4)", "filelock (==3.12.4)", "idna (==3.4)", "importlib-resources (==5.0.7)", "jinja2 (==3.1.2)", "jsonschema (==4.19.1)", "jsonschema-specifications (==2023.7.1)", "markdown-it-py (==3.0.0)", "markupsafe (==2.1.3)", "mdurl (==0.1.2)", "mypy-extensions (==1.0.0)", "packaging (==23.1)", "pathspec (==0.11.2)", "platformdirs (==3.10.0)", "pycparser (==2.21)", "pygments (==2.16.1)", "pyyaml (==6.0.1)", "referencing (==0.30.2)", "requests (==2.31.0)", "rich (==13.5.3)", "rpds-py (==0.10.3)", "ruamel-yaml (==0.17.33)", "subprocess-tee (==0.4.1)", "tomli (==2.0.1)", "typing-extensions (==4.8.0)", "urllib3 (==2.0.5)", "wcmatch (==8.5)", "yamllint (==1.32.0)"] -test = ["black", "coverage-enable-subprocess", "coverage[toml] (>=6.4.4)", "jmespath", "mypy", "netaddr", "psutil", "pylint", "pytest (>=7.2.2)", "pytest-mock", "pytest-plus (>=0.2)", "pytest-xdist (>=2.1.0)", "ruamel-yaml-clib", "ruamel.yaml (>=0.17.31,<0.18)", "spdx-tools (>=0.7.1,<0.8.0)", "types-jsonschema", "types-pyyaml"] +docs = ["mkdocs-ansible (>=0.2.0)", "pipdeptree (>=2.7.1)"] +test = ["black", "coverage-enable-subprocess", "coverage[toml] (>=6.4.4)", "jmespath", "license-expression (>=30.1.1)", "mypy", "netaddr", "psutil", "pylint", "pytest (>=7.2.2)", "pytest-mock", "pytest-plus (>=0.6)", "pytest-xdist (>=2.1.0)", "ruamel-yaml-clib", "ruamel.yaml (>=0.17.31)", "types-jsonschema", "types-pyyaml"] [[package]] name = "attrs" @@ -159,17 +157,6 @@ files = [ {file = "bracex-2.4.tar.gz", hash = "sha256:a27eaf1df42cf561fed58b7a8f3fdf129d1ea16a81e1fadd1d17989bc6384beb"}, ] -[[package]] -name = "certifi" -version = "2023.7.22" -description = "Python package for providing Mozilla's CA Bundle." -optional = false -python-versions = ">=3.6" -files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, - {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, -] - [[package]] name = "cffi" version = "1.16.0" @@ -234,105 +221,6 @@ files = [ [package.dependencies] pycparser = "*" -[[package]] -name = "charset-normalizer" -version = "3.3.0" -description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "charset-normalizer-3.3.0.tar.gz", hash = "sha256:63563193aec44bce707e0c5ca64ff69fa72ed7cf34ce6e11d5127555756fd2f6"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:effe5406c9bd748a871dbcaf3ac69167c38d72db8c9baf3ff954c344f31c4cbe"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4162918ef3098851fcd8a628bf9b6a98d10c380725df9e04caf5ca6dd48c847a"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0570d21da019941634a531444364f2482e8db0b3425fcd5ac0c36565a64142c8"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5707a746c6083a3a74b46b3a631d78d129edab06195a92a8ece755aac25a3f3d"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:278c296c6f96fa686d74eb449ea1697f3c03dc28b75f873b65b5201806346a69"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a4b71f4d1765639372a3b32d2638197f5cd5221b19531f9245fcc9ee62d38f56"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5969baeaea61c97efa706b9b107dcba02784b1601c74ac84f2a532ea079403e"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3f93dab657839dfa61025056606600a11d0b696d79386f974e459a3fbc568ec"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:db756e48f9c5c607b5e33dd36b1d5872d0422e960145b08ab0ec7fd420e9d649"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:232ac332403e37e4a03d209a3f92ed9071f7d3dbda70e2a5e9cff1c4ba9f0678"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:e5c1502d4ace69a179305abb3f0bb6141cbe4714bc9b31d427329a95acfc8bdd"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:2502dd2a736c879c0f0d3e2161e74d9907231e25d35794584b1ca5284e43f596"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23e8565ab7ff33218530bc817922fae827420f143479b753104ab801145b1d5b"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-win32.whl", hash = "sha256:1872d01ac8c618a8da634e232f24793883d6e456a66593135aeafe3784b0848d"}, - {file = "charset_normalizer-3.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:557b21a44ceac6c6b9773bc65aa1b4cc3e248a5ad2f5b914b91579a32e22204d"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d7eff0f27edc5afa9e405f7165f85a6d782d308f3b6b9d96016c010597958e63"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6a685067d05e46641d5d1623d7c7fdf15a357546cbb2f71b0ebde91b175ffc3e"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0d3d5b7db9ed8a2b11a774db2bbea7ba1884430a205dbd54a32d61d7c2a190fa"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2935ffc78db9645cb2086c2f8f4cfd23d9b73cc0dc80334bc30aac6f03f68f8c"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fe359b2e3a7729010060fbca442ca225280c16e923b37db0e955ac2a2b72a05"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:380c4bde80bce25c6e4f77b19386f5ec9db230df9f2f2ac1e5ad7af2caa70459"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0d1e3732768fecb052d90d62b220af62ead5748ac51ef61e7b32c266cac9293"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1b2919306936ac6efb3aed1fbf81039f7087ddadb3160882a57ee2ff74fd2382"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:f8888e31e3a85943743f8fc15e71536bda1c81d5aa36d014a3c0c44481d7db6e"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:82eb849f085624f6a607538ee7b83a6d8126df6d2f7d3b319cb837b289123078"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:7b8b8bf1189b3ba9b8de5c8db4d541b406611a71a955bbbd7385bbc45fcb786c"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:5adf257bd58c1b8632046bbe43ee38c04e1038e9d37de9c57a94d6bd6ce5da34"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:c350354efb159b8767a6244c166f66e67506e06c8924ed74669b2c70bc8735b1"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-win32.whl", hash = "sha256:02af06682e3590ab952599fbadac535ede5d60d78848e555aa58d0c0abbde786"}, - {file = "charset_normalizer-3.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:86d1f65ac145e2c9ed71d8ffb1905e9bba3a91ae29ba55b4c46ae6fc31d7c0d4"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:3b447982ad46348c02cb90d230b75ac34e9886273df3a93eec0539308a6296d7"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:abf0d9f45ea5fb95051c8bfe43cb40cda383772f7e5023a83cc481ca2604d74e"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b09719a17a2301178fac4470d54b1680b18a5048b481cb8890e1ef820cb80455"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b3d9b48ee6e3967b7901c052b670c7dda6deb812c309439adaffdec55c6d7b78"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:edfe077ab09442d4ef3c52cb1f9dab89bff02f4524afc0acf2d46be17dc479f5"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3debd1150027933210c2fc321527c2299118aa929c2f5a0a80ab6953e3bd1908"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86f63face3a527284f7bb8a9d4f78988e3c06823f7bea2bd6f0e0e9298ca0403"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:24817cb02cbef7cd499f7c9a2735286b4782bd47a5b3516a0e84c50eab44b98e"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c71f16da1ed8949774ef79f4a0260d28b83b3a50c6576f8f4f0288d109777989"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:9cf3126b85822c4e53aa28c7ec9869b924d6fcfb76e77a45c44b83d91afd74f9"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:b3b2316b25644b23b54a6f6401074cebcecd1244c0b8e80111c9a3f1c8e83d65"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:03680bb39035fbcffe828eae9c3f8afc0428c91d38e7d61aa992ef7a59fb120e"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4cc152c5dd831641e995764f9f0b6589519f6f5123258ccaca8c6d34572fefa8"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-win32.whl", hash = "sha256:b8f3307af845803fb0b060ab76cf6dd3a13adc15b6b451f54281d25911eb92df"}, - {file = "charset_normalizer-3.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:8eaf82f0eccd1505cf39a45a6bd0a8cf1c70dcfc30dba338207a969d91b965c0"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dc45229747b67ffc441b3de2f3ae5e62877a282ea828a5bdb67883c4ee4a8810"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f4a0033ce9a76e391542c182f0d48d084855b5fcba5010f707c8e8c34663d77"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ada214c6fa40f8d800e575de6b91a40d0548139e5dc457d2ebb61470abf50186"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b1121de0e9d6e6ca08289583d7491e7fcb18a439305b34a30b20d8215922d43c"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1063da2c85b95f2d1a430f1c33b55c9c17ffaf5e612e10aeaad641c55a9e2b9d"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:70f1d09c0d7748b73290b29219e854b3207aea922f839437870d8cc2168e31cc"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:250c9eb0f4600361dd80d46112213dff2286231d92d3e52af1e5a6083d10cad9"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:750b446b2ffce1739e8578576092179160f6d26bd5e23eb1789c4d64d5af7dc7"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:fc52b79d83a3fe3a360902d3f5d79073a993597d48114c29485e9431092905d8"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:588245972aca710b5b68802c8cad9edaa98589b1b42ad2b53accd6910dad3545"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e39c7eb31e3f5b1f88caff88bcff1b7f8334975b46f6ac6e9fc725d829bc35d4"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-win32.whl", hash = "sha256:abecce40dfebbfa6abf8e324e1860092eeca6f7375c8c4e655a8afb61af58f2c"}, - {file = "charset_normalizer-3.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:24a91a981f185721542a0b7c92e9054b7ab4fea0508a795846bc5b0abf8118d4"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:67b8cc9574bb518ec76dc8e705d4c39ae78bb96237cb533edac149352c1f39fe"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ac71b2977fb90c35d41c9453116e283fac47bb9096ad917b8819ca8b943abecd"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3ae38d325b512f63f8da31f826e6cb6c367336f95e418137286ba362925c877e"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:542da1178c1c6af8873e143910e2269add130a299c9106eef2594e15dae5e482"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:30a85aed0b864ac88309b7d94be09f6046c834ef60762a8833b660139cfbad13"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aae32c93e0f64469f74ccc730a7cb21c7610af3a775157e50bbd38f816536b38"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15b26ddf78d57f1d143bdf32e820fd8935d36abe8a25eb9ec0b5a71c82eb3895"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f5d10bae5d78e4551b7be7a9b29643a95aded9d0f602aa2ba584f0388e7a557"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:249c6470a2b60935bafd1d1d13cd613f8cd8388d53461c67397ee6a0f5dce741"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:c5a74c359b2d47d26cdbbc7845e9662d6b08a1e915eb015d044729e92e7050b7"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:b5bcf60a228acae568e9911f410f9d9e0d43197d030ae5799e20dca8df588287"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:187d18082694a29005ba2944c882344b6748d5be69e3a89bf3cc9d878e548d5a"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:81bf654678e575403736b85ba3a7867e31c2c30a69bc57fe88e3ace52fb17b89"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-win32.whl", hash = "sha256:85a32721ddde63c9df9ebb0d2045b9691d9750cb139c161c80e500d210f5e26e"}, - {file = "charset_normalizer-3.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:468d2a840567b13a590e67dd276c570f8de00ed767ecc611994c301d0f8c014f"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e0fc42822278451bc13a2e8626cf2218ba570f27856b536e00cfa53099724828"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:09c77f964f351a7369cc343911e0df63e762e42bac24cd7d18525961c81754f4"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:12ebea541c44fdc88ccb794a13fe861cc5e35d64ed689513a5c03d05b53b7c82"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:805dfea4ca10411a5296bcc75638017215a93ffb584c9e344731eef0dcfb026a"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:96c2b49eb6a72c0e4991d62406e365d87067ca14c1a729a870d22354e6f68115"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aaf7b34c5bc56b38c931a54f7952f1ff0ae77a2e82496583b247f7c969eb1479"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:619d1c96099be5823db34fe89e2582b336b5b074a7f47f819d6b3a57ff7bdb86"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a0ac5e7015a5920cfce654c06618ec40c33e12801711da6b4258af59a8eff00a"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:93aa7eef6ee71c629b51ef873991d6911b906d7312c6e8e99790c0f33c576f89"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7966951325782121e67c81299a031f4c115615e68046f79b85856b86ebffc4cd"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:02673e456dc5ab13659f85196c534dc596d4ef260e4d86e856c3b2773ce09843"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:c2af80fb58f0f24b3f3adcb9148e6203fa67dd3f61c4af146ecad033024dde43"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:153e7b6e724761741e0974fc4dcd406d35ba70b92bfe3fedcb497226c93b9da7"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-win32.whl", hash = "sha256:d47ecf253780c90ee181d4d871cd655a789da937454045b17b5798da9393901a"}, - {file = "charset_normalizer-3.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:d97d85fa63f315a8bdaba2af9a6a686e0eceab77b3089af45133252618e70884"}, - {file = "charset_normalizer-3.3.0-py3-none-any.whl", hash = "sha256:e46cd37076971c1040fc8c41273a8b3e2c624ce4f2be3f5dfcb7a430c1d3acc2"}, -] - [[package]] name = "click" version = "8.1.7" @@ -462,17 +350,6 @@ docs = ["furo (>=2023.7.26)", "sphinx (>=7.1.2)", "sphinx-autodoc-typehints (>=1 testing = ["covdefaults (>=2.3)", "coverage (>=7.3)", "diff-cover (>=7.7)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "pytest-timeout (>=2.1)"] typing = ["typing-extensions (>=4.7.1)"] -[[package]] -name = "idna" -version = "3.4" -description = "Internationalized Domain Names in Applications (IDNA)" -optional = false -python-versions = ">=3.5" -files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, -] - [[package]] name = "jinja2" version = "3.1.3" @@ -734,13 +611,13 @@ files = [ [[package]] name = "molecule" -version = "6.0.2" +version = "6.0.3" description = "Molecule aids in the development and testing of Ansible roles" optional = false python-versions = ">=3.9" files = [ - {file = "molecule-6.0.2-py3-none-any.whl", hash = "sha256:f4e941017587d6aadf4c75ec55338d16c17ad6119a2f8306cfe7b9e05d49db11"}, - {file = "molecule-6.0.2.tar.gz", hash = "sha256:b919353f799746de60b16a27575627783e39c268fdf2f2aa0372f0162c7b5478"}, + {file = "molecule-6.0.3-py3-none-any.whl", hash = "sha256:8e5d7a7841f9ed5dd26878d24951ec030b86f780aca17ffc509db8076f42de3d"}, + {file = "molecule-6.0.3.tar.gz", hash = "sha256:d2a881062fcc5ef1e08c1e5127c04354d2c95171955e270bd82b3fbfef72d3b0"}, ] [package.dependencies] @@ -758,7 +635,7 @@ rich = ">=9.5.1" wcmatch = ">=8.1.2" [package.extras] -docs = ["linkchecker", "mkdocs-ansible[lock] (>=0.1.4)", "pipdeptree (>=2.4.0)"] +docs = ["linkchecker (==10.2.1)", "mkdocs-ansible[lock] (>=0.2.0)", "pipdeptree (>=2.4.0)"] test = ["ansi2html (>=1.8.0)", "ansible-lint (>=6.12.1)", "check-jsonschema", "coverage (>=7.0.3)", "filelock (>=3.9.0)", "pexpect (>=4.8.0,<5)", "pytest (>=7.2.0)", "pytest-mock (>=3.10.0)", "pytest-plus (>=0.4.0)", "pytest-xdist (>=3.1.0)"] testinfra = ["pytest-testinfra (>=8.1.0)"] @@ -795,6 +672,23 @@ files = [ {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, ] +[[package]] +name = "passlib" +version = "1.7.4" +description = "comprehensive password hashing framework supporting over 30 schemes" +optional = false +python-versions = "*" +files = [ + {file = "passlib-1.7.4-py2.py3-none-any.whl", hash = "sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1"}, + {file = "passlib-1.7.4.tar.gz", hash = "sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04"}, +] + +[package.extras] +argon2 = ["argon2-cffi (>=18.2.0)"] +bcrypt = ["bcrypt (>=3.1.0)"] +build-docs = ["cloud-sptheme (>=1.10.1)", "sphinx (>=1.6)", "sphinxcontrib-fulltoc (>=1.2.0)"] +totp = ["cryptography"] + [[package]] name = "pathspec" version = "0.11.2" @@ -886,7 +780,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -936,27 +829,6 @@ files = [ attrs = ">=22.2.0" rpds-py = ">=0.7.0" -[[package]] -name = "requests" -version = "2.31.0" -description = "Python HTTP for Humans." -optional = false -python-versions = ">=3.7" -files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, -] - -[package.dependencies] -certifi = ">=2017.4.17" -charset-normalizer = ">=2,<4" -idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<3" - -[package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] - [[package]] name = "resolvelib" version = "1.0.1" @@ -1100,20 +972,20 @@ files = [ [[package]] name = "ruamel-yaml" -version = "0.17.33" +version = "0.18.6" description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" optional = false -python-versions = ">=3" +python-versions = ">=3.7" files = [ - {file = "ruamel.yaml-0.17.33-py3-none-any.whl", hash = "sha256:2080c7a02b8a30fb3c06727cdf3e254a64055eedf3aa2d17c2b669639c04971b"}, - {file = "ruamel.yaml-0.17.33.tar.gz", hash = "sha256:5c56aa0bff2afceaa93bffbfc78b450b7dc1e01d5edb80b3a570695286ae62b1"}, + {file = "ruamel.yaml-0.18.6-py3-none-any.whl", hash = "sha256:57b53ba33def16c4f3d807c0ccbc00f8a6081827e81ba2491691b76882d0c636"}, + {file = "ruamel.yaml-0.18.6.tar.gz", hash = "sha256:8b27e6a217e786c6fbe5634d8f3f11bc63e0f80f6a5890f28863d9c45aac311b"}, ] [package.dependencies] -"ruamel.yaml.clib" = {version = ">=0.2.7", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.12\""} +"ruamel.yaml.clib" = {version = ">=0.2.7", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.13\""} [package.extras] -docs = ["ryd"] +docs = ["mercurial (>5.7)", "ryd"] jinja2 = ["ruamel.yaml.jinja2 (>=0.2)"] [[package]] @@ -1176,23 +1048,6 @@ files = [ [package.extras] test = ["enrich (>=1.2.6)", "molecule (>=3.4.0)", "pytest (>=6.2.5)", "pytest-cov (>=2.12.1)", "pytest-plus (>=0.2)", "pytest-xdist (>=2.3.0)"] -[[package]] -name = "urllib3" -version = "2.0.7" -description = "HTTP library with thread-safe connection pooling, file post, and more." -optional = false -python-versions = ">=3.7" -files = [ - {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, - {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, -] - -[package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] -socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] -zstd = ["zstandard (>=0.18.0)"] - [[package]] name = "wcmatch" version = "8.5" @@ -1228,4 +1083,4 @@ dev = ["doc8", "flake8", "flake8-import-order", "rstcheck[sphinx]", "sphinx"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "ed6aef5b02bb6e195f064e801f4e5cb925ff594508c822344dc2b252f271933c" +content-hash = "070b26f562674c0db2961e12728fd1a6fca05394dc245a272996bb86377d2220" diff --git a/pyproject.toml b/pyproject.toml index d1409d4..f65b833 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,13 @@ readme = "README.md" python = "^3.11" [tool.poetry.group.dev.dependencies] -ansible = "^8.5.0" -ansible-lint = { version = "*", markers = "platform_system != 'Windows'" } +ansible-lint = { version = "^24.2.0", markers = "platform_system != 'Windows'" } libvirt-python = "^9.8.0" +molecule = "^6.0.3" netaddr = "^0.9.0" -molecule = "^6.0.2" +ansible = "^8.5.0" lxml = "^5.1.0" +passlib = "^1.7.4" [build-system] requires = ["poetry-core"] diff --git a/requirements.yml b/requirements.yml index d9b2c03..ad6b4c7 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,6 +1,3 @@ --- -roles: - - nephelaiio.plugins - - nephelaiio.pip collections: - ansible.posix