Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forces bash when checking for existing setKey in dnsdist.conf #120

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions molecule/resources/tests/repo-19/test_repo_19.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos', 'ol', 'rocky', 'almalinux']


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
7 changes: 7 additions & 0 deletions molecule/resources/vars/dnsdist-repo-19.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

##
# Dnsdist 1.9.x Repository
##

dnsdist_install_repo: "{{ dnsdist_powerdns_repo_19 }}"
4 changes: 2 additions & 2 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
- name: Install dnsdist
ansible.builtin.package:
name: "{{ dnsdist_package_name }}{{ _dnsdist_package_version | default('') }}"
state: present
state: latest

- name: Install dnsdist debug symbols
ansible.builtin.package:
name: "{{ dnsdist_debug_symbols_package_name }}{{ _dnsdist_package_version | default('') }}"
state: present
state: latest
when: dnsdist_install_debug_symbols_package | bool
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
- name: Check if the key is already present in the DNSdist configuration file
ansible.builtin.shell: |
set -o pipefail && fgrep setKey "{{ default_dnsdist_config_location }}" | sed 's/setKey("\(.*\)")/\1/'
args:
executable: /bin/bash
register: dnsdist_grepkey_cmd
changed_when: false
failed_when: false
Expand Down
9 changes: 9 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-19/debug
name: powerdns-dnsdist-19