Hello,
Let me preface this with ‘I have no idea what I’m doing’.
So I am trying to figure out how to gather facts from Linux devices which do not have Python installed. I think this means the setup module cannot run so I would need to get information by using the raw module and just capturing the information as the stdout of the job?
First of all, is that even the right way to go about this?
Secondly, I am purely interacting with AWX via the API. So if I need to access this information and I capture it from the result of the job, I have no idea how to relate the information captured with the host that the information was collected from.
Any guidance here would be greatly appreciated!
You can still leverage awx fact cache http://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#fact-caching paired with ansible set_fact and cacheable: true http://docs.ansible.com/ansible/latest/modules/set_fact_module.html
-
hosts: all
gather_facts: false
tasks:
-
raw: “cat /proc/cpuinfo”
register: fact_cpu_info
-
set_fact:
cacheable: true
foo: “bar”
something: “else”
cpu_info: “{{ fact_cpu_info }}”
After running a job template with fact cache enabled in AWX you can view the facts for the host at api/v2/hosts//ansible_facts/
Thank you Chris, that’s incredibly helpful.
This will be incredibly common in my situation and we’ll need to gather anywhere from 10-30 pieces of information per device (all without python). It seems like making a module that does this and parses the information would make sense. But before I embark on that journey, it seems like someone would have already done this. I see plenty of modules that work against things without python (mainly networking related), but nothing for Linux devices that ‘can’t’ run python. Am I just not finding it or does something like that not exist?
That sort of question is best asked on the Ansible mailing list. Your observation is correct, network modules are the largest set of modules that presume the remote node doesn’t have python. It’s not a priority for core to support a system where the remote machine doesn’t have python.