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

Centos 8 #81

Merged
merged 13 commits into from
Sep 16, 2020
10 changes: 4 additions & 6 deletions molecule/pdns-42/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ platforms:
image: centos:7
dockerfile_tpl: centos-systemd

# Temporarely disable CentOS 8 due to:
# https://github.com/ansible/ansible/issues/64963
# - name: centos-8
# groups: ["pdns"]
# image: centos:8
# dockerfile_tpl: centos-systemd
- name: centos-8
groups: ["pdns"]
image: centos:8
dockerfile_tpl: centos-systemd

- name: ubuntu-1804
groups: ["pdns"]
Expand Down
10 changes: 4 additions & 6 deletions molecule/pdns-43/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ platforms:
image: centos:7
dockerfile_tpl: centos-systemd

# Temporarely disable CentOS 8 due to:
# https://github.com/ansible/ansible/issues/64963
# - name: centos-8
# groups: ["pdns"]
# image: centos:8
# dockerfile_tpl: centos-systemd
- name: centos-8
groups: ["pdns"]
image: centos:8
dockerfile_tpl: centos-systemd

- name: ubuntu-1804
groups: ["pdns"]
Expand Down
10 changes: 4 additions & 6 deletions molecule/pdns-master/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ platforms:
image: centos:7
dockerfile_tpl: centos-systemd

# Temporarely disable CentOS 8 due to:
# https://github.com/ansible/ansible/issues/64963
# - name: centos-8
# groups: ["pdns"]
# image: centos:8
# dockerfile_tpl: centos-systemd
- name: centos-8
groups: ["pdns"]
image: centos:8
dockerfile_tpl: centos-systemd

- name: ubuntu-1804
groups: ["pdns"]
Expand Down
25 changes: 10 additions & 15 deletions tasks/database-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
---

- name: Install the MySQL dependencies on RedHat
- name: Install the MySQL dependencies
package:
name:
- mysql
- MySQL-python
name: "{{ pdns_mysql_packages }}"
state: present
when: ansible_os_family == 'RedHat'

- name: Install the MySQL dependencies on Debian
package:
name:
- default-mysql-client
- python-mysqldb
- python3-mysqldb
state: present
when: ansible_os_family == 'Debian'

- name: Create the PowerDNS MySQL databases
mysql_db:
Expand Down Expand Up @@ -66,9 +54,16 @@
- name: Define the PowerDNS database MySQL schema file path on RedHat >= 7 or PowerDNS >= 4.2.0
set_fact:
_pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-mysql-{{ _pdns_running_version }}/schema.mysql.sql"
when: ansible_distribution_major_version | int >= 7
when: ansible_distribution_major_version | int == 7
or _pdns_running_version is version_compare('4.2.0', '>=')

- name: Define the PowerDNS database MySQL schema file path on RedHat 8 and PowerDNS >= 4.2.0
set_fact:
_pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-mysql/schema.mysql.sql"
when:
- ansible_distribution_major_version | int == 8
- _pdns_running_version is version_compare('4.2.0', '>=')

when: ansible_os_family == 'RedHat'

- block:
Expand Down
28 changes: 18 additions & 10 deletions tasks/database-sqlite3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,30 @@
with_items: "{{ pdns_sqlite_databases_locations }}"

- block:

- name: Create the PowerDNS SQLite databases on RedHat < 7 and PowerDNS < 4.2.0
shell: "sqlite3 {{ item }} < /usr/share/doc/pdns/schema.sqlite3.sql"
args:
creates: "{{ item }}"
with_items: "{{ pdns_sqlite_databases_locations }}"
- name: Define the PowerDNS SQLite schema file path on RedHat < 7 and PowerDNS < 4.2.0
set_fact:
_pdns_mysql_schema_file: "/usr/share/doc/pdns/schema.sqlite3.sql"
when: ansible_distribution_major_version | int < 7
and _pdns_running_version is version_compare('4.2.0', '<')

- name: Create the PowerDNS SQLite databases on RedHat >= 7 or PowerDNS >= 4.2.0
shell: "sqlite3 {{ item }} < /usr/share/doc/pdns-backend-sqlite-{{ _pdns_running_version }}/schema.sqlite3.sql"
- name: Define the PowerDNS SQLite schema file path on RedHat >= 7 or PowerDNS >= 4.2.0
set_fact:
_pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-sqlite-{{ _pdns_running_version }}/schema.sqlite3.sql"
when: ansible_distribution_major_version | int == 7
or _pdns_running_version is version_compare('4.2.0', '>=')

- name: Define the PowerDNS SQLite schema file path on RedHat 8 and PowerDNS >= 4.2.0
set_fact:
_pdns_mysql_schema_file: "/usr/share/doc/pdns-backend-sqlite/schema.sqlite3.sql"
when:
- ansible_distribution_major_version | int == 8
- _pdns_running_version is version_compare('4.2.0', '>=')

- name: Create the PowerDNS SQLite databases on RedHat
shell: "sqlite3 {{ item }} < {{ _pdns_mysql_schema_file }}"
args:
creates: "{{ item }}"
with_items: "{{ pdns_sqlite_databases_locations }}"
when: ansible_distribution_major_version | int >= 7
or _pdns_running_version is version_compare('4.2.0', '>=')

when: ansible_os_family == "RedHat"

Expand Down
12 changes: 11 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---

- name: Include OS-specific variables
include_vars: "{{ ansible_os_family }}.yml"
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
tags:
- always

Expand Down Expand Up @@ -38,6 +42,12 @@
tags:
- config

- include: selinux.yml
when: ansible_selinux is defined and ansible_selinux.status == 'enabled'
tags:
- selinux
- config

- name: Start and enable the PowerDNS service
service:
name: "{{ pdns_service_name }}"
Expand Down
4 changes: 3 additions & 1 deletion tasks/repo-RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
package:
name: yum-plugin-priorities
state: present
when: ansible_distribution in [ 'CentOS' ]
when:
- ansible_distribution in [ 'CentOS' ]
- ansible_distribution_major_version | int < 8

- name: Add the PowerDNS YUM Repository
yum_repository:
Expand Down
14 changes: 14 additions & 0 deletions tasks/selinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: allow mysql connect from pdns in selinux
seboolean:
name: pdns_can_network_connect_db
state: yes
persistent: yes
when: "pdns_mysql_databases_credentials | length > 0"

- name: allow pdns to bind to udp high ports
seport:
ports: 10000-20000
proto: udp
setype: dns_port_t
state: present
6 changes: 6 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ default_pdns_package_name: "pdns-server"
# The name of the PowerDNS Authoritative Server debug package
default_pdns_debug_symbols_package_name: "pdns-server-dbg"

# Packages needed to install MySQL
pdns_mysql_packages:
- default-mysql-client
- python-mysqldb
- python3-mysqldb

# List of PowerDNS Authoritative Server Backends packages on Debian
default_pdns_backends_packages:
geo: pdns-backend-geo
Expand Down
33 changes: 33 additions & 0 deletions vars/RedHat-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

# The name of the PowerDNS Authoritative Server package
default_pdns_package_name: "pdns"

# Packages needed to install MySQL
pdns_mysql_packages:
- mariadb
- mariadb-server
- mariadb-connector-c
- python3-PyMySQL
- perl-DBD-MySQL

# The name of the PowerDNS Authoritative Server debug package
default_pdns_debug_symbols_package_name: "pdns-debuginfo"

# List of PowerDNS Authoritative Server backends packages on RedHat
default_pdns_backends_packages:
geo: pdns-backend-geo
geoip: pdns-backend-geoip
gmysql: pdns-backend-mysql
gpgsql: pdns-backend-postgresql
gsqlite3: pdns-backend-sqlite
ldap: pdns-backend-ldap
lmdb: pdns-backend-lmdb
lua: pdns-backend-lua
mydns: pdns-backend-mydns
pipe: pdns-backend-pipe
remote: pdns-backend-remote
tinydns: pdns-backend-tinydns

# The directory where the PowerDNS Authoritative Server configuration is located
default_pdns_config_dir: "/etc/pdns"
5 changes: 5 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# The name of the PowerDNS Authoritative Server package
default_pdns_package_name: "pdns"

# Packages needed to install MySQL
pdns_mysql_packages:
- mysql
- MySQL-python

# The name of the PowerDNS Authoritative Server debug package
default_pdns_debug_symbols_package_name: "pdns-debuginfo"

Expand Down