mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-01 05:51:56 +08:00
This will unify all the handlers to use first uppercase letter for ansible-lint to stop complaining. I went through all `notify:` occurrences and fixed them by running ``` set TEXT "text_to_replace"; set REPLACEMENT "replacement_text"; git grep -rlz "$TEXT" . | xargs -0 sed -i "s/$TEXT/$REPLACEMENT/g" ``` Then I went through all the changes and removed the ones that wasn't expected to be changed. Fixes https://pagure.io/fedora-infrastructure/issue/12391 Signed-off-by: Michal Konecny <mkonecny@redhat.com>
70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
---
|
|
- name: Ensure packages required for mariadb are installed
|
|
ansible.builtin.package:
|
|
state: present
|
|
name:
|
|
- mariadb-server
|
|
- pxz
|
|
when: ansible_cmdline.ostree is not defined
|
|
|
|
- name: Ensure packages required for mariadb are installed (el8)
|
|
ansible.builtin.package:
|
|
state: present
|
|
name:
|
|
- python3-PyMySQL
|
|
when: ansible_distribution_major_version|int >= 8
|
|
|
|
- name: Copy my.cnf
|
|
ansible.builtin.copy: src={{ item }} dest=/etc/my.cnf owner=root group=root mode=0644
|
|
with_first_found:
|
|
- "{{ mariadb_config }}"
|
|
- my.cnf.{{ inventory_hostname }}
|
|
- my.cnf.{{ host_group }}
|
|
- my.cnf.{{ dist_tag }}
|
|
- my.cnf.{{ ansible_distribution }}
|
|
- my.cnf.{{ ansible_distribution_version }}
|
|
- my.cnf.default
|
|
notify:
|
|
- Restart mariadb
|
|
|
|
- name: Enable and start mariadb database
|
|
service: name=mariadb enabled=yes state=started
|
|
|
|
- name: Set mariaddb root user password
|
|
no_log: true
|
|
mysql_user:
|
|
name: root
|
|
login_user: root
|
|
login_password: "{{ mariadb_root_password }}"
|
|
user: root
|
|
password: "{{ mariadb_root_password }}"
|
|
login_unix_socket: /var/lib/mysql/mysql.sock
|
|
check_implicit_admin: true
|
|
|
|
- name: Create .my.cnf file for future logins
|
|
ansible.builtin.template: src=dotmy.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0700
|
|
|
|
- name: Ensure mariadb has a place to backup to
|
|
ansible.builtin.file: dest=/backups state=directory owner=mysql
|
|
tags:
|
|
- mariadb-server
|
|
|
|
- name: Copy over backup scriplet
|
|
ansible.builtin.copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755
|
|
tags:
|
|
- mariadb-server
|
|
|
|
- name: Set up some cronjobs to backup databases as configured
|
|
ansible.builtin.template: >
|
|
src=cron-backup-database
|
|
dest=/etc/cron.d/cron-backup-database-{{ item }}
|
|
with_items:
|
|
- "{{ dbs_to_backup }}"
|
|
when: dbs_to_backup != []
|
|
tags:
|
|
- cron
|
|
- mariadb-server
|
|
|
|
- name: Set domain_can_mmap_files so collectd and nagios work
|
|
seboolean: name=domain_can_mmap_files state=yes persistent=yes
|