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

Let EC2 inventory script use r53 hostname as ansible_host #48433

Closed

Conversation

stpierre
Copy link
Contributor

@stpierre stpierre commented Nov 9, 2018

SUMMARY

This lets the user SSH to the r53 hostname, which, depending on domain
topology, may be easier to manage SSH configs for.

For instance, our hosts all have *.compute-1.amazonaws.com as their public hostname, but a sensible CNAME in route53. Using that CNAME makes the configurations in ~/.ssh/config work, even across subdomains (which are expressed through the r53 CNAME records).

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

EC2 dynamic inventory script

ANSIBLE VERSION
ansible 2.8.0.dev0 (ec2-inventory-r53-hostname-as-dest 49908c42c6) last updated 2018/11/09 13:39:59 (GMT -500)
  config file = None
  configured module search path = [u'/home/stpierre/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/stpierre/devel/ansible/lib/ansible
  executable location = /home/stpierre/devel/ansible/bin/ansible
  python version = 2.7.15 (default, Oct 15 2018, 15:24:06) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Nov 9, 2018

Hi @stpierre, thank you for submitting this pull-request!

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 9, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 aws c:inventory/contrib_script cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. inventory Inventory category needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Nov 9, 2018
@s-hertel
Copy link
Contributor

You can set hostvars like ansible_host using the constructed inventory plugin's compose option as well, though I'm not sure if that is useful in this case. You can inspect your hostvars with ansible-inventory -i contrib/inventory/ec2.py --list to help determine that.

@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Nov 10, 2018
@stpierre
Copy link
Contributor Author

Looks like that doesn't help in this case; the r53 hostname isn't included in any variables except as the inventory hostname, and

compose:
    ansible_hostname: inventory_hostname

...doesn't work. (Nor does any other iteration with s/hostname/host/.)

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 20, 2018
@stpierre stpierre force-pushed the ec2-inventory-r53-hostname-as-dest branch from 49908c4 to b679698 Compare April 23, 2019 18:31
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 23, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 2, 2019
This lets the user SSH to the r53 hostname, which, depending on domain
topology, may be easier to manage SSH configs for.
@stpierre stpierre force-pushed the ec2-inventory-r53-hostname-as-dest branch from b679698 to fda574a Compare August 27, 2019 13:38
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 27, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 4, 2019
@stpierre stpierre closed this Sep 30, 2019
@stpierre stpierre deleted the ec2-inventory-r53-hostname-as-dest branch September 30, 2019 16:32
@ansible ansible locked and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 aws c:inventory/contrib_script cloud community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. inventory Inventory category stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants