fqdn for all host interfaces

Hi,

I have a 3 tier setup, web, app and db.

Each tier has a mgmt, upper and lower network interface

I need to add the fqdn for the lower app interface in the hosts.equiv on the db server

I was doing this with IP which worked fine using

{{ hostvars[host][informix_interface][‘ipv4’][‘address’] }} {{ db_user }}

but need to change to use fqdn. This isn’t in the facts.

If I run

dig -x 192.168.24.12 +short
test-boapp-02.lower.foo.com.

I get the name i’m looking for. Just wondering how I could go about using it. As currently its in a loop in a template.

Can you set variables from commands in jinja2 templates?

Any help appreciated. I could semi hack it since I could use variables for the interface name and the domain and just build up the correct string

James

shell: dig...
register: digoutput
now the digoutput variable has the output of dig

Hi,

Thanks though this is in a loop inside the templates. I have many hosts

I was thinking of building up a dictionary in the playbook for each host.

Was a little unsure how to build that up

you can use set_fact for each host before calling the template

Thanks,

will give that a go