Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/delete_user-10639/converge.yml

raw symbols SCIP
1 ---
2 - name: Validate deleting a user
3 hosts: all
4 gather_facts: false
5 vars:
6 idrac_user_name: "moleculeTest"
7 tasks:
8 - name: Delete iDRAC user
9 ansible.builtin.import_role:
10 name: dellemc.openmanage.idrac_user
11 vars:
12 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
13 username: "{{ lookup('env', 'IDRAC_USER') }}"
14 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
15 validate_certs: false
16 state: absent
17 user_name: "{{ idrac_user_name }}"
18
19 - name: Asserting user deletion in check mode
20 ansible.builtin.assert:
21 that: idrac_user_out.msg == "Changes found to commit!"
22 when: ansible_check_mode
23 tags: molecule-idempotence-notest
24
25 - name: Fetching user info in normal mode
26 ansible.builtin.include_tasks:
27 file: ../resources/idrac_user/get_user_info.yml
28 vars:
29 idrac_user_name: "{{ default(omit) }}"
30 when: not ansible_check_mode and idrac_user_out.changed
31 tags: molecule-idempotence-notest
32
33 - name: Extracting username
34 ansible.builtin.set_fact:
35 user_list: "{{ user_details.user_info | map(attribute='UserName') }}"
36 when: not ansible_check_mode and idrac_user_out.changed
37 tags: molecule-idempotence-notest
38
39 - name: Asserting user deletion in normal mode
40 ansible.builtin.assert:
41 that:
42 - idrac_user_out.msg == "Successfully deleted user account."
43 - "{{ idrac_user_name not in user_list }}"
44 when: not ansible_check_mode and idrac_user_out.changed
45 tags: molecule-idempotence-notest
46
47 - name: Asserting user deletion in idempotency mode
48 ansible.builtin.assert:
49 that:
50 - idrac_user_out.msg == "The user account is absent."
51 when: not ansible_check_mode and not idrac_user_out.changed