[BUG]: sudo on Alpine doesn't work out-of-the-box #35

Closed
opened 2026-09-16 15:46:02 +04:00 by max · 0 comments
Owner

📋 Description

Some scripts that requires sudo don't work on Alpine, because on this system sudo requires additional configuration. For example, root is not added to sudoers by default, while on the most of other systems it is.

🔁 Steps to Reproduce

  1. Run any playbook/task/role that contain script with privileges elevation with sudo

✅ Expected Behavior

sudo is configured correctly on alpine and grants the privileges

❌ Actual Behavior

sudo is configured only for Cloud-Init users (ansible)

📄 Logs / Screenshots

[ERROR]: Task failed: Module failed: The command exited with a non-zero return code.
Origin: vmn-ansible/roles/human_admin_user/tasks/main.yaml:27:3

25
26 # WARNING: UNPRIVILEGED USER (not ansible) COMMANDS
27 - name: Install oh my zsh
^ column 3

fatal: [192.168.0.89]: FAILED! => {"changed": true, "changed_when_result": true, "cmd": ["/home/max/install_omz.sh"], "delta": "0:00:00.028867", "end": "2026-09-16 15:27:59.187104", "msg": "The command exited with a non-zero return code.", "rc": 1, "start": "2026-09-16 15:27:59.158237", "stderr": "root is not in the sudoers file.\nThis incident has been reported to the administrator.\nchmod: /home/max/install.sh: No such file or directory\nroot is not in the sudoers file.\nThis incident has been reported to the administrator.", "stderr_lines": ["root is not in the sudoers file.", "This incident has been reported to the administrator.", "chmod: /home/max/install.sh: No such file or directory", "root is not in the sudoers file.", "This incident has been reported to the administrator."], "stdout": "/home/root/.oh-my-zsh/oh-my-zsh.sh does not exist and we install ohmyzsh", "stdout_lines": ["/home/root/.oh-my-zsh/oh-my-zsh.sh does not exist and we install ohmyzsh"]}

📎 Additional Context

No response

✅ Submission Checklist

  • I have searched for existing issues (open and closed) that report the same problem
  • I have provided clear steps to reproduce the issue
  • I have included relevant logs or error messages (with sensitive info removed)
### 📋 Description Some scripts that requires sudo don't work on Alpine, because on this system sudo requires additional configuration. For example, root is not added to sudoers by default, while on the most of other systems it is. ### 🔁 Steps to Reproduce 1. Run any playbook/task/role that contain script with privileges elevation with sudo ### ✅ Expected Behavior sudo is configured correctly on alpine and grants the privileges ### ❌ Actual Behavior sudo is configured only for Cloud-Init users (ansible) ### 📄 Logs / Screenshots [ERROR]: Task failed: Module failed: The command exited with a non-zero return code. Origin: vmn-ansible/roles/human_admin_user/tasks/main.yaml:27:3 25 26 # WARNING: UNPRIVILEGED USER (not ansible) COMMANDS 27 - name: Install oh my zsh ^ column 3 fatal: [192.168.0.89]: FAILED! => {"changed": true, "changed_when_result": true, "cmd": ["/home/max/install_omz.sh"], "delta": "0:00:00.028867", "end": "2026-09-16 15:27:59.187104", "msg": "The command exited with a non-zero return code.", "rc": 1, "start": "2026-09-16 15:27:59.158237", "stderr": "root is not in the sudoers file.\nThis incident has been reported to the administrator.\nchmod: /home/max/install.sh: No such file or directory\nroot is not in the sudoers file.\nThis incident has been reported to the administrator.", "stderr_lines": ["root is not in the sudoers file.", "This incident has been reported to the administrator.", "chmod: /home/max/install.sh: No such file or directory", "root is not in the sudoers file.", "This incident has been reported to the administrator."], "stdout": "/home/root/.oh-my-zsh/oh-my-zsh.sh does not exist and we install ohmyzsh", "stdout_lines": ["/home/root/.oh-my-zsh/oh-my-zsh.sh does not exist and we install ohmyzsh"]} ### 📎 Additional Context _No response_ ### ✅ Submission Checklist - [x] I have searched for existing issues (open and closed) that report the same problem - [x] I have provided clear steps to reproduce the issue - [x] I have included relevant logs or error messages (with sensitive info removed)
max added the bug label 2026-09-16 15:46:02 +04:00
max added a new dependency 2026-09-16 16:49:42 +04:00
max closed this issue 2026-09-16 17:30:47 +04:00
Sign in to join this conversation.