vpn: refs #8140 - Refactor main yml and add pmm template
This commit is contained in:
parent
e969c33f65
commit
7f372d20f4
|
@ -33,6 +33,11 @@ required_mariabackup_files_and_scripts:
|
|||
- { src: scripts/events-demote.sh, dest: /root/scripts/events-demote.sh, mode: u=rwx,g=rx,o=rx }
|
||||
- { src: scripts/README.md, dest: /root/scripts/README.md, mode: u=rw,g=r,o=r }
|
||||
- { src: scripts/scheduler-log.sh, dest: /root/scripts/scheduler-log.sh, mode: u=rwx,g=rx,o=rx }
|
||||
configuration_files:
|
||||
- { src: "conf/z99-local.cnf", dest: "/etc/mysql/mariadb.conf.d/z99-local.cnf", owner: "root", group: "root", mode: "u=rw,g=r,o=r" }
|
||||
- { src: "mariabackup/my.cnf", dest: "/root/mariabackup/my.cnf", owner: "root", group: "root", mode: "u=rw,g=,o=" }
|
||||
- { src: "pmm-agent.yaml", dest: "/usr/local/percona/pmm2/config/pmm-agent.yaml", owner: "pmm-agent", group: "pmm-agent", mode: "u=rw,g=rw,o=" }
|
||||
- { src: "check-memory.cron", dest: "/etc/cron.d/vn-check-memory", owner: "root", group: "root", mode: "u=rw,g=r,o=r" }
|
||||
downloads:
|
||||
- url: https://r.mariadb.com/downloads/mariadb_repo_setup
|
||||
dest: /tmp/mariadb_repo_setup
|
||||
|
|
|
@ -9,3 +9,7 @@
|
|||
service:
|
||||
name: nagios-nrpe-server
|
||||
state: restarted
|
||||
- name: restart-percona
|
||||
service:
|
||||
name: pmm-agent.service
|
||||
state: restarted
|
||||
|
|
|
@ -3,35 +3,29 @@
|
|||
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={{ db.version | default('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: Update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install MariaDB packages
|
||||
apt:
|
||||
name: "{{ mariadb_base_packages }}"
|
||||
state: present
|
||||
install_recommends: no
|
||||
|
||||
- name: Add tmpfs in /etc/fstab
|
||||
blockinfile:
|
||||
path: /etc/fstab
|
||||
|
@ -39,15 +33,6 @@
|
|||
block: |
|
||||
tmpfs /mnt/mysqltmp tmpfs rw,size={{ mysqltmpsize }} 0 0
|
||||
register: fstab
|
||||
|
||||
- name: Configure MariaDB memory check CRON
|
||||
template:
|
||||
src: check-memory.cron
|
||||
dest: /etc/cron.d/vn-check-memory
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
|
||||
- name: Configure MariaDB scheduler log CRON
|
||||
copy:
|
||||
src: scheduler-log.cron
|
||||
|
@ -55,7 +40,6 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
|
||||
- name: Insert MySQL certificates
|
||||
no_log: true
|
||||
copy:
|
||||
|
@ -66,7 +50,6 @@
|
|||
mode: "{{ item.mode }}"
|
||||
loop: "{{ certificates }}"
|
||||
notify: restart-mariadb
|
||||
|
||||
- name: Ensure required directories exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -75,7 +58,6 @@
|
|||
group: "{{ item.group }}"
|
||||
mode: "{{ item.mode }}"
|
||||
loop: "{{ required_directories }}"
|
||||
|
||||
- name: Copy required MariaBackup files and scripts
|
||||
copy:
|
||||
src: "{{ item.src }}"
|
||||
|
@ -84,7 +66,15 @@
|
|||
group: root
|
||||
mode: "{{ item.mode }}"
|
||||
loop: "{{ required_mariabackup_files_and_scripts }}"
|
||||
|
||||
- name: Deploy configuration files
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: "{{ item.owner }}"
|
||||
group: "{{ item.group }}"
|
||||
mode: "{{ item.mode }}"
|
||||
loop: "{{ configuration_files }}"
|
||||
notify: restart-percona
|
||||
- name: Set MariaDB common configuration
|
||||
copy:
|
||||
src: conf/z90-vn.cnf
|
||||
|
@ -93,23 +83,6 @@
|
|||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
notify: restart-mariadb
|
||||
|
||||
- name: Set MariaDB local configuration template
|
||||
template:
|
||||
src: conf/z99-local.cnf
|
||||
dest: /etc/mysql/mariadb.conf.d/
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
|
||||
- name: Set MariaBackup connection configuration
|
||||
template:
|
||||
src: mariabackup/my.cnf
|
||||
dest: /root/mariabackup/
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=,o=
|
||||
|
||||
- name: Override MariaDB systemd service configuration
|
||||
copy:
|
||||
src: mariadb_override.conf
|
||||
|
@ -118,7 +91,6 @@
|
|||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
notify: reload-systemd
|
||||
|
||||
- name: Set MariaDB NRPE configuration
|
||||
copy:
|
||||
src: nrpe/95-mariadb.cfg
|
||||
|
@ -127,12 +99,10 @@
|
|||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
notify: restart-nrpe
|
||||
|
||||
- name: Check if /var/lib/mysql/ exists
|
||||
stat:
|
||||
path: /var/lib/mysql/
|
||||
register: mysql_dir
|
||||
|
||||
- when: mysql_dir.stat.exists
|
||||
block:
|
||||
|
||||
|
@ -149,7 +119,6 @@
|
|||
file:
|
||||
path: /var/lib/mysql/
|
||||
state: absent
|
||||
|
||||
- name: Mount all filesystems from /etc/fstab
|
||||
command: mount -a
|
||||
when: fstab.changed
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# Updated by `pmm-agent setup`.
|
||||
---
|
||||
id: /agent_id/{{ pmm.id }}
|
||||
listen-address: 127.0.0.1
|
||||
listen-port: 7777
|
||||
server:
|
||||
address: {{ pmm.address }}
|
||||
username: {{ pmm.username }}
|
||||
password: {{ pmm.password }}
|
||||
insecure-tls: {{ pmm.insecure }}
|
||||
paths:
|
||||
paths_base: /usr/local/percona/pmm2
|
||||
exporters_base: /usr/local/percona/pmm2/exporters
|
||||
node_exporter: /usr/local/percona/pmm2/exporters/node_exporter
|
||||
mysqld_exporter: /usr/local/percona/pmm2/exporters/mysqld_exporter
|
||||
mongodb_exporter: /usr/local/percona/pmm2/exporters/mongodb_exporter
|
||||
postgres_exporter: /usr/local/percona/pmm2/exporters/postgres_exporter
|
||||
proxysql_exporter: /usr/local/percona/pmm2/exporters/proxysql_exporter
|
||||
rds_exporter: /usr/local/percona/pmm2/exporters/rds_exporter
|
||||
azure_exporter: /usr/local/percona/pmm2/exporters/azure_exporter
|
||||
vmagent: /usr/local/percona/pmm2/exporters/vmagent
|
||||
tempdir: {{ pmm.tempdir }}
|
||||
pt_summary: /usr/local/percona/pmm2/tools/pt-summary
|
||||
pt_pg_summary: /usr/local/percona/pmm2/tools/pt-pg-summary
|
||||
pt_mysql_summary: /usr/local/percona/pmm2/tools/pt-mysql-summary
|
||||
pt_mongodb_summary: /usr/local/percona/pmm2/tools/pt-mongodb-summary
|
||||
ports:
|
||||
min: 42000
|
||||
max: 51999
|
||||
log-level: warn
|
||||
debug: false
|
||||
trace: false
|
||||
loglinescount: 1024
|
||||
window-connected-time: 1h0m0s
|
Loading…
Reference in New Issue