summaryrefslogtreecommitdiffstats
path: root/awx_collection/tests/integration/targets/user/tasks/main.yml
blob: 2e82275b27c57abf5cc8a748a6e756adf6ce4398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
- name: Generate names
  set_fact:
    username: "AWX-Collection-tests-user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"

- name: Create a User
  user:
    username: "{{ username }}"
    first_name: Joe
    password: "{{ 65535 | random | to_uuid }}"
    state: present
  register: result

- assert:
    that:
      - "result is changed"

- name: Change a User by ID
  user:
    username: "{{ result.id }}"
    last_name: User
    email: joe@example.org
    state: present
  register: result

- assert:
    that:
      - "result is changed"

- name: Check idempotency
  user:
    username: "{{ username }}"
    first_name: Joe
    last_name: User
  register: result

- assert:
    that:
      - "result is not changed"

- name: Rename a User
  user:
    username: "{{ username }}"
    new_username: "{{ username }}-renamed"
    email: joe@example.org
  register: result

- assert:
    that:
      - "result is changed"

- name: Delete a User
  user:
    username: "{{ username }}-renamed"
    email: joe@example.org
    state: absent
  register: result

- assert:
    that:
      - "result is changed"

- name: Create an Auditor
  user:
    first_name: Joe
    last_name: Auditor
    username: "{{ username }}"
    password: "{{ 65535 | random | to_uuid }}"
    email: joe@example.org
    state: present
    auditor: true
  register: result

- assert:
    that:
      - "result is changed"

- name: Delete an Auditor
  user:
    username: "{{ username }}"
    email: joe@example.org
    state: absent
  register: result

- assert:
    that:
      - "result is changed"

- name: Create a Superuser
  user:
    first_name: Joe
    last_name: Super
    username: "{{ username }}"
    password: "{{ 65535 | random | to_uuid }}"
    email: joe@example.org
    state: present
    superuser: true
  register: result

- assert:
    that:
      - "result is changed"

- name: Delete a Superuser
  user:
    username: "{{ username }}"
    email: joe@example.org
    state: absent
  register: result

- assert:
    that:
      - "result is changed"

- name: Test SSL parameter
  user:
    first_name: Joe
    last_name: User
    username: "{{ username }}"
    password: "{{ 65535 | random | to_uuid }}"
    email: joe@example.org
    state: present
    validate_certs: true
    controller_host: http://foo.invalid
  ignore_errors: true
  register: result

- assert:
    that:
      - "'Unable to resolve controller_host' in result.msg or
        'Can not verify ssl with non-https protocol' in result.exception"