Ansible setup module print facts on screen

I do ansible host1 -m setup but don't get the full console output of the facts for that host, it just confirms that it succeeded with ok. I need to run ansible-playbook with the debug module and print out hostvars.host1. How to show all the facts ad hoc and not have to use a playbook?

The command I ran used to work before I think. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/setup_module.html also says ad hoc ansible command should print facts on console.

Posted Jun 24, 2021, 3:22 PM UTC

15
bcoca•

use `ansible-config dump --only-changed` to check your configuration, it should show by default but you might have changed the default callback for adhoc

1
nowboardingOP•

I have set bin_ansible_callbacks = True and stdout_callback = debug in the config file. I like the debug callback because it prints things better. Is there a way to have the better output but still show the facts?

Why would debug module not show the facts?

1
bcoca•

it is designed as a expansion on 'default' not 'minimal' which is what the adhoc CLI uses.

It should show facts, but you'll need to increase verbosity.

1
[deleted]•

[deleted]

1
bcocaAnsible Engineer•

bin_ansilbe_callbacks is the problem, setting stdout_callback to default just makes that the one in use for both also

1