0

I created a bash script that has facter commands The results of this facter command is stored in a variable.

  like this:

  HOST=$(facter hostname)
  IP=$(facter networking.ip)
  

When I executed this script from an ansible playbook, I got this error:

"rc": 0,
"start": "2020-11-13 20:18:05.501085",
"stderr": "/sharedFiles/ls_script: line 11: facter: command not found\n/sharedFiles/: line 12: facter: command not found",
"stderr_lines": [

    "/sharedFiles/ls_script: line 11: facter: command not found",
    "/sharedFiles/ls_script: line 12: facter: command not found"

I have facter installed in the target host and in the box that I'm running ansible. If I execute this script locally I got the facter information.

Viviane
  • 1
  • 1

1 Answers1

0

Try using the absolute path to facter

HOST=$(/path/to/facter hostname)
IP=$(/path/to/facter networking.ip)

you can find it with

which facter
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134