forked from PowerDNS/pdns-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And fix this for CentOS in the process :).
- Loading branch information
1 parent
192c92f
commit afcec3a
Showing
5 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
--- | ||
- hosts: mysql | ||
tasks: | ||
- name: Install mariadb (RedHat) | ||
yum: | ||
name: "{{ item }}" | ||
with_items: ['mariadb', 'mariadb-server', 'MySQL-python'] | ||
when: ansible_os_family == 'RedHat' | ||
- name: start mariadb (RedHat) | ||
service: | ||
name: mariadb | ||
state: running | ||
when: ansible_os_family == 'RedHat' | ||
- name: Install MySQL (Debian) | ||
apt: | ||
name: "{{ item }}" | ||
with_items: ['mysql-client', 'mysql-server', 'python-mysqldb'] | ||
when: ansible_os_family == 'Debian' | ||
|
||
- hosts: all | ||
roles: | ||
- { role: pdns-ansible } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import testinfra.utils.ansible_runner | ||
import pytest | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
'.molecule/ansible_inventory').get_hosts('mysql') | ||
|
||
debian_os = ['debian', 'ubuntu'] | ||
rhel_os = ['redhat', 'centos'] | ||
|
||
|
||
def test_package(Package): | ||
p = Package('pdns-backend-mysql') | ||
|
||
assert p.is_installed | ||
|
||
|
||
def test_config(File, SystemInfo, Sudo): | ||
with Sudo(): | ||
f = None | ||
if SystemInfo.distribution in debian_os: | ||
f = File('/etc/powerdns/pdns.conf') | ||
if SystemInfo.distribution in rhel_os: | ||
f = File('/etc/pdns/pdns.conf') | ||
|
||
assert f.exists | ||
assert 'launch+=gmysql' in f.content | ||
assert 'gmysql-host=localhost' in f.content | ||
assert 'gmysql-password=pdns' in f.content | ||
assert 'gmysql-dbname=pdns' in f.content | ||
assert 'gmysql-user=pdns' in f.content | ||
|
||
|
||
@pytest.mark.parametrize("table", [ | ||
('domains'), | ||
('records'), | ||
('supermasters'), | ||
('comments'), | ||
('domainmetadata'), | ||
('cryptokeys'), | ||
('tsigkeys'), | ||
]) | ||
def test_database_exists(File, Sudo, table): | ||
with Sudo(): | ||
f = File('/var/lib/mysql/pdns/%s.frm' % table) | ||
|
||
assert f.exists |