cancel
Showing results for 
Search instead for 
Did you mean: 
  • 570 Views

Section 3.5 on RH294 course custom facts not showing up (headache resolved)

Jump to solution

Hi,

I have a curious case that I want to share with you (take me around one hour to realise what was happening)

In RH294 course on section 3.5 Managing Facts I was trying to set up custom facts, following the instructions I set up the custom facts on workstation /etc/ansible/facts.d/<filename>.fact

All ok (here comes the funny part), until I execute the playbook on localhost using ansible.builtin.debug module and referring the var ansible_local, fact were not showing up (facts.d are ok, file rights ok). After many tries, I decided to go old school ansible-playbook, Eureka, it works! but Why? 

Just remind that ansible-navigator is executed behind a container if you use localhost ansible_locals will not showing up custom localhost facts because there aren´t custom facts inside the container.

To test my affirmation, I set up custom facts on host b and eureka it works!

My suggestion will be to add a reminder on this lesson about this situation where ansible-navigator use a container and don´t try to gather ansible_locals on localhost

Please feel free to correct me in the case I make a mistake or if there´s something wrong in my post

1 Solution

Accepted Solutions
Travis
Moderator
Moderator
  • 540 Views

@Excaliburst -

Excellent observation, however, it can gather facts even from localhost. Keep in mind, localhost isn't workstation. Localhost is actually the container running within the ansible-navigator process. So one other way to test the facts from workstation is be sure to add that to the inventory and target the workstation machine.

Within the newer AAP environments using ansible-navigator to launch commands the concept of localhost is more or less meaningless for any systems to manage. The only thing localhost is useful for within the containerized environment is communicating with APIs and such and prevents needing SSH sessions reaching out to various systems.

I share the following post when I deliver courses.

When Localhost isn't what it seems: https://www.ansible.com/blog/when-localhost-isnt-what-it-seems-in-red-hat-ansible-automation-platfor...

 

There is also another RHLC post here -

https://learn.redhat.com/t5/Automation-Management-Ansible/AAP2-and-Ansible-Navigator-Execution-Envir...

 

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training

View solution in original post

1 Reply
Travis
Moderator
Moderator
  • 541 Views

@Excaliburst -

Excellent observation, however, it can gather facts even from localhost. Keep in mind, localhost isn't workstation. Localhost is actually the container running within the ansible-navigator process. So one other way to test the facts from workstation is be sure to add that to the inventory and target the workstation machine.

Within the newer AAP environments using ansible-navigator to launch commands the concept of localhost is more or less meaningless for any systems to manage. The only thing localhost is useful for within the containerized environment is communicating with APIs and such and prevents needing SSH sessions reaching out to various systems.

I share the following post when I deliver courses.

When Localhost isn't what it seems: https://www.ansible.com/blog/when-localhost-isnt-what-it-seems-in-red-hat-ansible-automation-platfor...

 

There is also another RHLC post here -

https://learn.redhat.com/t5/Automation-Management-Ansible/AAP2-and-Ansible-Navigator-Execution-Envir...

 

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training
Join the discussion
You must log in to join this conversation.