-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase-cache.yml
More file actions
50 lines (50 loc) · 1.49 KB
/
database-cache.yml
File metadata and controls
50 lines (50 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
- hosts: database
become: yes
tasks:
- name: Garantindo Pacotes
package:
name: ['mariadb', 'memcached', 'python3-PyMySQL']
state: present
- name: Garantindo MariaDB e Memcached em interface privada
lineinfile:
path: '{{ item.path }}'
line: '{{ item.line }}'
regex: '{{ item.regex }}'
loop:
- path: /etc/sysconfig/memcached
line: OPTIONS="-l 172.27.11.30"
regex: OPTIONS="-l
- path: /etc/my.cnf.d/mariadb-server.cnf
line: bind-address=172.27.11.30
regex: '#?bind-address\s*=\s*[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}'
- name: Garantindo servicos MariaDB e Memcached
service: #systemd
name: '{{ item }}'
state: started # stopped, restarted, reloaded
enabled: yes
loop:
- mariadb
- memcached
- name: Copiando base de dados
copy:
src: /root/playbooks/files/dump.sql
dest: /tmp/dump.sql
- name: Garantindo base de dados da aplicacao
community.mysql.mysql_db:
name: infraagil
login_unix_socket: /var/lib/mysql/mysql.sock
register: database
- name: Garantindo dados iniciais
community.mysql.mysql_db:
name: infraagil
login_unix_socket: /var/lib/mysql/mysql.sock
state: import
target: /tmp/dump.sql
when: database.changed
- name: Garantindo usuario da aplicacao
community.mysql.mysql_user:
name: devops
password: 4linux
priv: infraagil.*:ALL
host: '%'
login_unix_socket: /var/lib/mysql/mysql.sock