Hi everyone, I have a problem executing the following playbook
- hosts:
- server01
gather_facts: no
tasks:
- name: task01
command: bash /opt/script01.sh
async: 86400 # 24 hours
poll: 60 # checks every minute
Ansible version
# ansible --version
ansible [core 2.16.6]
config file = /home/user01/ansible/ansible.cfg
configured module search path = ['/home/user01/ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user01/ansible/.venv/lib/python3.10/site-packages/ansible
ansible collection location = /home/user01/ansible/collections:/usr/share/ansible/collections
executable location = /home/user01/ansible/.venv/bin/ansible
python version = 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (/home/user01/ansible/.venv/bin/python3)
jinja version = 3.1.2
libyaml = True
When the playbook runs it fails with the following message
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC POLL on server01: jid=j99628350561.434557 started=1 finished=0
ASYNC FAILED on server01: jid=j99628350561.434557
fatal: [server01]: FAILED! => {"ansible_job_id": "j99628350561.434557", "changed": false, "finished": 1, "msg": "could not find job", "results_file": "/root/j99628350561.434557", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************
server01 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
root@controller:~#
I have configured ssh options in /root/.ssh/config
file
Host *
ControlMaster auto
ControlPersist 86400 # 24hours
However, the ansible async directory exists on the target host.
# cat /root/.ansible_async/j99628350561.434557 | jq
{
"changed": true,
"stdout": "Oct 28 21:05:46 output command",
"stderr": "",
"rc": 0,
"cmd": [
"bash",
"/opt/script01.sh"
],
"start": "2024-10-28 21:05:46.085160",
"end": "2024-10-29 07:00:25.368110",
"delta": "9:54:39.282950",
"msg": "",
"invocation": {
"module_args": {
"_raw_params": "bash /opt/script01.sh",
"_uses_shell": false,
"expand_argument_vars": true,
"stdin_add_newline": true,
"strip_empty_ends": true,
"argv": null,
"chdir": null,
"executable": null,
"creates": null,
"removes": null,
"stdin": null
}
}
}
#
Any idea what I’m doing wrong? let me know please.
Best regards