-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathroles
More file actions
52 lines (38 loc) · 1.07 KB
/
Copy pathroles
File metadata and controls
52 lines (38 loc) · 1.07 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
51
52
Understanding roles.
/etc/ansible/roles
# ansible-galaxy init admin
- admin was created successfully
# ls -l admin/
total 4
drwxr-xr-x. 2 root root 22 Dec 14 10:27 defaults
drwxr-xr-x. 2 root root 6 Dec 14 10:27 files
drwxr-xr-x. 2 root root 22 Dec 14 10:27 handlers
drwxr-xr-x. 2 root root 22 Dec 14 10:27 meta
-rw-r--r--. 1 root root 1328 Dec 14 10:27 README.md
drwxr-xr-x. 2 root root 22 Dec 14 10:27 tasks
drwxr-xr-x. 2 root root 6 Dec 14 10:27 templates
drwxr-xr-x. 2 root root 39 Dec 14 10:27 tests
drwxr-xr-x. 2 root root 22 Dec 14 10:27 vars
#vi /etc/ansible/playbook.yml
---
- hosts: all
roles:
- admin
Here it will run the role `admin` on all hosts. It will run below
# cat admin/tasks/main.yml
---
# tasks file for admin
########################################
]# cat roles/admin/tasks/main.yml
---
# tasks file for admin
- name: Install ntp modules required by our app.
yum: name={{ item }} state=present
with_items: ntp
# cat test.yaml
---
- hosts: all
become: yes
roles:
- admin
# ansible-playbook test.yaml