TO complete @Kevinwincott and @valkiriaaquatica answers (we need the error message at least !), I would suggest you use script module instead of command, which would be a better fit here anyway.
PLAY [notebook] ****************************************************************
TASK [Gathering Facts] *********************************************************
[WARNING]: Platform linux on host notebook is using the discovered Python
interpreter at /usr/bin/python3.11, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.15/reference_appendices/interpreter_discovery.html for more information.
ok: [notebook]
TASK [nachbearbeitung : Script holen] ******************************************
ok: [notebook]
TASK [nachbearbeitung : Autoupdate installieren] *******************************
fatal: [notebook]: FAILED! => {"changed": true, "cmd": ["bash", "/tmp/install.sh"], "delta": "0:05:02.058847", "end": "2023-10-25 09:15:51.770777", "msg": "non-zero return code", "rc": 1, "start": "2023-10-25 09:10:49.711930", "stderr": "sudo: timed out reading password\nsudo: a password is required", "stderr_lines": ["sudo: timed out reading password", "sudo: a password is required"], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************
notebook : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
PLAY [notebook] ****************************************************************
TASK [Gathering Facts] *********************************************************
[WARNING]: Platform linux on host notebook is using the discovered Python
interpreter at /usr/bin/python3.11, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.15/reference_appendices/interpreter_discovery.html for more information.
ok: [notebook]
TASK [nachbearbeitung : Script holen] ******************************************
ok: [notebook]
TASK [nachbearbeitung : Autoupdate installieren] *******************************
fatal: [notebook]: FAILED! => {"changed": true, "cmd": ["bash", "/tmp/install.sh"], "delta": "0:00:00.642764", "end": "2023-10-25 09:22:07.108811", "msg": "non-zero return code", "rc": 1, "start": "2023-10-25 09:22:06.466047", "stderr": "makePackage: ==> ERROR: Running makepkg as root is not allowed as it can cause permanent,\ncatastrophic damage to your system.", "stderr_lines": ["makePackage: ==> ERROR: Running makepkg as root is not allowed as it can cause permanent,", "catastrophic damage to your system."], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************
notebook : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
In the output you can see that ansible is asking for the sudo password (probably you didint wrote it in the inventory) or you can do in the command line with the -K parameter and ansible will prompt a Become pass: you password . For example, ansible-playbook youPlaybook -i yourInventroy -K after executing that ansible will prompt a Become pass: where you enter your password
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None
fatal: [notebook]: FAILED! => {âchangedâ: true, âmsgâ: ânon-zero return codeâ, ârcâ: 1, âstderrâ: âShared connection to notebook closed.\r\nâ, âstderr_linesâ: [âShared connection to notebook closed.â], âstdoutâ: â\r\nmakePackage: ==> ERROR: Running makepkg as root is not allowed as it can cause permanent,\r\ncatastrophic damage to your system.\r\nâ, âstdout_linesâ: [ââ, âmakePackage: ==> ERROR: Running makepkg as root is not allowed as it can cause permanent,â, âcatastrophic damage to your system.â]}
Just a moderatorâs note for the future, @RJGhugo, Iâve edited your outputs to use a code block (using ```), it makes that much easier to read - please consider using code blocks in future posts! Thanks!
You might be in GitHub - kewlfft/ansible-aur: Ansible module to manage packages from the AUR which provides an ansible module to interact with the AUR and various AUR helpers or makepkg directly instead of your current script. In any case, you should be able to make this work by setting up an unprivileged user with password-less sudo access. Thereâs a section in kwelfft.aurâs documentation explaining how to do this. That applies whether you use your current approach or the kewlfft.aur.aur module.
This means ansible doesnât allow to run a command as a normal user with sudo -E -u nobody [command], which seems rather an issue with ansible itself.
I would ask the ansible developers first. And if they are unwilling to fix the issue, reopen this report.
Also right now I donât see how this issue could be fixed here, as pacman-auto-update.service is run as a system service, hence it runs compulsory with root privileges.
So it looks like the only non messy way of running makepkg is how it is done right now, by deescalating permissions for that particular command. Which ansible doesnât support.
The script at this url https://raw.githubusercontent.com/cmuench/pacman-auto-update/master/install.sh is short and looks fairly simple, if I were you Iâd rewrite it using Ansible.