Merge branch 'main' into 8533-hostBasedEnvironment
This commit is contained in:
commit
cf6d884868
|
@ -0,0 +1,5 @@
|
|||
- name: Configure DB
|
||||
hosts: all
|
||||
tasks:
|
||||
- import_role:
|
||||
name: db
|
|
@ -0,0 +1,38 @@
|
|||
mariadb_base_packages:
|
||||
- mariadb-server
|
||||
- mariadb-backup
|
||||
- pmm2-client
|
||||
mariadb_requeriments:
|
||||
- curl
|
||||
- apt-transport-https
|
||||
certificates:
|
||||
- { content: '{{ ca_company_deprecated }}', dest: '/etc/mysql/ca.pem', mode: 'u=rw,g=r,o=r' }
|
||||
- { content: '{{ cert_mysql }}', dest: '/etc/mysql/cert.pem', mode: 'u=rw,g=r,o=r' }
|
||||
- { content: '{{ cert_mysql_key }}', dest: '/etc/mysql/key.pem', mode: 'u=rw,g=,o=' }
|
||||
required_directories:
|
||||
- { path: /mnt/local-backup, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqlbin, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqltmp, owner: root, group: root, mode: 'u=rwx,g=rwx,o=rwxt' }
|
||||
- { path: /mnt/mysqlbin/binlog, owner: mysql, group: mysql, mode: 'u=rwx,g=,o=' }
|
||||
- { path: /root/scripts, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /root/mariabackup, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqldata/mysql, owner: mysql, group: mysql, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /etc/systemd/system/mariadb.service.d, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
required_files_and_mariabackup_files_and_root_scripts:
|
||||
- { src: "mariadb_override.conf", dest: "/etc/systemd/system/mariadb.service.d/override.conf", mode: "u=rw,g=r,o=r" }
|
||||
- { src: "mysql-flush.sh", dest: "/etc/qemu/fsfreeze-hook.d/mysql-flush.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/bacula-before.sh", dest: "/root/mariabackup/bacula-before.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/config.sh", dest: "/root/mariabackup/config.sh", mode: "u=rwx,g=rx,o=x" }
|
||||
- { src: "files/mariabackup/inc-backup.sh", dest: "/root/mariabackup/inc-backup.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/restore-backup.sh", dest: "/root/mariabackup/restore-backup.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/check-memory.sh", dest: "/root/scripts/check-memory.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/export-privs.sh", dest: "/root/scripts/export-privs.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/mysqltuner.pl", dest: "/root/scripts/mysqltuner.pl", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/promote-master.sh", dest: "/root/scripts/promote-master.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/promote-slave.sh", dest: "/root/scripts/promote-slave.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/README.md", dest: "/root/scripts/README.md", mode: "u=rw,g=r,o=r" }
|
||||
- { src: "files/scripts/scheduler-log.sh", dest: "/root/scripts/scheduler-log.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/marianrpe/95-mariadb.cfg", dest: "/etc/nagios/nrpe.d/95-mariadb.cfg", mode: "u=rw,g=r,o=r" }
|
||||
downloads:
|
||||
- { url: "https://r.mariadb.com/downloads/mariadb_repo_setup", dest: "/tmp/mariadb_repo_setup", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { url: "https://repo.percona.com/apt/percona-release_latest.generic_all.deb", dest: "/tmp/percona-release_latest.generic_all.deb", mode: "u=rw,g=r,o=r" }
|
|
@ -44,6 +44,7 @@ mariabackup \
|
|||
--target-dir="$restoreDir" \
|
||||
2>> "$logFile"
|
||||
chown -R mysql:mysql "$dataDir"
|
||||
chmod 755 "$dataDir"
|
||||
|
||||
rm "$dataDir/mysql/slow_log."*
|
||||
rm "$dataDir/mysql/general_log."*
|
|
@ -0,0 +1,7 @@
|
|||
- name: reload-systemd
|
||||
command:
|
||||
cmd: systemctl daemon-reload
|
||||
- name: restart-mariadb
|
||||
systemd:
|
||||
name: mariadb
|
||||
state: restarted
|
|
@ -0,0 +1 @@
|
|||
- import_tasks: mariadb.yml
|
|
@ -81,7 +81,7 @@
|
|||
loop: "{{ certificates }}"
|
||||
notify: restart-mariadb
|
||||
|
||||
- when: db.branch == 'production'
|
||||
- when: db.branch == 'master'
|
||||
block:
|
||||
- name: Set MariaDB custom configuration Production
|
||||
copy:
|
|
@ -7,7 +7,7 @@ baculaDir=/mnt/mysqldata/bacula-restore
|
|||
dbBranch={{ db.branch }}
|
||||
|
||||
# Database environment
|
||||
dbEnvironment={{ dbEnvironment }}
|
||||
dbEnvironment={{ db.environment }}
|
||||
|
||||
# MariaDB cluster sibling node hostnames
|
||||
dbClusterSiblings=()
|
|
@ -15,43 +15,4 @@ dcsamba_base_packages:
|
|||
- ldb-tools
|
||||
- samba-dsdb-modules
|
||||
- samba-vfs-modules
|
||||
mariadb_base_packages:
|
||||
- mariadb-server
|
||||
- mariadb-backup
|
||||
- pmm2-client
|
||||
mariadb_requeriments:
|
||||
- curl
|
||||
- apt-transport-https
|
||||
certificates:
|
||||
- { content: '{{ ca_company_deprecated }}', dest: '/etc/mysql/ca.pem', mode: 'u=rw,g=r,o=r' }
|
||||
- { content: '{{ cert_mysql }}', dest: '/etc/mysql/cert.pem', mode: 'u=rw,g=r,o=r' }
|
||||
- { content: '{{ cert_mysql_key }}', dest: '/etc/mysql/key.pem', mode: 'u=rw,g=,o=' }
|
||||
required_directories:
|
||||
- { path: /mnt/local-backup, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqlbin, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqltmp, owner: root, group: root, mode: 'u=rwx,g=rwx,o=rwxt' }
|
||||
- { path: /mnt/mysqlbin/binlog, owner: mysql, group: mysql, mode: 'u=rwx,g=,o=' }
|
||||
- { path: /root/scripts, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /root/mariabackup, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /mnt/mysqldata/mysql, owner: mysql, group: mysql, mode: 'u=rwx,g=rx,o=rx' }
|
||||
- { path: /etc/systemd/system/mariadb.service.d, owner: root, group: root, mode: 'u=rwx,g=rx,o=rx' }
|
||||
|
||||
required_files_and_mariabackup_files_and_root_scripts:
|
||||
- { src: "mariadb_override.conf", dest: "/etc/systemd/system/mariadb.service.d/override.conf", mode: "u=rw,g=r,o=r" }
|
||||
- { src: "mysql-flush.sh", dest: "/etc/qemu/fsfreeze-hook.d/mysql-flush.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/bacula-before.sh", dest: "/root/mariabackup/bacula-before.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/config.sh", dest: "/root/mariabackup/config.sh", mode: "u=rwx,g=rx,o=x" }
|
||||
- { src: "files/mariabackup/inc-backup.sh", dest: "/root/mariabackup/inc-backup.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/mariabackup/restore-backup.sh", dest: "/root/mariabackup/restore-backup.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/check-memory.sh", dest: "/root/scripts/check-memory.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/export-privs.sh", dest: "/root/scripts/export-privs.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/mysqltuner.pl", dest: "/root/scripts/mysqltuner.pl", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/promote-master.sh", dest: "/root/scripts/promote-master.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/promote-slave.sh", dest: "/root/scripts/promote-slave.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/README.md", dest: "/root/scripts/README.md", mode: "u=rw,g=r,o=r" }
|
||||
- { src: "files/scripts/scheduler-log.sh", dest: "/root/scripts/scheduler-log.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/scripts/sync-conf.sh", dest: "/root/scripts/sync-conf.sh", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { src: "files/marianrpe/95-mariadb.cfg", dest: "/etc/nagios/nrpe.d/95-mariadb.cfg", mode: "u=rw,g=r,o=r" }
|
||||
downloads:
|
||||
- { url: "https://r.mariadb.com/downloads/mariadb_repo_setup", dest: "/tmp/mariadb_repo_setup", mode: "u=rwx,g=rx,o=rx" }
|
||||
- { url: "https://repo.percona.com/apt/percona-release_latest.generic_all.deb", dest: "/tmp/percona-release_latest.generic_all.deb", mode: "u=rw,g=r,o=r" }
|
||||
|
|
@ -5,9 +5,3 @@
|
|||
- name: reload-systemd
|
||||
command:
|
||||
cmd: systemctl daemon-reload
|
||||
- name: restart-mariadb
|
||||
systemd:
|
||||
name: mariadb
|
||||
state: restarted
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
- import_tasks: timeserver.yml
|
||||
tags: timeserver
|
||||
- import_tasks: mariadb.yml
|
||||
tags: mariadb
|
||||
- import_tasks: adsamba.yml
|
||||
tags: adsamba
|
||||
|
|
Loading…
Reference in New Issue