diff --git a/.ansible-lint b/.ansible-lint index f6d67e7..4457599 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -2,4 +2,4 @@ exclude_paths: - molecule/ skip_list: - - '306' # [306] Shells that use pipes should set the pipefail option + - '306' # [306] Shells that use pipes should set the pipefail option diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0b0983..629df60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,9 @@ --- -on: [push, pull_request] +on: + push: + pull_request: + schedule: + - cron: '0 3 * * 0' jobs: Lint: diff --git a/meta/main.yml b/meta/main.yml index fcb4824..202263f 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,17 +12,16 @@ galaxy_info: versions: - "7" - "8" + - "9" - name: Debian versions: - - jessie - - stretch - buster + - bullseye + - bookworm - name: Ubuntu versions: - - trusty - - xenial - - bionic - focal + - jammy galaxy_tags: - dnsdist - dns diff --git a/molecule/dnsdist-16/molecule.yml b/molecule/dnsdist-16/molecule.yml index 923de10..5099bc0 100644 --- a/molecule/dnsdist-16/molecule.yml +++ b/molecule/dnsdist-16/molecule.yml @@ -14,22 +14,30 @@ platforms: image: centos:7 dockerfile_tpl: centos-systemd - - name: centos-8 - image: quay.io/centos/centos:stream8 + - name: oraclelinux-8 + image: oraclelinux:8 dockerfile_tpl: centos-systemd - - name: ubuntu-1804 - image: ubuntu:18.04 - dockerfile_tpl: debian-systemd - - name: ubuntu-2004 image: ubuntu:20.04 - dockerfile_tpl: debian-systemd + dockerfile_tpl: ubuntu-systemd - name: debian-10 image: debian:10 dockerfile_tpl: debian-systemd + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-python3 + + - name: rockylinux-8 + image: rockylinux:8 + dockerfile_tpl: centos-systemd + + - name: almalinux-8 + image: almalinux:8 + dockerfile_tpl: centos-systemd + provisioner: name: ansible options: @@ -42,7 +50,7 @@ provisioner: create: ../resources/create.yml destroy: ../resources/destroy.yml prepare: ../resources/prepare.yml - + lint: yamllint vars tasks defaults meta verifier: diff --git a/molecule/dnsdist-17/molecule.yml b/molecule/dnsdist-17/molecule.yml index 84b19fb..3371509 100644 --- a/molecule/dnsdist-17/molecule.yml +++ b/molecule/dnsdist-17/molecule.yml @@ -14,26 +14,46 @@ platforms: image: centos:7 dockerfile_tpl: centos-systemd - - name: centos-8 - image: quay.io/centos/centos:stream8 + - name: oraclelinux-8 + image: oraclelinux:8 dockerfile_tpl: centos-systemd - name: oraclelinux-9 image: oraclelinux:9 - dockerfile_tpl: oraclelinux-systemd - - - name: ubuntu-1804 - image: ubuntu:18.04 - dockerfile_tpl: debian-systemd + dockerfile_tpl: centos-systemd - name: ubuntu-2004 image: ubuntu:20.04 - dockerfile_tpl: debian-systemd + dockerfile_tpl: ubuntu-systemd + + - name: ubuntu-2204 + image: ubuntu:22.04 + dockerfile_tpl: ubuntu-systemd - name: debian-10 image: debian:10 dockerfile_tpl: debian-systemd + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-python3 + + - name: rockylinux-8 + image: rockylinux:8 + dockerfile_tpl: centos-systemd + + - name: almalinux-8 + image: almalinux:8 + dockerfile_tpl: centos-systemd + + - name: rockylinux-9 + image: rockylinux:9.0 + dockerfile_tpl: centos-systemd + + - name: almalinux-9 + image: almalinux:9 + dockerfile_tpl: centos-systemd + provisioner: name: ansible options: diff --git a/molecule/dnsdist-18/molecule.yml b/molecule/dnsdist-18/molecule.yml index 83f907e..1d949c3 100644 --- a/molecule/dnsdist-18/molecule.yml +++ b/molecule/dnsdist-18/molecule.yml @@ -14,22 +14,50 @@ platforms: image: centos:7 dockerfile_tpl: centos-systemd - - name: centos-8 - image: quay.io/centos/centos:stream8 + - name: oraclelinux-8 + image: oraclelinux:8 dockerfile_tpl: centos-systemd - name: oraclelinux-9 image: oraclelinux:9 - dockerfile_tpl: oraclelinux-systemd + dockerfile_tpl: centos-systemd - name: ubuntu-2004 image: ubuntu:20.04 dockerfile_tpl: ubuntu-systemd + - name: ubuntu-2204 + image: ubuntu:22.04 + dockerfile_tpl: ubuntu-systemd + - name: debian-10 image: debian:10 dockerfile_tpl: debian-systemd + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-python3 + + - name: debian-12 + image: debian:12 + dockerfile_tpl: debian-python3 + + - name: rockylinux-8 + image: rockylinux:8 + dockerfile_tpl: centos-systemd + + - name: almalinux-8 + image: almalinux:8 + dockerfile_tpl: centos-systemd + + - name: rockylinux-9 + image: rockylinux:9.0 + dockerfile_tpl: centos-systemd + + - name: almalinux-9 + image: almalinux:9 + dockerfile_tpl: centos-systemd + provisioner: name: ansible options: @@ -43,7 +71,7 @@ provisioner: destroy: ../resources/destroy.yml prepare: ../resources/prepare.yml -#lint: yamllint vars tasks defaults meta +# lint: yamllint vars tasks defaults meta verifier: name: testinfra diff --git a/molecule/dnsdist-master/molecule.yml b/molecule/dnsdist-master/molecule.yml index 20681ac..c0709d3 100644 --- a/molecule/dnsdist-master/molecule.yml +++ b/molecule/dnsdist-master/molecule.yml @@ -14,22 +14,50 @@ platforms: image: centos:7 dockerfile_tpl: centos-systemd - - name: centos-8 - image: quay.io/centos/centos:stream8 + - name: oraclelinux-8 + image: oraclelinux:8 dockerfile_tpl: centos-systemd - + - name: oraclelinux-9 image: oraclelinux:9 - dockerfile_tpl: oraclelinux-systemd + dockerfile_tpl: centos-systemd - name: ubuntu-2004 image: ubuntu:20.04 - dockerfile_tpl: debian-systemd + dockerfile_tpl: ubuntu-systemd + + - name: ubuntu-2204 + image: ubuntu:22.04 + dockerfile_tpl: ubuntu-systemd - name: debian-10 image: debian:10 dockerfile_tpl: debian-systemd + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-python3 + + - name: debian-12 + image: debian:12 + dockerfile_tpl: debian-python3 + + - name: rockylinux-8 + image: rockylinux:8 + dockerfile_tpl: centos-systemd + + - name: almalinux-8 + image: almalinux:8 + dockerfile_tpl: centos-systemd + + - name: rockylinux-9 + image: rockylinux:9.0 + dockerfile_tpl: centos-systemd + + - name: almalinux-9 + image: almalinux:9 + dockerfile_tpl: centos-systemd + provisioner: name: ansible options: diff --git a/molecule/resources/Dockerfile.centos-systemd.j2 b/molecule/resources/Dockerfile.centos-systemd.j2 index 120febf..16479b2 100644 --- a/molecule/resources/Dockerfile.centos-systemd.j2 +++ b/molecule/resources/Dockerfile.centos-systemd.j2 @@ -5,7 +5,7 @@ FROM {{ item.image }} ENV container docker # Configure systemd to run into the container (see https://hub.docker.com/_/centos/) -RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +RUN (cd /lib/systemd/system/sysinit.target.wants/ && for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ @@ -22,6 +22,6 @@ VOLUME [ "/sys/fs/cgroup" ] CMD ["/usr/sbin/init"] -RUN if [ $(command -v dnf) ] && [ $(rpm -E %{rhel}) -eq 8 ]; then dnf makecache && dnf --assumeyes install python3 python3-devel python*-dnf bash iproute && dnf clean all; \ +RUN if [ $(command -v dnf) ] && [ $(rpm -E %{rhel}) -eq 8 ] || [ $(rpm -E %{rhel}) -eq 9 ]; then dnf makecache && dnf --assumeyes install python3 python3-devel python*-dnf bash iproute && dnf clean all; \ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl net-tools bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; fi diff --git a/molecule/resources/Dockerfile.debian-python3.j2 b/molecule/resources/Dockerfile.debian-python3.j2 new file mode 100644 index 0000000..c608141 --- /dev/null +++ b/molecule/resources/Dockerfile.debian-python3.j2 @@ -0,0 +1,25 @@ +# Molecule managed + +FROM {{ item.image }} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y systemd && apt-get clean; fi +RUN if [ ! -e /sbin/init ]; then ln -s /lib/systemd/systemd /sbin/init ; fi + +ENV container docker + +# Don't start the optional systemd services. +RUN find /etc/systemd/system \ + /lib/systemd/system \ + -path '*.wants/*' \ + -not -name '*journald*' \ + -not -name '*systemd-tmpfiles*' \ + -not -name '*systemd-user-sessions*' \ + -exec rm \{} \; + +RUN systemctl set-default multi-user.target + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/sbin/init"] + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python3 sudo bash net-tools ca-certificates && apt-get clean; fi diff --git a/molecule/resources/host_vars/centos-8.yml b/molecule/resources/host_vars/centos-8.yml index 0a909a2..17c2edf 100644 --- a/molecule/resources/host_vars/centos-8.yml +++ b/molecule/resources/host_vars/centos-8.yml @@ -1,3 +1,3 @@ --- -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/molecule/resources/tests/all/test_common.py b/molecule/resources/tests/all/test_common.py index c669eba..2794545 100644 --- a/molecule/resources/tests/all/test_common.py +++ b/molecule/resources/tests/all/test_common.py @@ -1,7 +1,7 @@ import re debian_os = ['debian', 'ubuntu'] -rhel_os = ['redhat', 'centos', 'oracleserver', 'oraclelinux'] +rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux'] def test_distribution(host): diff --git a/molecule/resources/tests/repo-16/test_repo_16.py b/molecule/resources/tests/repo-16/test_repo_16.py index 6d537ac..13e4a32 100644 --- a/molecule/resources/tests/repo-16/test_repo_16.py +++ b/molecule/resources/tests/repo-16/test_repo_16.py @@ -1,6 +1,6 @@ debian_os = ['debian', 'ubuntu'] -rhel_os = ['redhat', 'centos'] +rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux'] def test_repo_file(host): diff --git a/molecule/resources/tests/repo-17/test_repo_17.py b/molecule/resources/tests/repo-17/test_repo_17.py index fbfb560..1e486d1 100644 --- a/molecule/resources/tests/repo-17/test_repo_17.py +++ b/molecule/resources/tests/repo-17/test_repo_17.py @@ -1,6 +1,6 @@ debian_os = ['debian', 'ubuntu'] -rhel_os = ['redhat', 'centos', 'oracleserver', 'oraclelinux'] +rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux'] def test_repo_file(host): diff --git a/molecule/resources/tests/repo-18/test_repo_18.py b/molecule/resources/tests/repo-18/test_repo_18.py index a94fef7..c6c2bb2 100644 --- a/molecule/resources/tests/repo-18/test_repo_18.py +++ b/molecule/resources/tests/repo-18/test_repo_18.py @@ -1,6 +1,6 @@ debian_os = ['debian', 'ubuntu'] -rhel_os = ['redhat', 'centos', 'oracleserver', 'oraclelinux'] +rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux'] def test_repo_file(host): diff --git a/molecule/resources/tests/repo-master/test_repo_master.py b/molecule/resources/tests/repo-master/test_repo_master.py index deb68c2..742311b 100644 --- a/molecule/resources/tests/repo-master/test_repo_master.py +++ b/molecule/resources/tests/repo-master/test_repo_master.py @@ -1,7 +1,7 @@ import re debian_os = ['debian', 'ubuntu'] -rhel_os = ['redhat', 'centos', 'oracleserver', 'oraclelinux'] +rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux'] def test_repo_file(host): f = None diff --git a/tasks/repo-RedHat.yml b/tasks/repo-RedHat.yml index 0b4fe9d..377c299 100644 --- a/tasks/repo-RedHat.yml +++ b/tasks/repo-RedHat.yml @@ -6,25 +6,29 @@ ansible.builtin.package: name: epel-release state: present - when: ansible_distribution in [ 'CentOS' ] + when: ansible_distribution in [ 'CentOS', 'Rocky', 'AlmaLinux' ] - - name: Import epel GPG key on oraclelinux-9 - ansible.builtin.rpm_key: - key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-9 + - name: Install epel-release on RHEL + ansible.builtin.package: + name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" state: present - when: ansible_distribution in [ 'OracleLinux' ] + when: ansible_distribution in [ 'RedHat' ] - - name: Install epel-release on RHEL/OracleLinux + - name: Install epel-release on OracleLinux ansible.builtin.package: - name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm + name: + - "oracle-epel-release-el{{ ansible_distribution_major_version }}" + - hostname state: present - when: ansible_distribution in [ 'RedHat', 'OracleLinux' ] + when: ansible_distribution in [ 'OracleLinux' ] - name: Install yum-plugin-priorities ansible.builtin.package: name: yum-plugin-priorities state: present - when: ansible_distribution in [ 'CentOS' ] and ansible_pkg_mgr in [ 'yum' ] + when: + - ansible_distribution in [ 'CentOS', 'Rocky', 'AlmaLinux' ] + - ansible_distribution_major_version | int < 8 - name: Add the dnsdist YUM Repository ansible.builtin.yum_repository: @@ -33,7 +37,7 @@ description: PowerDNS dnsdist Repository baseurl: "{{ dnsdist_install_repo['yum_repo_baseurl'] }}" gpgkey: "{{ dnsdist_install_repo['gpg_key'] }}" - gpgcheck: true + gpgcheck: yes priority: "90" state: present @@ -44,7 +48,7 @@ description: PowerDNS dnsdist Repository - debug symbols baseurl: "{{ dnsdist_install_repo['yum_debug_symbols_repo_baseurl'] }}" gpgkey: "{{ dnsdist_install_repo['gpg_key'] }}" - gpgcheck: true + gpgcheck: yes priority: "90" state: present when: dnsdist_install_debug_symbols_package