-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathlab2-2.1-grade.yml
More file actions
34 lines (32 loc) · 999 Bytes
/
Copy pathlab2-2.1-grade.yml
File metadata and controls
34 lines (32 loc) · 999 Bytes
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
- hosts: localhost
roles:
- inventory
- hosts: db
gather_facts: false
tasks:
- name: Verify devops user is created
shell: "grep db_user /etc/passwd | cut -d: -f1"
register: output
- fail:
msg: "FAILED: User db_user not present"
when: output.stdout != "db_user"
- debug:
msg: "Success: db_user user present"
when: output.stdout == "db_user"
- name: Verify correct my.cnf file is created
shell: "grep Ansible /etc/my.cnf"
register: output
- fail:
msg: "FAILED: File is not copied"
when: output.stdout != "# Ansible file"
- debug:
msg: "Success: File is copied"
- name: Verify mariadb service is started
service_facts:
register: result
- fail:
msg: "FAILED: Mariadb service is not running"
when: result.ansible_facts.services['mariadb.service'].state != "running"
- debug:
msg: "Success: Mariadb service is running"
when: result.ansible_facts.services['mariadb.service'].state == "running"