ansible: guard krbtgt smoke probe against --check mode failure

In --check mode the user-create step is skipped (it's mutating), so
the subsequent `samba-tool user show krbtgt/KNOE.LOCAL` probe fails
with rc=1 on a first dry-run because the user doesn't yet exist. Add
the same guarded failed_when used on the trust validate/show tasks
earlier: only fail when NOT (check_mode AND trust didn't pre-exist).

Real runs still fail hard on rc!=0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chrisfu 2026-05-10 21:57:51 -07:00
parent 555da4acfc
commit 6740e3dcc5

View File

@ -315,7 +315,12 @@
register: _krbtgt_show
changed_when: false
check_mode: false
failed_when: _krbtgt_show.rc != 0
# In --check mode the create step is skipped, so on a first dry
# run the user doesn't exist yet — don't fail the play in that
# case. Real runs still fail hard on rc!=0.
failed_when:
- _krbtgt_show.rc != 0
- not (ansible_check_mode and not _trust_exists)
- name: Print summary
ansible.builtin.debug: