Add mariadb install to hedwig.

This commit is contained in:
Jim Hague 2023-04-06 16:13:09 +01:00
parent 53c53b17e7
commit 2e40466040
5 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,2 @@
mariadb:
root_pw: 'password'

View File

@ -1,6 +1,7 @@
base: base:
'hedwig.lunch.org.uk': 'hedwig.lunch.org.uk':
- secrets/certificates - secrets/certificates
- secrets/mariadb
'scabbers.lunch.org.uk': 'scabbers.lunch.org.uk':
- secrets/dnsapi - secrets/dnsapi
- secrets/gitea - secrets/gitea

41
states/mariadb/init.sls Normal file
View File

@ -0,0 +1,41 @@
debconf-utils:
pkg.installed
mariadb_setup:
debconf.set:
- name: mysql-server
- data:
'mysql-server/root_password': {'type': 'password', 'value': '{{ salt['pillar.get']('mariadb:root_pw', '') }}' }
'mysql-server/root_password_again': {'type': 'password', 'value': '{{ salt['pillar.get']('mariadb:root_pw', '') }}' }
- require:
- pkg: debconf-utils
python3-mysqldb:
pkg.installed
mariadb-server:
pkg.installed:
- require:
- debconf: mysql-server
- pkg: python3-mysqldb
mariadb:
service.running:
- watch:
- pkg: mariadb-server
/etc/salt/minion.d/mariadb.conf:
file.managed:
- source: salt://mariadb/minion_mariadb.conf
- template: jinja
- user: root
- group: root
- mode: 600
- require:
- service: mariadb
restart_minion_for_mariadb:
service.running:
- name: salt-minion
- watch:
- file: /etc/salt/minion.d/mariadb.conf

View File

@ -0,0 +1,6 @@
mysql.host: 'localhost'
mysql.user: 'root'
mysql.pass: '{{ pillar['mariadb']['root_pw'] }}'
mysql.db: 'mysql'
mysql.unix_socket: '/run/mysqld/mysqld.sock'
mysql.charset: 'utf8'

View File

@ -5,6 +5,7 @@ base:
'hedwig.lunch.org.uk': 'hedwig.lunch.org.uk':
- debian - debian
- apache - apache
- mariadb
- backup - backup
- backup/hedwig - backup/hedwig
- certificates/client - certificates/client