64 lines
3.9 KiB
YAML
64 lines
3.9 KiB
YAML
- name: nameserver | powerdns-server | install packages
|
|
package:
|
|
name: "{{ powerdns_server_package }}"
|
|
state: present
|
|
|
|
- name: nameserver | powerdns-server | install backends
|
|
package:
|
|
name: "{{ item.package }}"
|
|
state: latest
|
|
with_items: "{{ powerdns_backends }}"
|
|
|
|
- name: nameserver | powerdns-server | install and configure database
|
|
block:
|
|
- include_role: name=database # required. The name of the role to be executed.
|
|
- name: nameserver | powerdns-server | install python mysql client
|
|
package:
|
|
name: "{{ python_mysql_client }}"
|
|
state: present
|
|
- name: nameserver | powerdns-server | create database
|
|
mysql_db:
|
|
name: "{{ pdns_db_name }}" # required. name of the database to add or remove. I(name=all) May only be provided if I(state) is C(dump) or C(import). List of databases is provided with I(state=dump), I(state=present) and I(state=absent). if name=all Works like --all-databases option for mysqldump (Added in 2.0).
|
|
state: present # not required. choices: present;absent;dump;import. The database state
|
|
encoding: "utf8" # not required. Encoding mode to use, examples include C(utf8) or C(latin1_swedish_ci)
|
|
config_file: "/etc/mysql/my.cnf" # not required. Specify a config file from which user and password are to be read.
|
|
- name: nameserver | powerdns-server | import database
|
|
mysql_db:
|
|
name: "{{ pdns_db_name }}"
|
|
state: import
|
|
target: "{{ pdns_mysql_schema }}" # not required. Location, on the remote host, of the dump file to read from or write to. Uncompressed SQL files (C(.sql)) as well as bzip2 (C(.bz2)), gzip (C(.gz)) and xz (Added in 2.0) compressed files are supported.
|
|
config_file: "/etc/mysql/my.cnf" # not required. Specify a config file from which user and password are to be read.
|
|
- name: nameserver | powerdns-server | create database user
|
|
mysql_user:
|
|
name: "{{ pdns_db_user }}" # required. Name of the user (role) to add or remove.
|
|
password: "{{ pdns_db_passwd }}" # not required. Set the user's password..
|
|
host: localhost
|
|
priv: "{{ pdns_db_name }}.*:ALL" # not required. MySQL privileges string in the format: C(db.table:priv1,priv2). Multiple privileges can be specified by separating each one using a forward slash: C(db.table:priv/db.table:priv). The format is based on MySQL C(GRANT) statement. Database and table names can be quoted, MySQL-style. If column privileges are used, the C(priv1,priv2) part must be exactly as returned by a C(SHOW GRANT) statement. If not followed, the module will always report changes. It includes grouping columns by permission (C(SELECT(col1,col2)) instead of C(SELECT(col1),SELECT(col2))).
|
|
append_privs: False # not required. Append the privileges defined by priv to the existing ones for this user instead of overwriting existing ones.
|
|
sql_log_bin: True # not required. Whether binary logging should be enabled or disabled for the connection.
|
|
state: present # not required. choices: absent;present. Whether the user should exist. When C(absent), removes the user.
|
|
update_password: on_create # not required. choices: always;on_create. C(always) will update passwords if they differ. C(on_create) will only set the password for newly created users.
|
|
config_file: "/etc/mysql/my.cnf" # not required. Specify a config file from which user and password are to be read.
|
|
- name: nameserver | powerdns-server | copy config
|
|
template:
|
|
src: "powerdns-server-pri-mysql-config.j2"
|
|
dest: "/etc/powerdns/pdns.d/mysql.conf"
|
|
mode: "0644"
|
|
owner: "root"
|
|
group: "root"
|
|
when:
|
|
- powerdns_primary is defined
|
|
- powerdns_primary is true
|
|
|
|
- name: nameserver | powerdns-recursor | disable bind
|
|
service:
|
|
name: "named"
|
|
state: stopped
|
|
enabled: False
|
|
|
|
- name: nameserver | powerdns-recursor | enable service
|
|
service:
|
|
name: "pdns"
|
|
state: started
|
|
enabled: True
|