mariadb.yml aktualisiert

This commit is contained in:
olli 2024-05-28 14:58:13 +02:00
parent ec43211eb8
commit e4c66f63d7

View File

@ -11,45 +11,6 @@
state: directory
mode: '0550'
- name: /home/docker/mariadb.{{inventory_hostname}}/genpw.sh (generate Random PW)
blockinfile:
path: /home/docker/mariadb.{{inventory_hostname}}/genpw.sh
create: yes
mode: 0550
owner: root
group: docker
marker: "# {mark} ANSIBLE MANAGED BLOCK"
block: |
cd /home/docker/mariadb.{{inventory_hostname}}
mysqlpassword=$(pwgen -s 32 1)
[ -f env.db ] || echo "MARIADB_ROOT_PASSWORD=!MYSQLPASSWORD!
" >env.db
[ -f env.phpmyadmin ] || echo "PMA_USER=root
PMA_PASSWORD=!MYSQLPASSWORD!
" >env.phpmyadmin
chmod 440 env.db env.phpmyadmin
chown root:docker env.db env.phpmyadmin
sed -i "s/\!MYSQLPASSWORD\!/$mysqlpassword/g" env.db env.phpmyadmin
backup: yes
validate: /bin/bash -n %s
- name: /home/docker/mariadb.{{inventory_hostname}}/genpw.sh shebang
lineinfile:
path: /home/docker/mariadb.{{inventory_hostname}}/genpw.sh
insertbefore: BOF
line: "#!/bin/bash -e"
- name: Gen initial passwords if not exists
ansible.builtin.shell: ./genpw.sh
args:
chdir: /home/docker/mariadb.{{inventory_hostname}}
creates: /home/docker/mariadb.{{inventory_hostname}}/env.db
- name: /usr/local/sbin/autoupdate.d/mariadb-ssl.update
blockinfile:
path: /usr/local/sbin/autoupdate.d/mariadb-ssl.update
@ -175,7 +136,7 @@
- ./ssl/certificate.pem:/etc/mysql/certificate.pem:ro
- ./ssl/key.pem:/etc/mysql/key.pem:ro
env_file:
- env.db
- /home/docker/_defaults/mariadb/envroot.db
- /home/docker/_defaults/mariadb/mariadb.env
ports:
- 0.0.0.0:33306:3306
@ -183,7 +144,7 @@
mariadb.{{inventory_hostname}}--phpmyadmin:
image: phpmyadmin:latest
restart: unless-stopped
env_file: env.phpmyadmin
env_file: /home/docker/_defaults/mariadb/env.rootphpmyadmin
environment:
- PMA_ARBITRARY=0
- PMA_HOST=mariadb.{{inventory_hostname}}