2016-09-02 22:48:20 +02:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
vars:
|
|
|
|
pdns_master_ip: 172.5.0.20
|
|
|
|
pdns_slave_ip: 172.5.0.21
|
2017-08-21 21:31:23 +02:00
|
|
|
wipe: false
|
|
|
|
c_state: '{{ "absent" if wipe | bool else "started" }}'
|
|
|
|
i_state: present
|
2018-11-07 00:50:59 +01:00
|
|
|
alpine: false
|
2017-08-21 21:31:23 +02:00
|
|
|
tasks:
|
|
|
|
- name: create docker network
|
|
|
|
docker_network:
|
|
|
|
name: pdns-net
|
|
|
|
state: present
|
|
|
|
ipam_options:
|
|
|
|
subnet: '172.5.0.0/16'
|
|
|
|
gateway: '172.5.0.1'
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: db
|
|
|
|
docker_container:
|
|
|
|
name: pdns-mariadb
|
2019-09-29 00:16:32 +02:00
|
|
|
image: mariadb:10.4
|
2017-08-21 21:31:23 +02:00
|
|
|
pull: true
|
|
|
|
state: '{{ c_state }}'
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
aliases:
|
|
|
|
- db
|
|
|
|
- mysql
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
- pdns-mariadb-volume:/var/lib/mysql:z
|
|
|
|
env:
|
|
|
|
MYSQL_ROOT_PASSWORD: my-secret-pw
|
|
|
|
tags:
|
|
|
|
- db
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: phpmyadmin
|
|
|
|
docker_container:
|
|
|
|
name: pdns-phpmyadmin
|
2020-01-01 16:37:47 +01:00
|
|
|
image: phpmyadmin/phpmyadmin:5
|
2017-08-21 21:31:23 +02:00
|
|
|
pull: true
|
|
|
|
state: '{{ c_state }}'
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
published_ports:
|
|
|
|
- '8888:80'
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
tags:
|
|
|
|
- db
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: build pdns
|
|
|
|
docker_image:
|
|
|
|
name: my-pdns
|
|
|
|
state: '{{ i_state }}'
|
|
|
|
force: true
|
|
|
|
path: ./pdns
|
|
|
|
tags:
|
|
|
|
- pdns
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2018-11-07 00:50:59 +01:00
|
|
|
- name: build pdns alpine version
|
|
|
|
docker_image:
|
|
|
|
name: my-pdns
|
|
|
|
tag: alpine
|
|
|
|
state: '{{ i_state }}'
|
|
|
|
force: true
|
|
|
|
path: ./pdns
|
|
|
|
dockerfile: Dockerfile.alpine
|
|
|
|
tags:
|
|
|
|
- pdns
|
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: pdns master
|
|
|
|
docker_container:
|
|
|
|
name: pdns
|
2018-11-07 00:50:59 +01:00
|
|
|
image: my-pdns:{{ "alpine" if alpine | bool else "latest" }}
|
2017-08-21 21:31:23 +02:00
|
|
|
state: '{{ c_state }}'
|
|
|
|
hostname: ns1.example.com
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
ipv4_address: '{{ pdns_master_ip }}'
|
|
|
|
etc_hosts:
|
|
|
|
ns1.example.com: '{{ pdns_master_ip }}'
|
|
|
|
ns2.example.com: '{{ pdns_slave_ip }}'
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
env:
|
|
|
|
PDNS_gmysql_password: my-secret-pw
|
|
|
|
PDNS_master: yes
|
|
|
|
PDNS_api: yes
|
|
|
|
PDNS_api_key: secret
|
|
|
|
PDNS_webserver: yes
|
|
|
|
PDNS_webserver_address: 0.0.0.0
|
2018-11-07 00:50:59 +01:00
|
|
|
PDNS_webserver_allow_from: 172.5.0.0/16
|
2017-08-21 21:31:23 +02:00
|
|
|
PDNS_version_string: anonymous
|
|
|
|
PDNS_default_ttl: 1500
|
|
|
|
PDNS_soa_minimum_ttl: 1200
|
|
|
|
PDNS_default_soa_name: ns1.example.com
|
|
|
|
PDNS_default_soa_mail: hostmaster.example.com
|
|
|
|
PDNS_allow_axfr_ips: '{{ pdns_slave_ip }}'
|
|
|
|
PDNS_only_notify: '{{ pdns_slave_ip }}'
|
|
|
|
tags:
|
|
|
|
- pdns
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: pdns slave
|
|
|
|
docker_container:
|
|
|
|
name: pdns-slave
|
2018-11-07 00:50:59 +01:00
|
|
|
image: my-pdns:{{ "alpine" if alpine | bool else "latest" }}
|
2017-08-21 21:31:23 +02:00
|
|
|
state: '{{ c_state }}'
|
|
|
|
hostname: ns2.example.com
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
ipv4_address: '{{ pdns_slave_ip }}'
|
|
|
|
etc_hosts:
|
|
|
|
ns1.example.com: '{{ pdns_master_ip }}'
|
|
|
|
ns2.example.com: '{{ pdns_slave_ip }}'
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
env:
|
|
|
|
PDNS_gmysql_dbname: powerdnsslave
|
|
|
|
PDNS_gmysql_password: my-secret-pw
|
|
|
|
PDNS_slave: yes
|
|
|
|
PDNS_webserver: yes
|
|
|
|
PDNS_webserver_address: 0.0.0.0
|
2018-11-07 00:50:59 +01:00
|
|
|
PDNS_webserver_allow_from: 172.5.0.0/16
|
2017-08-21 21:31:23 +02:00
|
|
|
PDNS_version_string: anonymous
|
|
|
|
PDNS_disable_axfr: yes
|
|
|
|
PDNS_allow_notify_from: '{{ pdns_master_ip }}'
|
|
|
|
SUPERMASTER_IPS: '{{ pdns_master_ip }}'
|
|
|
|
tags:
|
|
|
|
- pdns
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2018-11-21 01:31:02 +01:00
|
|
|
- name: build pdns-admin base
|
|
|
|
docker_image:
|
|
|
|
name: pschiffe/pdns-admin-base
|
|
|
|
tag: ngoduykhanh
|
|
|
|
state: '{{ i_state }}'
|
|
|
|
force: true
|
|
|
|
path: ./pdns-admin-base-ngoduykhanh
|
|
|
|
tags:
|
|
|
|
- pdns-admin
|
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: build pdns-admin backend
|
|
|
|
docker_image:
|
|
|
|
name: my-pdns-admin-uwsgi
|
|
|
|
state: '{{ i_state }}'
|
|
|
|
force: true
|
2018-11-21 01:31:02 +01:00
|
|
|
path: ./pdns-admin-uwsgi-ngoduykhanh
|
2017-08-21 21:31:23 +02:00
|
|
|
tags:
|
|
|
|
- pdns-admin
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: build pdns-admin frontent
|
|
|
|
docker_image:
|
|
|
|
name: my-pdns-admin-static
|
|
|
|
state: '{{ i_state }}'
|
|
|
|
force: true
|
2018-11-21 01:31:02 +01:00
|
|
|
path: ./pdns-admin-static-ngoduykhanh
|
2017-08-21 21:31:23 +02:00
|
|
|
tags:
|
|
|
|
- pdns-admin
|
2016-09-02 22:48:20 +02:00
|
|
|
|
2017-08-21 21:31:23 +02:00
|
|
|
- name: pdns-admin backend
|
|
|
|
docker_container:
|
|
|
|
name: pdns-admin-uwsgi
|
|
|
|
image: my-pdns-admin-uwsgi
|
|
|
|
state: '{{ c_state }}'
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
aliases:
|
|
|
|
- pdns-admin-uwsgi
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
- pdns-admin-upload:/opt/powerdns-admin/upload
|
|
|
|
env:
|
|
|
|
PDNS_ADMIN_SQLA_DB_PASSWORD: "'my-secret-pw'"
|
2018-11-21 01:31:02 +01:00
|
|
|
PDNS_VERSION: "4.1"
|
|
|
|
PDNS_API_KEY: "secret"
|
2017-08-21 21:31:23 +02:00
|
|
|
tags:
|
|
|
|
- pdns-admin
|
|
|
|
|
|
|
|
- name: pdns-admin frontend
|
|
|
|
docker_container:
|
|
|
|
name: pdns-admin-static
|
|
|
|
image: my-pdns-admin-static
|
|
|
|
state: '{{ c_state }}'
|
|
|
|
purge_networks: true
|
|
|
|
networks:
|
|
|
|
- name: pdns-net
|
|
|
|
published_ports:
|
|
|
|
- '8889:80'
|
|
|
|
volumes:
|
|
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
tags:
|
|
|
|
- pdns-admin
|
|
|
|
|
|
|
|
- name: remove docker volumes
|
|
|
|
command: docker volume rm pdns-mariadb-volume pdns-admin-upload
|
|
|
|
ignore_errors: true
|
|
|
|
when: wipe | bool
|
|
|
|
|
|
|
|
- name: remove network
|
|
|
|
docker_network:
|
|
|
|
name: pdns-net
|
|
|
|
state: absent
|
|
|
|
ignore_errors: true
|
|
|
|
when: wipe | bool
|