Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

gather ansible_default_ipv4 if undefined - #29

Open
extra-vars wants to merge 1 commit into
arillso:mainfrom
extra-vars:just_the_facts
Open

gather ansible_default_ipv4 if undefined#29
extra-vars wants to merge 1 commit into
arillso:mainfrom
extra-vars:just_the_facts

Conversation

@extra-vars

Copy link
Copy Markdown

Currently the role assumes the ansible_default_ipv4 variable has been gathered prior to the roles execution. This results in the following failure:

TASK [arillso.hosts : Edits the hosts file in /etc] ****************************************************************************************************
fatal: [piTest]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

This PR adds a task to gather only the network facts from the host if ansible_default_ipv4 is undefined.

@arillso thank you for your work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants