Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue using {{ansible_fqdn}} in openstack VM #18006

Closed
aoyawale opened this issue Oct 13, 2016 · 1 comment
Closed

Issue using {{ansible_fqdn}} in openstack VM #18006

aoyawale opened this issue Oct 13, 2016 · 1 comment
Labels
affects_2.1 This issue/PR affects Ansible v2.1 bug This issue/PR relates to a bug.

Comments

@aoyawale
Copy link

ISSUE TYPE

-Bug Report

  • Bug Report
COMPONENT NAME

{{ansible_fqdn}}

ANSIBLE VERSION
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

using certain ansible variables. Using this playbook https://github.com/jdauphant/ansible-role-ssl-certs

OS / ENVIRONMENT
SUMMARY

I'm trying to use the "{{ansible_fqdn}}" to name certain files with the hostname in a VM in openstack. Openstack has private/public IP/Hostname and it uses the private hostname to name the file. The playbook I'm using is https://github.com/jdauphant/ansible-role-ssl-certs/blob/master/defaults/main.yml. Looked around google to see how ansible finds this hostname and it said by using:

python -c "import socket; print socket.gethostname()"
python -c "import socket; print socket.gethostbyaddr('result from previous command')"

Is their a way to make ansible query DNS using the Public IP to get the Public name?

STEPS TO REPRODUCE
https://github.com/jdauphant/ansible-role-ssl-certs/blob/master/defaults/main.yml

EXPECTED RESULTS

To name the file using the Public hostname or the name that DNS has instead of the name of the VM when it was created. For example, DNS has this hostname as dude.hadoop.cloud.org but, instead it created the file with the name of the VM when it was created.

ACTUAL RESULTS
When you create a VM in openstack it asks for an instance name. A VM is created with $instance name and uses that as its private name. This is the name that ansible picks up. This is somewhat the same with AWS.
@ansibot ansibot added bug_report affects_2.1 This issue/PR affects Ansible v2.1 labels Oct 13, 2016
@jctanner
Copy link
Contributor

@chagara Is the public IP address listed in the "ip addr show" output? I don't think most cloud instances expose the public IP to the instance. I think you probably need to look at using the API to get the data you want, which is probably available via the open stack facts module: http://docs.ansible.com/ansible/os_server_facts_module.html

Please take a look into that and if you need further guidance, use the ansible project mailing list or the irc channel.

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.1 This issue/PR affects Ansible v2.1 bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants