-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathsession-19.txt
52 lines (37 loc) · 1.28 KB
/
session-19.txt
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
Ansible Roles
----------------
DRY principal --> reuse the code
variables
functions
What is Ansible Role?
Role is a proper structure of variables, tasks, templates, handlers, etc. Using Roles we can re use the code...
tasks/ --> We will mention all tasks here
handlers/ --> We will mention all notifiers here
templates/ --> We will mention all templates here, with variables
files/ --> We will mention all files here, without variables
vars/ --> variables related to roles are here
defaults --> low priority variables are here
meta/ --> dependencies are mentioned here
ansible-playbook -i inventory -e ansible_user=ec2-user -e ansible_password=DevOps321 db.yaml
ansible-config = /etc/ansible/ansible.cfg
1. ANSIBLE_CONFIG
~/ --> denotes home directory
.j2 --> jinja2 template language
what are handlers in ansible?
handlers are notifiers in ansible, usually when there is a change in config we can notify some task to restart server
11 components --> 3nodejs, 1 java, 1 php, 1 go
deployment
-----------
1. create directory
2. remove old code
3. download new code
delete existing directory
create new directory
download code
extract code
ansible vault
---------------
ansible-vault create <file-name>.yaml
Ansible tags
Ansible Dynamic inventory
How Ansible can connect to 10 servers at a time?