test(images): check become in the image-smoke scenarios
Both smoke scenarios now run a become task, as every role scenario does, so a molecule image where become fails no longer passes its own pin pull request. The 26.04 scenario also carries temporary diagnostics for #376. Assisted-by: Claude Code
This commit is contained in:
1 parent
392fbd910b
commit
62ffae7764
2 files changed
+55
No files matched your search
@@ -56,3 +56,47 @@
|
||||
- name: NET_ADMIN is granted, so the firewall tools can work
|
||||
ansible.builtin.command: iptables -S
|
||||
changed_when: false
|
||||
|
||||
# TEMPORARY diagnostics for #376; removed before review.
|
||||
- name: "DIAG #376: enable sudo debug logging"
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sudo.conf
|
||||
content: "Debug sudo /var/log/sudo_debug.log all@debug\n"
|
||||
mode: "0644"
|
||||
|
||||
- name: "DIAG #376: collect account and sudo state without become"
|
||||
ansible.builtin.shell: |
|
||||
set +e
|
||||
echo "== id: $(id)"; echo "== loginuid: $(cat /proc/self/loginuid)"
|
||||
echo "== getent passwd root: $(getent passwd root)"
|
||||
echo "== getent shadow root (fields): $(getent shadow root | awk -F: '{print $1":"(($2 ~ /^[!*]/)?$2:"<hash>")":"$3":"$4":"$5":"$6":"$7":"$8}')"
|
||||
echo "== files shadow root (fields): $(awk -F: '$1=="root"{print $1":"(($2 ~ /^[!*]/)?$2:"<hash>")":"$3":"$4":"$5":"$6":"$7":"$8}' /etc/shadow)"
|
||||
echo "== ls shadow:"; ls -l --time-style=full-iso /etc/shadow /etc/passwd
|
||||
echo "== nsswitch:"; grep -E '^(passwd|group|shadow)' /etc/nsswitch.conf
|
||||
echo "== date: $(date -u) days: $(( $(date +%s) / 86400 ))"
|
||||
echo "== systemd: $(systemctl --version | head -1); state: $(systemctl is-system-running)"
|
||||
echo "== sudo -n -u root true:"; sudo -n -u root true; echo "rc=$?"
|
||||
echo "== sudo -H -S -n -u root sh -c echo:"; sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS' </dev/null; echo "rc=$?"
|
||||
echo "== sudo debug (pam/acct/auth):"; grep -iE 'pam|acct|account|auth|uid' /var/log/sudo_debug.log | grep -v -i 'password=' | tail -60
|
||||
echo "== journal sudo/pam:"; journalctl --no-pager -o short-iso -n 40 _COMM=sudo _COMM=sudo.ws 2>&1 | tail -40
|
||||
echo "== journal (auth, last 40):"; journalctl --no-pager -o short-iso -n 40 SYSLOG_FACILITY=10 2>&1 | tail -40
|
||||
args:
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: kamino_diag_376
|
||||
|
||||
- name: "DIAG #376: show the result"
|
||||
ansible.builtin.debug:
|
||||
var: kamino_diag_376.stdout_lines
|
||||
|
||||
- name: Run a task with become, as the role scenarios do
|
||||
ansible.builtin.command: id -u
|
||||
become: true
|
||||
changed_when: false
|
||||
register: kamino_smoke_become
|
||||
|
||||
- name: Become reaches root
|
||||
ansible.builtin.assert:
|
||||
that: kamino_smoke_become.stdout == '0'
|
||||
quiet: true
|
||||
@@ -57,3 +57,14 @@
|
||||
- name: NET_ADMIN is granted, so the firewall tools can work
|
||||
ansible.builtin.command: iptables -S
|
||||
changed_when: false
|
||||
|
||||
- name: Run a task with become, as the role scenarios do
|
||||
ansible.builtin.command: id -u
|
||||
become: true
|
||||
changed_when: false
|
||||
register: kamino_smoke_become
|
||||
|
||||
- name: Become reaches root
|
||||
ansible.builtin.assert:
|
||||
that: kamino_smoke_become.stdout == '0'
|
||||
quiet: true
|
||||
Reference in new issue
Block a user