159 lines
4.1 KiB
YAML
159 lines
4.1 KiB
YAML
# Review /root/scripts/check-memory.sh --> It's not optimal to do what this program does
|
|
# Also review the cron task /root/scripts/scheduler-log.sh
|
|
|
|
- name: Ensure Install requirements for MariaDB repository setup script
|
|
apt:
|
|
name: "{{ mariadb_requeriments }}"
|
|
state: present
|
|
install_recommends: no
|
|
|
|
- name: Download required setup files
|
|
get_url:
|
|
url: "{{ item.url }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ downloads }}"
|
|
|
|
- name: Run MariaDB repository setup script
|
|
command:
|
|
cmd: "/bin/bash /tmp/mariadb_repo_setup --mariadb-server-version=10.11.10"
|
|
creates: "/etc/apt/sources.list.d/mariadb.list"
|
|
|
|
- name: Install Percona repository package
|
|
apt:
|
|
deb: "/tmp/percona-release_latest.generic_all.deb"
|
|
state: present
|
|
install_recommends: no
|
|
|
|
- name: Install MariaDB packages
|
|
apt:
|
|
name: "{{ mariadb_base_packages }}"
|
|
state: present
|
|
install_recommends: no
|
|
|
|
- name: Ensure required directories exist
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ item.owner }}"
|
|
group: "{{ item.group }}"
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ required_directories }}"
|
|
|
|
- name: Ensure required custom and Mariabackup files are copied to their destinations and root scripts
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: root
|
|
group: root
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ required_files_and_mariabackup_files_and_root_scripts }}"
|
|
notify: reload systemd
|
|
|
|
- name: Add tmpfs in /etc/fstab
|
|
blockinfile:
|
|
path: /etc/fstab
|
|
marker: "# {mark} ANSIBLE-MANAGED TMPFS ENTRY"
|
|
block: |
|
|
tmpfs /mnt/mysqltmp tmpfs rw,size=6144M 0 0
|
|
register: fstab
|
|
|
|
- name: Mount all filesystems from /etc/fstab
|
|
command: mount -a
|
|
when: fstab.changed
|
|
|
|
# - name: Set MariaDB Cron to /etc/cron.d
|
|
# template:
|
|
# src: templates/cron_mariadb
|
|
# dest: /etc/cron.d/vn
|
|
# owner: root
|
|
# group: root
|
|
# mode: u=rw,g=r,o=r
|
|
|
|
- name: Insert MySQL certificates
|
|
no_log: true
|
|
copy:
|
|
content: "{{ item.content }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: mysql
|
|
group: mysql
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ certificates }}"
|
|
notify: restart-mariadb
|
|
|
|
- when: production is true
|
|
block:
|
|
- name: Set MariaDB custom configuration Production
|
|
copy:
|
|
src: "{{ item }}"
|
|
dest: /etc/mysql/mariadb.conf.d/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
with_items:
|
|
- "mariaconfigfiles/z90-vn.cnf"
|
|
- "mariaconfigfiles/z95-production.cnf"
|
|
notify: restart-mariadb
|
|
|
|
- name: Reminder to check mount points
|
|
debug:
|
|
msg: |
|
|
Remember to check the following mount points:
|
|
- /var/lib/mysql
|
|
- /mnt/mysqlbin
|
|
- /mnt/local-backup
|
|
Make sure they are correctly configured and accessible.
|
|
|
|
- when: testdb is true
|
|
block:
|
|
- name: Set MariaDB custom configuration Test
|
|
copy:
|
|
src: "{{ item }}"
|
|
dest: /etc/mysql/mariadb.conf.d/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
with_items:
|
|
- "files/mariaconfigfiles/z90-vn.cnf"
|
|
- "files/mariaconfigfiles/z92-testing.cnf"
|
|
notify: restart-mariadb
|
|
|
|
- name: Set MariaBackup custom template configuration Test
|
|
template:
|
|
src: test-db/apply.config.sh
|
|
dest: /root/mariabackup/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=,o=
|
|
|
|
- name: Set MariaDB local configuration file for test-db
|
|
copy:
|
|
src: files/mariabackuptest/apply.sql
|
|
dest: /root/mariabackup/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
|
|
- name: Reminder to check mount points environment test
|
|
debug:
|
|
msg: |
|
|
Remember to check the following mount points:
|
|
- /mnt/mysqltmp
|
|
Make sure they are correctly configured and accessible.
|
|
|
|
- name: Set Custom Configuration local template
|
|
template:
|
|
src: z99-local.cnf
|
|
dest: /etc/mysql/mariadb.conf.d/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
|
|
- name: Set MariaBackup custom template configuration Test
|
|
template:
|
|
src: "my.cnf"
|
|
dest: /root/mariabackup/
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=,o=
|