devops - need to get two different config files with diffferent set of variables using same template and playbook Ansible -
i want deploy code in 2 systems....
group_vars/all has different variables, eg.
--- # group variable webservers username: abc hosts have windows group , 2 machine ips..
[webservers] 10.0.1.2 [databases] 10.0.1.3 role/tasks/playbook have play execute on both machines...
--- - hosts: roles: - base current:
- its taking var folder , substituting in jinja2 template , running tasks based on template info.
need:
- i in situation 1 user variable username should different 2 machines..... want run same playbook , same template
username=abcon 1 machine ,username=xyzon machine..
is possible?
beside group_vars there host_vars, can define individual variables per host. host dependent should stored there , username appears fit there.
for hosts other 2 can fall variables defined in group_vars or set default value in template:
{{ username | default("axelfoley")}}
Comments
Post a Comment