Loop through Ansible Tower Inventory
up vote
0
down vote
favorite
Is it possible to let a job template with an Ansible Role loop through a other inventory host in Ansible Tower.
Currently I'm setting up an application with the production servers inventory and I would like to get the ip-adresses of the database host to configure the configuration.
I already tried the following code:
{% for host in groups.name:database-hosts %}{{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
{% for host in ('inventory_hostnames', 'database-hosts') }"{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
Any workarounds or suggestions about how to do this.
Thank you!
ansible yaml ansible-inventory ansible-facts ansible-tower
add a comment |
up vote
0
down vote
favorite
Is it possible to let a job template with an Ansible Role loop through a other inventory host in Ansible Tower.
Currently I'm setting up an application with the production servers inventory and I would like to get the ip-adresses of the database host to configure the configuration.
I already tried the following code:
{% for host in groups.name:database-hosts %}{{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
{% for host in ('inventory_hostnames', 'database-hosts') }"{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
Any workarounds or suggestions about how to do this.
Thank you!
ansible yaml ansible-inventory ansible-facts ansible-tower
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is it possible to let a job template with an Ansible Role loop through a other inventory host in Ansible Tower.
Currently I'm setting up an application with the production servers inventory and I would like to get the ip-adresses of the database host to configure the configuration.
I already tried the following code:
{% for host in groups.name:database-hosts %}{{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
{% for host in ('inventory_hostnames', 'database-hosts') }"{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
Any workarounds or suggestions about how to do this.
Thank you!
ansible yaml ansible-inventory ansible-facts ansible-tower
Is it possible to let a job template with an Ansible Role loop through a other inventory host in Ansible Tower.
Currently I'm setting up an application with the production servers inventory and I would like to get the ip-adresses of the database host to configure the configuration.
I already tried the following code:
{% for host in groups.name:database-hosts %}{{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
{% for host in ('inventory_hostnames', 'database-hosts') }"{ hostvars[host].ansible_default_ipv4.address }}{%- if loop.first %}{% endif %}{% endfor %}"
Any workarounds or suggestions about how to do this.
Thank you!
ansible yaml ansible-inventory ansible-facts ansible-tower
ansible yaml ansible-inventory ansible-facts ansible-tower
asked Nov 21 at 12:40
Danny
7110
7110
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412252%2floop-through-ansible-tower-inventory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown