Skip to main content

Posts

Showing posts from November, 2018

Ansible Variables and Variables Precedence

Ansible Variables and Variables Precedence
What is a variable?
A variable is reference to data stored in a computer program.
How to define variable in Ansible?
Variables Defined in Inventory
Variables can be defined in inventory in two ways - 1. Host variables [web]
host1 http_port=80
host2 http_port=443
2. Group variables [web]
host1
host2

[web:vars]
http_port=80
proxy=proxy.example.com
Variables Defined in a Playbook
You can directly define variables in a playbook: - hosts: appgroup
 vars: