mirror of
https://github.com/pschiffe/docker-pdns.git
synced 2025-01-18 19:11:14 +01:00
Updated ansible playbook
This commit is contained in:
parent
9f888d5663
commit
dda9e57206
1 changed files with 176 additions and 119 deletions
|
@ -3,127 +3,184 @@
|
||||||
vars:
|
vars:
|
||||||
pdns_master_ip: 172.5.0.20
|
pdns_master_ip: 172.5.0.20
|
||||||
pdns_slave_ip: 172.5.0.21
|
pdns_slave_ip: 172.5.0.21
|
||||||
|
wipe: false
|
||||||
# for now, you need to manually create the docker network:
|
c_state: '{{ "absent" if wipe | bool else "started" }}'
|
||||||
# docker network create --subnet 172.5.0.0/16 --gateway 172.5.0.1 pdns-net
|
i_state: present
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: db
|
- name: create docker network
|
||||||
docker_container:
|
docker_network:
|
||||||
name: pdns-mariadb
|
name: pdns-net
|
||||||
image: mariadb:10.1
|
state: present
|
||||||
pull: true
|
ipam_options:
|
||||||
state: "{{ c_state | default('started') }}"
|
subnet: '172.5.0.0/16'
|
||||||
volumes:
|
gateway: '172.5.0.1'
|
||||||
- pdns-mariadb-volume:/var/lib/mysql:z
|
|
||||||
env:
|
|
||||||
MYSQL_ROOT_PASSWORD: my-secret-pw
|
|
||||||
networks:
|
|
||||||
- name: pdns-net
|
|
||||||
tags:
|
|
||||||
- db
|
|
||||||
|
|
||||||
- name: phpmyadmin
|
- name: db
|
||||||
docker_container:
|
docker_container:
|
||||||
name: pdns-phpmyadmin
|
name: pdns-mariadb
|
||||||
image: phpmyadmin/phpmyadmin
|
image: mariadb:10.2
|
||||||
pull: true
|
pull: true
|
||||||
state: "{{ c_state | default('started') }}"
|
state: '{{ c_state }}'
|
||||||
published_ports:
|
purge_networks: true
|
||||||
- '8888:80'
|
networks:
|
||||||
networks:
|
- name: pdns-net
|
||||||
- name: pdns-net
|
aliases:
|
||||||
tags:
|
- db
|
||||||
- db
|
- mysql
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- pdns-mariadb-volume:/var/lib/mysql:z
|
||||||
|
env:
|
||||||
|
MYSQL_ROOT_PASSWORD: my-secret-pw
|
||||||
|
tags:
|
||||||
|
- db
|
||||||
|
|
||||||
- name: build pdns
|
- name: phpmyadmin
|
||||||
docker_image:
|
docker_container:
|
||||||
name: my-pdns
|
name: pdns-phpmyadmin
|
||||||
state: "{{ i_state | default('present') }}"
|
image: phpmyadmin/phpmyadmin:4.7
|
||||||
force: true
|
pull: true
|
||||||
path: ./pdns
|
state: '{{ c_state }}'
|
||||||
tags:
|
purge_networks: true
|
||||||
- pdns
|
networks:
|
||||||
|
- name: pdns-net
|
||||||
|
published_ports:
|
||||||
|
- '8888:80'
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
tags:
|
||||||
|
- db
|
||||||
|
|
||||||
- name: pdns master
|
- name: build pdns
|
||||||
docker_container:
|
docker_image:
|
||||||
name: pdns
|
name: my-pdns
|
||||||
image: my-pdns
|
state: '{{ i_state }}'
|
||||||
state: "{{ c_state | default('started') }}"
|
force: true
|
||||||
hostname: ns1.example.com
|
path: ./pdns
|
||||||
networks:
|
tags:
|
||||||
- name: pdns-net
|
|
||||||
ipv4_address: '{{ pdns_master_ip }}'
|
|
||||||
etc_hosts:
|
|
||||||
ns1.example.com: '{{ pdns_master_ip }}'
|
|
||||||
ns2.example.com: '{{ pdns_slave_ip }}'
|
|
||||||
links:
|
|
||||||
- pdns-mariadb:mysql
|
|
||||||
env:
|
|
||||||
PDNS_master: yes
|
|
||||||
PDNS_api: yes
|
|
||||||
PDNS_api_key: secret
|
|
||||||
PDNS_webserver: yes
|
|
||||||
PDNS_webserver_address: 0.0.0.0
|
|
||||||
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
|
|
||||||
|
|
||||||
- name: pdns slave
|
|
||||||
docker_container:
|
|
||||||
name: pdns-slave
|
|
||||||
image: my-pdns
|
|
||||||
state: "{{ c_state | default('started') }}"
|
|
||||||
hostname: ns2.example.com
|
|
||||||
networks:
|
|
||||||
- name: pdns-net
|
|
||||||
ipv4_address: '{{ pdns_slave_ip }}'
|
|
||||||
etc_hosts:
|
|
||||||
ns1.example.com: '{{ pdns_master_ip }}'
|
|
||||||
ns2.example.com: '{{ pdns_slave_ip }}'
|
|
||||||
links:
|
|
||||||
- pdns-mariadb:mysql
|
|
||||||
env:
|
|
||||||
PDNS_gmysql_dbname: powerdnsslave
|
|
||||||
PDNS_slave: yes
|
|
||||||
PDNS_webserver: yes
|
|
||||||
PDNS_webserver_address: 0.0.0.0
|
|
||||||
PDNS_version_string: anonymous
|
|
||||||
PDNS_disable_axfr: yes
|
|
||||||
PDNS_allow_notify_from: '{{ pdns_master_ip }}'
|
|
||||||
SUPERMASTER_IPS: '{{ pdns_master_ip }}'
|
|
||||||
tags:
|
|
||||||
- pdns
|
|
||||||
|
|
||||||
- name: build pdns-admin
|
|
||||||
docker_image:
|
|
||||||
name: my-pdns-admin
|
|
||||||
state: "{{ i_state | default('present') }}"
|
|
||||||
force: true
|
|
||||||
path: ./pdns-admin
|
|
||||||
tags:
|
|
||||||
- pdns-admin
|
|
||||||
|
|
||||||
- name: pdns-admin
|
|
||||||
docker_container:
|
|
||||||
name: pdns-admin
|
|
||||||
image: my-pdns-admin
|
|
||||||
state: "{{ c_state | default('started') }}"
|
|
||||||
tty: true
|
|
||||||
published_ports:
|
|
||||||
- '8889:80'
|
|
||||||
networks:
|
|
||||||
- name: pdns-net
|
|
||||||
links:
|
|
||||||
- pdns-mariadb:mysql
|
|
||||||
- pdns
|
- pdns
|
||||||
volumes:
|
|
||||||
- pdns-admin-upload:/opt/powerdns-admin/upload
|
- name: pdns master
|
||||||
tags:
|
docker_container:
|
||||||
- pdns-admin
|
name: pdns
|
||||||
|
image: my-pdns
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: pdns slave
|
||||||
|
docker_container:
|
||||||
|
name: pdns-slave
|
||||||
|
image: my-pdns
|
||||||
|
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
|
||||||
|
PDNS_version_string: anonymous
|
||||||
|
PDNS_disable_axfr: yes
|
||||||
|
PDNS_allow_notify_from: '{{ pdns_master_ip }}'
|
||||||
|
SUPERMASTER_IPS: '{{ pdns_master_ip }}'
|
||||||
|
tags:
|
||||||
|
- pdns
|
||||||
|
|
||||||
|
- name: build pdns-admin backend
|
||||||
|
docker_image:
|
||||||
|
name: my-pdns-admin-uwsgi
|
||||||
|
state: '{{ i_state }}'
|
||||||
|
force: true
|
||||||
|
path: ./pdns-admin-uwsgi
|
||||||
|
tags:
|
||||||
|
- pdns-admin
|
||||||
|
|
||||||
|
- name: build pdns-admin frontent
|
||||||
|
docker_image:
|
||||||
|
name: my-pdns-admin-static
|
||||||
|
state: '{{ i_state }}'
|
||||||
|
force: true
|
||||||
|
path: ./pdns-admin-static
|
||||||
|
tags:
|
||||||
|
- pdns-admin
|
||||||
|
|
||||||
|
- 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'"
|
||||||
|
PDNS_ADMIN_PDNS_VERSION: "'4.0.4'"
|
||||||
|
PDNS_ADMIN_PDNS_API_KEY: "'secret'"
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue