Hi,

I'm trying to set the hostname according to the facts gathered by ansible. 
I've created a role named "common" with a file "main.yml" in 
defaults-folder:

---
common_hostname: { name: "{{ ansible_hostname }}", fqdn: "{{ ansible_fqdn }}" }


In this role I've added a debug task:

- debug: msg="Hostname {{ common_hostname.name }} and FQDN {{ 
common_hostname.fqdn }}"
  with_dict: common_hostname
  tags: testing


Ansible always responds:








TASK [common : debug] 
**********************************************************

ok: [web01.testing.org] => (item={'value': u'web01', 'key': u'name'}) => {

    "item": {

        "key": "name", 

        "value": "web01"

    }, 

    "msg": "Hostname web01 and FQDN web01.testing.org"

}

ok: [web02.testing.org] => (item={'value': u'web02', 'key': u'name'}) => {

    "item": {

        "key": "name", 

        "value": "web02"

    }, 

    "msg": "Hostname web02 and FQDN web02"

}

ok: [web01.testing.org] => (item={'value': u'web01.testing.org', 'key': u
'fqdn'}) => {

    "item": {

        "key": "fqdn", 

        "value": "web01.testing.org"

    }, 

    "msg": "Hostname web01 and FQDN web01.testing.org"

}

ok: [web02.testing.org] => (item={'value': u'web02', 'key': u'fqdn'}) => {

    "item": {

        "key": "fqdn", 

        "value": "web02"

    }, 

    "msg": "Hostname web02 and FQDN web02"

}

Why do I not get the correct fully qualified domain name? Any hint would be 
appreciated.

Thanks in advance and king regards,

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e00250f1-cb4a-4458-8526-f603e81c7f9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to