This commit is contained in:
Johan Largy 2023-01-30 10:57:28 +01:00
commit 64f1b74ba7

View File

@ -1,24 +1,49 @@
---
- hosts: localhost
connection: local
vars:
maria_dbhost: "192.168.102.254"
maria_dbname: "wordpress"
maria_dbuser: "wp"
maria_dbpasswd: "wp"
- hosts: all
become: true
tasks:
- name: modules python pour
apt:
name: python3-pymysql
state: present
roles:
- base
- goss
- post
#- s-lb-bd-ab
- mariadb-ab
# - role: db-user
# cli_ip: "192.168.102.1"
# - role: db-user
# cli_ip: "192.168.102.2"
# - role: db-user
# cli_ip: "192.168.102.3"
- snmp-agent
# - post
- name: install mariadb-server
apt:
name: mariadb-server
state: present
- name: Cree Bd wordpress
mysql_db:
db: wordpressdb
login_unix_socket: /var/run/mysqld/mysqld.sock
state: present
- name: Ouvre port 3306 mariadb-server
replace:
path: /etc/mysql/mariadb.conf.d/50-server.cnf
regexp: '^bind-address.*'
replace: '#bind-adress = 127.0.0.1'
backup: yes
notify: restart mariadb
- name: Create MySQL user for wordpress
mysql_user:
name: wordpressuser
password: wordpresspasswd
priv: "wordpressdb.*:ALL"
host: '%'
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
handlers:
- name: restart mariadb
ansible.builtin.service:
name: mariadb
state: restarted
roles:
- base
- goss
- post
- snmp-agent