mirror of
https://github.com/DO1JLR/ansible_playbook_servers.git
synced 2024-09-14 19:53:56 +02:00
Update mailserver mysql tasks as handlers
This commit is contained in:
parent
8d61560693
commit
3aca9dedd3
4 changed files with 22 additions and 21 deletions
16
roles/mailserver_preperation/handlers/main.yml
Normal file
16
roles/mailserver_preperation/handlers/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
- name: import mail database config
|
||||||
|
become: true
|
||||||
|
community.mysql.mysql_db:
|
||||||
|
name: vmail
|
||||||
|
encoding: 'utf8'
|
||||||
|
state: import
|
||||||
|
target: '/root/.mariadb_schema/config.sql'
|
||||||
|
|
||||||
|
- name: create database schema
|
||||||
|
become: true
|
||||||
|
community.mysql.mysql_db:
|
||||||
|
name: vmail
|
||||||
|
encoding: 'utf8'
|
||||||
|
state: import
|
||||||
|
target: '/root/.mariadb_schema/schema.sql'
|
|
@ -17,6 +17,7 @@
|
||||||
copy:
|
copy:
|
||||||
dest: "/etc/mailname"
|
dest: "/etc/mailname"
|
||||||
content: "{{ mailserver_domain }}"
|
content: "{{ mailserver_domain }}"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
- name: set own dns resolver
|
- name: set own dns resolver
|
||||||
become: true
|
become: true
|
||||||
|
|
|
@ -13,29 +13,13 @@
|
||||||
copy:
|
copy:
|
||||||
src: files/schema.sql
|
src: files/schema.sql
|
||||||
dest: /root/.mariadb_schema/schema.sql
|
dest: /root/.mariadb_schema/schema.sql
|
||||||
register: mysqlschema
|
mode: '0644'
|
||||||
|
notify: create database schema
|
||||||
|
|
||||||
- name: Copy mail config
|
- name: Copy mail config
|
||||||
become: true
|
become: true
|
||||||
template:
|
template:
|
||||||
src: templates/mysqlconfig.sql.j2
|
src: templates/mysqlconfig.sql.j2
|
||||||
dest: /root/.mariadb_schema/config.sql
|
dest: /root/.mariadb_schema/config.sql
|
||||||
register: mysqlconfig
|
mode: '0644'
|
||||||
|
notify: import mail database config
|
||||||
- name: create database schema
|
|
||||||
become: true
|
|
||||||
community.mysql.mysql_db:
|
|
||||||
name: vmail
|
|
||||||
encoding: 'utf8'
|
|
||||||
state: import
|
|
||||||
target: '/root/.mariadb_schema/schema.sql'
|
|
||||||
when: mysqlschema.changed
|
|
||||||
|
|
||||||
- name: Import database schema
|
|
||||||
become: true
|
|
||||||
community.mysql.mysql_db:
|
|
||||||
name: vmail
|
|
||||||
encoding: 'utf8'
|
|
||||||
state: import
|
|
||||||
target: '/root/.mariadb_schema/config.sql'
|
|
||||||
when: mysqlconfig.changed
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 33 # should be int
|
playbook_version_number: 34 # should be int
|
||||||
playbook_version_path: 'role-mailserver_roles-ansile_github.com.version'
|
playbook_version_path: 'role-mailserver_roles-ansile_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue