From d3663b1eb36e4676ca663c7de9a680e93f364f2e Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 13:30:47 +0100 Subject: [PATCH 1/9] Add support for DNSdist 19 and debian 11/12 --- molecule/dnsdist-19/converge.yml | 8 +++ molecule/dnsdist-19/molecule.yml | 63 +++++++++++++++++++ molecule/resources/host_vars/debian-11.yml | 3 + molecule/resources/host_vars/debian-12.yml | 3 + .../resources/tests/repo-19/test_repo_19.py | 32 ++++++++++ molecule/resources/vars/dnsdist-repo-19.yml | 7 +++ vars/main.yml | 9 +++ 7 files changed, 125 insertions(+) create mode 100644 molecule/dnsdist-19/converge.yml create mode 100644 molecule/dnsdist-19/molecule.yml create mode 100644 molecule/resources/host_vars/debian-11.yml create mode 100644 molecule/resources/host_vars/debian-12.yml create mode 100644 molecule/resources/tests/repo-19/test_repo_19.py create mode 100644 molecule/resources/vars/dnsdist-repo-19.yml diff --git a/molecule/dnsdist-19/converge.yml b/molecule/dnsdist-19/converge.yml new file mode 100644 index 0000000..bca2d5f --- /dev/null +++ b/molecule/dnsdist-19/converge.yml @@ -0,0 +1,8 @@ +--- + +- hosts: all + vars_files: + - ../resources/vars/dnsdist-common.yml + - ../resources/vars/dnsdist-repo-19.yml + roles: + - { role: powerdns.dnsdist } diff --git a/molecule/dnsdist-19/molecule.yml b/molecule/dnsdist-19/molecule.yml new file mode 100644 index 0000000..60c2926 --- /dev/null +++ b/molecule/dnsdist-19/molecule.yml @@ -0,0 +1,63 @@ +--- + +scenario: + name: dnsdist-19 + +driver: + name: docker + +dependency: + name: galaxy + +platforms: + - name: centos-7 + image: centos:7 + dockerfile_tpl: centos-systemd + + - name: centos-8 + image: quay.io/centos/centos:stream8 + dockerfile_tpl: centos-systemd + + - name: oraclelinux-9 + image: oraclelinux:9 + dockerfile_tpl: oraclelinux-systemd + + - name: ubuntu-2004 + image: ubuntu:20.04 + dockerfile_tpl: ubuntu-systemd + + - name: debian-10 + image: debian:10 + dockerfile_tpl: debian-systemd + + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-systemd + + - name: debian-12 + image: debian:12 + dockerfile_tpl: debian-systemd + +provisioner: + name: ansible + options: + diff: True + v: True + inventory: + links: + host_vars: ../resources/host_vars/ + playbooks: + create: ../resources/create.yml + destroy: ../resources/destroy.yml + prepare: ../resources/prepare.yml + +#lint: yamllint vars tasks defaults meta + +verifier: + name: testinfra + options: + vvv: True + directory: ../resources/tests/all + additional_files_or_dirs: + # path relative to 'directory' + - ../repo-19/ diff --git a/molecule/resources/host_vars/debian-11.yml b/molecule/resources/host_vars/debian-11.yml new file mode 100644 index 0000000..0a909a2 --- /dev/null +++ b/molecule/resources/host_vars/debian-11.yml @@ -0,0 +1,3 @@ +--- + +ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file diff --git a/molecule/resources/host_vars/debian-12.yml b/molecule/resources/host_vars/debian-12.yml new file mode 100644 index 0000000..0a909a2 --- /dev/null +++ b/molecule/resources/host_vars/debian-12.yml @@ -0,0 +1,3 @@ +--- + +ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file diff --git a/molecule/resources/tests/repo-19/test_repo_19.py b/molecule/resources/tests/repo-19/test_repo_19.py new file mode 100644 index 0000000..6c50114 --- /dev/null +++ b/molecule/resources/tests/repo-19/test_repo_19.py @@ -0,0 +1,32 @@ + +debian_os = ['debian', 'ubuntu'] +rhel_os = ['redhat', 'centos', 'oracleserver', 'oraclelinux'] + + +def test_repo_file(host): + f = None + if host.system_info.distribution.lower() in debian_os: + f = host.file('/etc/apt/sources.list.d/powerdns-dnsdist-19.list') + if host.system_info.distribution.lower() in rhel_os: + f = host.file('/etc/yum.repos.d/powerdns-dnsdist-19.repo') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' + + +def test_pdns_repo(host): + f = None + if host.system_info.distribution.lower() in debian_os: + f = host.file('/etc/apt/sources.list.d/powerdns-dnsdist-19.list') + if host.system_info.distribution.lower() in rhel_os: + f = host.file('/etc/yum.repos.d/powerdns-dnsdist-19.repo') + + assert f.exists + assert f.contains('dnsdist-19') + + +def test_pdns_version(host): + cmd = host.run('/usr/bin/dnsdist --version') + + assert 'dnsdist 1.9' in cmd.stdout diff --git a/molecule/resources/vars/dnsdist-repo-19.yml b/molecule/resources/vars/dnsdist-repo-19.yml new file mode 100644 index 0000000..994ef0d --- /dev/null +++ b/molecule/resources/vars/dnsdist-repo-19.yml @@ -0,0 +1,7 @@ +--- + +## +# Dnsdist 1.9.x Repository +## + +dnsdist_install_repo: "{{ dnsdist_powerdns_repo_19 }}" diff --git a/vars/main.yml b/vars/main.yml index acacc2a..4664669 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -34,3 +34,12 @@ dnsdist_powerdns_repo_18: yum_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-18 yum_debug_symbols_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-18/debug name: powerdns-dnsdist-18 + +dnsdist_powerdns_repo_19: + apt_repo_origin: repo.powerdns.com + apt_repo: deb [arch=amd64] http://repo.powerdns.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }}-dnsdist-19 main + gpg_key: http://repo.powerdns.com/FD380FBB-pub.asc + gpg_key_id: 9FAAA5577E8FCF62093D036C1B0C6205FD380FBB + yum_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-19 + yum_debug_symbols_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-18/debug + name: powerdns-dnsdist-19 From e304c9c15fb6f4c4ab711090da264cc46267ad69 Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 13:52:31 +0100 Subject: [PATCH 2/9] Remove 1804 test from 16 and 17; those repos no longer exist --- molecule/dnsdist-16/molecule.yml | 4 ---- molecule/dnsdist-17/molecule.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/molecule/dnsdist-16/molecule.yml b/molecule/dnsdist-16/molecule.yml index 923de10..da6c43e 100644 --- a/molecule/dnsdist-16/molecule.yml +++ b/molecule/dnsdist-16/molecule.yml @@ -18,10 +18,6 @@ platforms: image: quay.io/centos/centos:stream8 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 diff --git a/molecule/dnsdist-17/molecule.yml b/molecule/dnsdist-17/molecule.yml index 84b19fb..0968091 100644 --- a/molecule/dnsdist-17/molecule.yml +++ b/molecule/dnsdist-17/molecule.yml @@ -22,10 +22,6 @@ platforms: image: oraclelinux:9 dockerfile_tpl: oraclelinux-systemd - - name: ubuntu-1804 - image: ubuntu:18.04 - dockerfile_tpl: debian-systemd - - name: ubuntu-2004 image: ubuntu:20.04 dockerfile_tpl: debian-systemd From b83648dc9972e0b58f8d5de3d9a87e2760873c20 Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 13:54:49 +0100 Subject: [PATCH 3/9] Add v19 to github CI workflow --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0b0983..7592109 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,7 @@ jobs: - dnsdist-16 - dnsdist-17 - dnsdist-18 + - dnsdist-19 - dnsdist-master steps: - name: checkout From f48aa4ccc8ce14b140aeb7b4e71f53a8ec581eb6 Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 14:06:35 +0100 Subject: [PATCH 4/9] Debian 12 and up need python3 rather than python --- meta/main.yml | 1 + molecule/dnsdist-18/molecule.yml | 8 +++++++ molecule/dnsdist-19/molecule.yml | 2 +- molecule/resources/Dockerfile-debian-12.j2 | 25 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 molecule/resources/Dockerfile-debian-12.j2 diff --git a/meta/main.yml b/meta/main.yml index fcb4824..ebede4e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -17,6 +17,7 @@ galaxy_info: - jessie - stretch - buster + - bookworm - name: Ubuntu versions: - trusty diff --git a/molecule/dnsdist-18/molecule.yml b/molecule/dnsdist-18/molecule.yml index 83f907e..dc9029a 100644 --- a/molecule/dnsdist-18/molecule.yml +++ b/molecule/dnsdist-18/molecule.yml @@ -30,6 +30,14 @@ platforms: image: debian:10 dockerfile_tpl: debian-systemd + - name: debian-11 + image: debian:11 + dockerfile_tpl: debian-systemd + + - name: debian-12 + image: debian:12 + dockerfile_tpl: debian-12 + provisioner: name: ansible options: diff --git a/molecule/dnsdist-19/molecule.yml b/molecule/dnsdist-19/molecule.yml index 60c2926..8ca4cdd 100644 --- a/molecule/dnsdist-19/molecule.yml +++ b/molecule/dnsdist-19/molecule.yml @@ -36,7 +36,7 @@ platforms: - name: debian-12 image: debian:12 - dockerfile_tpl: debian-systemd + dockerfile_tpl: debian-12 provisioner: name: ansible diff --git a/molecule/resources/Dockerfile-debian-12.j2 b/molecule/resources/Dockerfile-debian-12.j2 new file mode 100644 index 0000000..c608141 --- /dev/null +++ b/molecule/resources/Dockerfile-debian-12.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 From ea0135b2c0c16effbcaefcb32d3b26d6ecfbe8e4 Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 14:10:48 +0100 Subject: [PATCH 5/9] ARGH. --- .../{Dockerfile-debian-12.j2 => Dockerfile.debian-12.j2} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename molecule/resources/{Dockerfile-debian-12.j2 => Dockerfile.debian-12.j2} (100%) diff --git a/molecule/resources/Dockerfile-debian-12.j2 b/molecule/resources/Dockerfile.debian-12.j2 similarity index 100% rename from molecule/resources/Dockerfile-debian-12.j2 rename to molecule/resources/Dockerfile.debian-12.j2 From ce70fff6584fe935fa3280c64a9daef7b5971bb6 Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 14:20:16 +0100 Subject: [PATCH 6/9] Fix dockerfile issue for debian-11 test run --- molecule/dnsdist-18/molecule.yml | 4 ++-- molecule/dnsdist-19/molecule.yml | 4 ++-- .../{Dockerfile.debian-12.j2 => Dockerfile.debian-python3.j2} | 0 molecule/resources/host_vars/debian-11.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename molecule/resources/{Dockerfile.debian-12.j2 => Dockerfile.debian-python3.j2} (100%) diff --git a/molecule/dnsdist-18/molecule.yml b/molecule/dnsdist-18/molecule.yml index dc9029a..f2a0375 100644 --- a/molecule/dnsdist-18/molecule.yml +++ b/molecule/dnsdist-18/molecule.yml @@ -32,11 +32,11 @@ platforms: - name: debian-11 image: debian:11 - dockerfile_tpl: debian-systemd + dockerfile_tpl: debian-python3 - name: debian-12 image: debian:12 - dockerfile_tpl: debian-12 + dockerfile_tpl: debian-python3 provisioner: name: ansible diff --git a/molecule/dnsdist-19/molecule.yml b/molecule/dnsdist-19/molecule.yml index 8ca4cdd..b433183 100644 --- a/molecule/dnsdist-19/molecule.yml +++ b/molecule/dnsdist-19/molecule.yml @@ -32,11 +32,11 @@ platforms: - name: debian-11 image: debian:11 - dockerfile_tpl: debian-systemd + dockerfile_tpl: debian-python3 - name: debian-12 image: debian:12 - dockerfile_tpl: debian-12 + dockerfile_tpl: debian-python3 provisioner: name: ansible diff --git a/molecule/resources/Dockerfile.debian-12.j2 b/molecule/resources/Dockerfile.debian-python3.j2 similarity index 100% rename from molecule/resources/Dockerfile.debian-12.j2 rename to molecule/resources/Dockerfile.debian-python3.j2 diff --git a/molecule/resources/host_vars/debian-11.yml b/molecule/resources/host_vars/debian-11.yml index 0a909a2..17c2edf 100644 --- a/molecule/resources/host_vars/debian-11.yml +++ b/molecule/resources/host_vars/debian-11.yml @@ -1,3 +1,3 @@ --- -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" From baa46040c39ed221f5a62214aeb26b7d0270572e Mon Sep 17 00:00:00 2001 From: Rens Houben Date: Thu, 21 Dec 2023 14:48:16 +0100 Subject: [PATCH 7/9] Cleared up the lint error in .ansible-lint --- .ansible-lint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From bf943c41ba709a72b8bb7c874ea7f0e553b004c5 Mon Sep 17 00:00:00 2001 From: Rens Houben <18721840+lpmhouben@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:41:06 +0100 Subject: [PATCH 8/9] Update vars/main.yml Additional changes to cover yum as well, thanks to @npmdl Co-authored-by: npmdnl <80255813+npmdnl@users.noreply.github.com> --- vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/main.yml b/vars/main.yml index 4664669..6598dfe 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -41,5 +41,5 @@ dnsdist_powerdns_repo_19: gpg_key: http://repo.powerdns.com/FD380FBB-pub.asc gpg_key_id: 9FAAA5577E8FCF62093D036C1B0C6205FD380FBB yum_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-19 - yum_debug_symbols_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-18/debug + yum_debug_symbols_repo_baseurl: http://repo.powerdns.com/centos/$basearch/$releasever/dnsdist-19/debug name: powerdns-dnsdist-19 From 0dc14a4c7d18cf050143e5934ae42a302b7983e2 Mon Sep 17 00:00:00 2001 From: Rens Houben <18721840+lpmhouben@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:41:22 +0100 Subject: [PATCH 9/9] Update meta/main.yml Removed Jessie reference Co-authored-by: npmdnl <80255813+npmdnl@users.noreply.github.com> --- meta/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/meta/main.yml b/meta/main.yml index ebede4e..aa21633 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "8" - name: Debian versions: - - jessie - stretch - buster - bookworm