1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00
awx/awx_collection/tests/integration/targets/tower_user/tasks/main.yml

121 lines
2.3 KiB
YAML

---
- name: Generate names
set_fact:
username: "AWX-Collection-tests-tower_user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Create a User
tower_user:
username: "{{ username }}"
first_name: Joe
password: "{{ 65535 | random | to_uuid }}"
state: present
register: result
- assert:
that:
- "result is changed"
- name: Change a User
tower_user:
username: "{{ username }}"
last_name: User
email: joe@example.org
state: present
register: result
- assert:
that:
- "result is changed"
- name: Check idempotency
tower_user:
username: "{{ username }}"
first_name: Joe
last_name: User
register: result
- assert:
that:
- "result is not changed"
- name: Delete a User
tower_user:
username: "{{ username }}"
email: joe@example.org
state: absent
register: result
- assert:
that:
- "result is changed"
- name: Create an Auditor
tower_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
tower_user:
username: "{{ username }}"
email: joe@example.org
state: absent
register: result
- assert:
that:
- "result is changed"
- name: Create a Superuser
tower_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
tower_user:
username: "{{ username }}"
email: joe@example.org
state: absent
register: result
- assert:
that:
- "result is changed"
- name: Test tower SSL parameter
tower_user:
first_name: Joe
last_name: User
username: "{{ username }}"
password: "{{ 65535 | random | to_uuid }}"
email: joe@example.org
state: present
validate_certs: true
tower_host: http://foo.invalid
ignore_errors: true
register: result
- assert:
that:
- "'Unable to resolve tower_host' in result.msg or
'Can not verify ssl with non-https protocol' in result.exception"