mise au point

rajout tache creation bdd
This commit is contained in:
2022-01-07 11:03:11 +01:00
parent 6b2c0c885e
commit 8dbf7e2d9e
4 changed files with 28 additions and 1 deletions

View File

@@ -33,6 +33,12 @@ apache_user: {{ apache_server_name | regex_search( '([^.]+)' ) }} }}
apache_allowoverride: all
apache_update_conf: true - wether we override existing config file
apache_ssl_root_email: email used for letsencrypt certificate
apache_use_database: false
apache_db_name: no default
apache_db_user: no default
apache_db_password: no default
apache_db_login_user: from root/.my.cnf
apache_db_login_password: from my.cnf
Example Playbook
----------------

View File

@@ -17,3 +17,4 @@ apache_use_stats: true
apache_use_zabbix: true
apache_user: "{{ apache_server_name | regex_search( '([^.]+)' ) }}"
apache_update_conf: true
apache_use_database: false

15
tasks/db.yml Normal file
View File

@@ -0,0 +1,15 @@
---
- name: create database
community.mysql.mysql_db:
login_user: root
name: "{{ apache_db_name }}"
state: present
- name: create db user
community.mysql.mysql_user:
name: "{{ apache_db_user }}"
password: "{{ apache_db_password }}"
update_password: on_create
priv: "{{ apache_db_name }}.*:ALL"
state: present

View File

@@ -75,4 +75,9 @@
- name: zabbix setup
import_tasks: zabbix.yml
when: apache_use_zabbix|bool
tags: zabbix, ssl
tags: zabbix, ssl
- name: db setup
import_tasks: db.yml
when: apache_use_database
tags: db