Razique Mahroua
2020-03-18 b85c91a8192593f6b62f93e11c971868964343a9
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
---
- block:
    # Python 3 bindings for Yum are not present on RHEL 7.X images
  - name: Install MySQL packages
    command: yum -y install mariadb-server firewalld
 
  - name: Ensure firewalld is running
    service:
      name: firewalld
      state: started
      enabled: yes
 
    # Python 3 bindings for firewalld are not present on RHEL 7.X images
  - name: Open Firewall for MySQL use
    shell: |
        firewall-cmd --permanent --zone=public --add-service=mysql
        firewall-cmd --reload
 
  - name: Ensure MySQL is running at boot
    service:
      name: mariadb
      enabled: yes
      state: started
 
  - name: Setup up SQL commands
    template:
      src: files/prime.sql
      dest: /tmp/prime.sql
      mode: 400
    when: mysql_root_password is defined
 
  - name: Setup root account
    shell: mysql </tmp/prime.sql
    when: mysql_root_password is defined
  become: true