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

plugins/inventory/cobbler: Collect IP addresses for hosts and add opt… #6711

Merged

Conversation

opoplawski
Copy link
Contributor

…ion to collect all DNS name to IP address mappings

SUMMARY

It can be very helpful to have easy access to a host's primary IP address and various DNS name to IP address mappings defined in cobbler.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

plugins/inventory/cobbler.py

ADDITIONAL INFORMATION
- debug:
    msg: "My IP address is {{ ip_address }}"
- debug:
    msg: "The IP address of server.example.com is {{ hostvars['server.example.com']['ip_address'] }}"
- debug:
    mesg "The IP address of server-interface.example.com is {{ cobbler_ip_addresses['server-interface.example.com'] }}"

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request inventory inventory plugin plugins plugin (any type) labels Jun 15, 2023
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 labels Jun 15, 2023
@opoplawski opoplawski force-pushed the cobbler_ip_address branch from c99940e to f96ddd8 Compare June 15, 2023 18:00
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 15, 2023
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Jun 15, 2023
@opoplawski opoplawski force-pushed the cobbler_ip_address branch 2 times, most recently from bb59d94 to ef681ef Compare June 15, 2023 19:30
@opoplawski
Copy link
Contributor Author

One question I have is whether or not it is okay to simply add the ip_address and ipv6_address variables to the host variables. Not sure if there is any standard among inventory plugins.

@felixfontein
Copy link
Collaborator

One problem with such generic names is that you can likely interfere with existing uses of these names in existing playbooks, roles, or inventories. Usually it's better to prefix them with something that's specific to this inventory plugin; for example, the community.docker.docker_containers inventory plugin prefixes everything with docker_. (This of course can still cause conflicts, but it is a little bit less likely :) )

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jun 15, 2023
@opoplawski
Copy link
Contributor Author

Yeah, I'm going to think about it for a little bit, but I think that a cobbler_ prefix probably is in order.

@opoplawski
Copy link
Contributor Author

Though I think cobbler_ip_address might be confused with the IP address of the cobbler server.

…ion to collect all DNS name to IP address mappings
@opoplawski opoplawski force-pushed the cobbler_ip_address branch from ef681ef to 02187c0 Compare June 16, 2023 15:56
@felixfontein
Copy link
Collaborator

If nobody objects, I'll merge this by tomorrow morning.

@felixfontein felixfontein merged commit 24f27a0 into ansible-collections:main Jun 19, 2023
@patchback
Copy link

patchback bot commented Jun 19, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/24f27a0bdf3a2e72a96072a222845235f1e64e88/pr-6711

Backported as #6727

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jun 19, 2023
#6711)

plugins/inventory/cobbler: Collect IP addresses for hosts and add option to collect all DNS name to IP address mappings

(cherry picked from commit 24f27a0)
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jun 19, 2023
@felixfontein
Copy link
Collaborator

@opoplawski thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Jun 19, 2023
…lect IP addresses for hosts and add opt… (#6727)

plugins/inventory/cobbler: Collect IP addresses for hosts and add opt… (#6711)

plugins/inventory/cobbler: Collect IP addresses for hosts and add option to collect all DNS name to IP address mappings

(cherry picked from commit 24f27a0)

Co-authored-by: Orion Poplawski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request inventory inventory plugin plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants