[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello World"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello World"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=2 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
-------------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=2 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
---------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=3 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
-------------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=4 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
-----------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=5 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
--------------------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
-
debug:
msg: "{{ dummy_list | min }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "1"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=6 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
----------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
-
debug:
msg: "{{ dummy_list | min }}"
-
debug:
msg: "{{ dummy_list | max }}"
-
debug:
msg: "{{ dummy_list | unique }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "1"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "40"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40
]
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=8 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
----------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
-
debug:
msg: "{{ dummy_list | min }}"
-
debug:
msg: "{{ dummy_list | max }}"
-
debug:
msg: "{{ dummy_list | unique }}"
-
debug:
msg: "{{ dummy_list | union(dummy_list2) }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "1"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "40"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40,
50
]
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=9 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
-------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
-
debug:
msg: "{{ dummy_list | min }}"
-
debug:
msg: "{{ dummy_list | max }}"
-
debug:
msg: "{{ dummy_list | unique }}"
-
debug:
msg: "{{ dummy_list | union(dummy_list2) }}"
-
debug:
msg: "{{ dummy_list | intersect(dummy_list2) }}"
-
debug:
msg: "{{ 1000 | random }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "1"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "40"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40,
50
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
10,
30,
40
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "444"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=11 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
----------------------------------------------------------------------------------------------------------
[ansible@ip-172-31-80-19 ~]$ vi jinja2.yml
[ansible@ip-172-31-80-19 ~]$ cat jinja2.yml
-
name: this is our first playbook.
hosts: all
vars:
your_name: Raj
dummy_list:
- 1
- 10
- 20
- 30
- 40
dummy_list2:
- 30
- 40
- 10
- 50
tasks:
-
debug:
msg: "Hello {{ your_name }}"
-
debug:
msg: "Hello {{ your_name | upper }}"
-
debug:
msg: "Hello {{ your_name | lower }}"
-
debug:
msg: "Hello {{ your_name | replace('Raj','Gupta') }}"
-
debug:
msg: "{{ dummy_list | min }}"
-
debug:
msg: "{{ dummy_list | max }}"
-
debug:
msg: "{{ dummy_list | unique }}"
-
debug:
msg: "{{ dummy_list | union(dummy_list2) }}"
-
debug:
msg: "{{ dummy_list | intersect(dummy_list2) }}"
-
debug:
msg: "{{ 1000 | random }}"
-
debug:
msg: "{{ '/etc/ansible/ansible.cfg' | basename }}"
[ansible@ip-172-31-80-19 ~]$ ansible-playbook jinja2.yml -i inventory.txt
PLAY [this is our first playbook.] *************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [172.31.85.190]
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello RAJ"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello raj"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "Hello Gupta"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "1"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "40"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
1,
10,
20,
30,
40,
50
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": [
10,
30,
40
]
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "867"
}
TASK [debug] ***********************************************************************************************************************************************************
ok: [172.31.85.190] => {
"msg": "ansible.cfg"
}
PLAY RECAP *************************************************************************************************************************************************************
172.31.85.190 : ok=12 changed=0 unreachable=0 failed=0
[ansible@ip-172-31-80-19 ~]$
No comments:
Post a Comment