You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The ansible module does not work with the new ansible-core package (not the ansible community) due ansible-core, being a minimal installation, it does not include the json outputter required by Salt to parse the output from the module execution
$ salt-call ansible.playbooks playbook=/opt/playbooks/hellow_world.yml
[ERROR ] Command 'ansible-playbook' failed with return code: 1
[ERROR ] stderr: [WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! Invalid callback for stdout specified: json
[ERROR ] retcode: 1
local:
----------
pid:
78819
retcode:
1
stderr:
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! Invalid callback for stdout specified: json
stdout:
The fix is simple, install the plugin ansible.posix which includes the json outputter
$ ansible-galaxy collection install ansible.posix
Setup
Salt with ansible-core installed
Steps to Reproduce the behavior
Install Salt
Install ansible-core
Add ansible.posix to ansible-core
$ ansible-galaxy collection install ansible.posix
Test with the following simple playbook execution
$ cat /srv/salt/ansible_playbooks/hello_world.sls
run ansible playbook:
ansible.playbooks:
- name: /opt/playbooks/hellow_world.yml
$ cat /opt/playbooks/hellow_world.yml
---
# This playbook prints a simple debug message
- name: Echo
hosts: 127.0.0.1
connection: local
tasks:
- name: Print debug message
debug:
msg: Hello, world!
$ salt-call state.sls ansible_playbooks.hello_world
local:
----------
ID: run ansible playbook
Function: ansible.playbooks
Name: /opt/playbooks/hellow_world.yml
Result: True
Comment: No changes to be made from playbook /opt/playbooks/hellow_world.yml
Started: 13:32:53.933081
Duration: 2814.239 ms
Changes:
Summary for local
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 2.814 s
Expected behavior
Already suggested adding this info to the module documentation and maybe worth to check/try if the required module is present and provide a more descriptive message indicating the issue and fix
The text was updated successfully, but these errors were encountered:
Description
The ansible module does not work with the new ansible-core package (not the ansible community) due ansible-core, being a minimal installation, it does not include the json outputter required by Salt to parse the output from the module execution
The fix is simple, install the plugin ansible.posix which includes the json outputter
Setup
Salt with ansible-core installed
Steps to Reproduce the behavior
Install Salt
Install ansible-core
Add ansible.posix to ansible-core
Test with the following simple playbook execution
Expected behavior
Already suggested adding this info to the module documentation and maybe worth to check/try if the required module is present and provide a more descriptive message indicating the issue and fix
The text was updated successfully, but these errors were encountered: