homeserver/roles/pandemonium1986.ansible-role-k9s/molecule/default/verify.yml

46 lines
1.7 KiB
YAML
Raw Normal View History

---
- name: Verify
hosts: all
gather_facts: true
tasks:
- name: Run k9s as a privileged user
block:
- name: Am I privileged ?
command:
cmd: whoami
register: whoami_result_priv
ignore_errors: true
- name: Run k9s (privileged user)
command:
cmd: /usr/local/bin/k9s version -s
register: k9s_result_priv
ignore_errors: true
- name: Ensure k9s is installed and running (privileged user)
assert:
that:
- k9s_result_priv.rc == 0
fail_msg: "k9s does not seem to be available for the user {{ whoami_result_priv.stdout }}"
success_msg: "k9s is available for the user {{ whoami_result_priv.stdout }} : {{ k9s_result_priv.stdout }}"
become: true
become_user: root
- name: Run k9s as a non-privileged user
block:
- name: Am I without privilege ?
command:
cmd: whoami
register: whoami_result_nopriv
ignore_errors: true
- name: Run k9s (non-privileged user)
command:
cmd: /usr/local/bin/k9s version -s
register: k9s_result_nopriv
ignore_errors: true
- name: Ensure k9s is installed and running (non-privileged user)
assert:
that:
- k9s_result_nopriv.rc == 0
fail_msg: "k9s does not seem to be available for the user {{ whoami_result_nopriv.stdout }}"
success_msg: "k9s is available for the user {{ whoami_result_nopriv.stdout }} : {{ k9s_result_nopriv.stdout }}"
become: true
become_user: pandemonium