1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/gitlab_user/tasks/main.yml
patchback[bot] e342dfb467
Add headers to ci tests (#954) (#960)
* CI tests: add note to main.yml

* improve

(cherry picked from commit 9d5044ac1a)

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2020-09-25 09:04:59 +02:00

55 lines
1.5 KiB
YAML

####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- name: Install required libs
pip:
name: python-gitlab
state: present
- name: Clean up gitlab user
gitlab_user:
server_url: "{{ gitlab_host }}"
name: ansible_test_user
username: ansible_test_user
password: Secr3tPassw00rd
email: root@localhost
validate_certs: false
login_token: "{{ gitlab_login_token }}"
state: absent
- name: Create gitlab user
gitlab_user:
server_url: "{{ gitlab_host }}"
email: "{{ gitlab_user_email }}"
name: "{{ gitlab_user }}"
username: "{{ gitlab_user }}"
password: "{{ gitlab_user_pass }}"
validate_certs: False
login_token: "{{ gitlab_login_token }}"
state: present
register: gitlab_user_state
- name: Check user has been created correctly
assert:
that:
- gitlab_user_state is changed
- name: Create gitlab user again
gitlab_user:
server_url: "{{ gitlab_host }}"
email: root@localhost
name: ansible_test_user
username: ansible_test_user
password: Secr3tPassw00rd
validate_certs: False
login_token: "{{ gitlab_login_token }}"
state: present
register: gitlab_user_state_again
- name: Check state is not changed
assert:
that:
- gitlab_user_state_again is not changed