Reputation: 155
Is there a way I can inherit variables between groups without using [all:vars]
Example:
[GROUP_A]
server-A1
[GROUP_A:vars]
vpc_cidr="192.10.0.0/21"
[GROUP_B]
server-B1
[GROUP_B:vars]
public_cidr="{{ vpc_cidr }}"
Upvotes: 4
Views: 3561
Reputation: 927
I would do it with child groups, put shared vars in the parent
[parent_group:vars]
some_var=foo
some_other_var=bar
[parent_group:children]
GROUP_A
GROUP_B
[GROUP_A]
group_a_specific_var=foobar
[GROUP_B]
group_b_specific_var=barfoo
Upvotes: 5