Setup module command line: permissions denied

33 views
Skip to first unread message

Billie XU

unread,
Jan 23, 2017, 2:25:08 PM1/23/17
to Ansible Project
Hi all, 

I need to get a list of available facts from one of my machines. I can run playbook against it (ssh keys and password-less access already setup) but for some reason when I run the following command it complains permission denied:


ansible master
-i hosts -m setup


master only has one host IP address

hosts is the default inventory file

I have used 

ansible master -m setup


as suggested by many posts but got the warning: no hosts matched, nothing to do :/

I honestly don't know what's wrong.

If anyone can solve the problem, could you please let me know how do you normally print out all available facts in a playbook? I dont know which ones are available thats why I want to print out all of them.

Thank you all very much.

Cheers,
Billie

Johannes Kastl

unread,
Jan 24, 2017, 5:49:34 AM1/24/17
to ansible...@googlegroups.com
On 23.01.17 20:18 Billie XU wrote:

> ansible master -i hosts -m setup

This line does not tell ansible to use sudo to get elevated rights, so
it is run as the normal user ansible logs in with.

Try to add "-b" (if you dont require a sudo password) or "-b -K" to
your command.

Although I do not know why setup would require root, it does not on my
machines.

Johannes

signature.asc

Brian Coca

unread,
Jan 24, 2017, 9:44:45 AM1/24/17
to ansible...@googlegroups.com
Billie Xu, 
Please supply the full error output 'permission denied' can be many things.


FYI, setup does not require root, but if you are root you may get access to more facts, depending on your OS, distro and configuration.


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages