mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
607 lines
18 KiB
YAML
607 lines
18 KiB
YAML
|
---
|
||
|
####################################################################
|
||
|
# WARNING: These are designed specifically for Ansible tests #
|
||
|
# and should not be used as examples of how to write Ansible roles #
|
||
|
####################################################################
|
||
|
|
||
|
# Copyright (c) Ansible Project
|
||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
||
|
- name: Install required libs
|
||
|
pip:
|
||
|
name: python-gitlab
|
||
|
state: present
|
||
|
|
||
|
- name: purge all variables for check_mode test
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
purge: true
|
||
|
|
||
|
- name: add a variable value in check_mode
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
check_mode: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: check_mode state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: apply add value from check_mode test
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: apply same value again again
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be not changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: change protected attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
protected: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: revert protected attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
protected: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: change masked attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
masked: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: revert masked attribute by not mention it
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
masked: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: revert again masked attribute by not mention it (idempotent)
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be not changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: set all attributes
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
masked: true
|
||
|
protected: true
|
||
|
variable_type: env_var
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: set again all attributes (idempotent)
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
masked: true
|
||
|
protected: true
|
||
|
variable_type: env_var
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: revert both (masked and protected) attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
protected: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: change a variable value in check_mode again
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
check_mode: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: check_mode state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: apply again the value change from check_mode test
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: checkmode
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: purge all variables again
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
purge: true
|
||
|
|
||
|
- name: set two test variables
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: abc123
|
||
|
- name: SECRET_ACCESS_KEY
|
||
|
value: 321cba
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: set two test variables state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 2
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
|
||
|
- name: re-set two test variables
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: abc123
|
||
|
- name: SECRET_ACCESS_KEY
|
||
|
value: 321cba
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: re-set two test variables state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 2
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
|
||
|
- name: edit one variable
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: changed
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: edit one variable state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.updated[0] == "ACCESS_KEY_ID"
|
||
|
|
||
|
- name: append one variable
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: some
|
||
|
value: value
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: append one variable state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 2
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.added[0] == "some"
|
||
|
|
||
|
- name: re-set all variables
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: ACCESS_KEY_ID
|
||
|
value: changed
|
||
|
- name: SECRET_ACCESS_KEY
|
||
|
value: 321cba
|
||
|
- name: some
|
||
|
value: value
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: re-set all variables state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- not gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 3
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
|
||
|
- name: set one variables and purge all others
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: some
|
||
|
value: value
|
||
|
purge: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: set one variables and purge all others state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 2
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
|
||
|
- name: only one variable is left
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: some
|
||
|
value: value
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: only one variable is left state must not be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- not gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched[0] == "some"
|
||
|
|
||
|
- name: test integer values
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: some
|
||
|
value: 42
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: only one variable is left state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 1
|
||
|
|
||
|
- name: test float values
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: some
|
||
|
value: 42.23
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: only one variable is left state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 1
|
||
|
|
||
|
- name: delete the last left variable
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
state: absent
|
||
|
variables:
|
||
|
- name: some
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: no variable is left state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed[0] == "some"
|
||
|
|
||
|
- name: add one variable with variable_type file
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: my_test_var
|
||
|
value: my_test_value
|
||
|
variable_type: file
|
||
|
purge: false
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: append one variable state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
# VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
|
||
|
#- gitlab_instance_variable_state.instance_variable.added[0] == "my_test_var"
|
||
|
|
||
|
- name: change variable_type attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: my_test_var
|
||
|
value: my_test_value
|
||
|
variable_type: env_var
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: revert variable_type attribute
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: my_test_var
|
||
|
value: my_test_value
|
||
|
variable_type: file
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
|
||
|
- name: delete the variable_type file variable
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
state: absent
|
||
|
variables:
|
||
|
- name: my_test_var
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: no variable is left state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 1
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed[0] == "my_test_var"
|
||
|
|
||
|
- name: set complete page and purge existing ones
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: page1_var01
|
||
|
value: value
|
||
|
- name: page1_var02
|
||
|
value: value
|
||
|
- name: page1_var03
|
||
|
value: value
|
||
|
- name: page1_var04
|
||
|
value: value
|
||
|
- name: page1_var05
|
||
|
value: value
|
||
|
- name: page1_var06
|
||
|
value: value
|
||
|
- name: page1_var07
|
||
|
value: value
|
||
|
- name: page1_var08
|
||
|
value: value
|
||
|
- name: page1_var09
|
||
|
value: value
|
||
|
- name: page1_var10
|
||
|
value: value
|
||
|
- name: page1_var11
|
||
|
value: value
|
||
|
- name: page1_var12
|
||
|
value: value
|
||
|
- name: page1_var13
|
||
|
value: value
|
||
|
- name: page1_var14
|
||
|
value: value
|
||
|
- name: page1_var15
|
||
|
value: value
|
||
|
- name: page1_var16
|
||
|
value: value
|
||
|
- name: page1_var17
|
||
|
value: value
|
||
|
- name: page1_var18
|
||
|
value: value
|
||
|
- name: page1_var19
|
||
|
value: value
|
||
|
- name: page1_var20
|
||
|
value: value
|
||
|
purge: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: complete page added state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state is changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 20
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
|
||
|
- name: check that no variables are left
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
purge: true
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: check that no variables are untouched state must be changed
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.added|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.untouched|length == 0
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 20
|
||
|
- gitlab_instance_variable_state.instance_variable.updated|length == 0
|
||
|
|
||
|
- name: throw error when state is present but no value is given
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
variables:
|
||
|
- name: no_value
|
||
|
register: gitlab_instance_variable_state
|
||
|
ignore_errors: true
|
||
|
|
||
|
- name: verify fail
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.failed
|
||
|
- gitlab_instance_variable_state is not changed
|
||
|
|
||
|
- name: set a new variable to delete it later
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
purge: true
|
||
|
variables:
|
||
|
- name: delete_me
|
||
|
value: ansible
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: verify the change
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
|
||
|
- name: delete variable without referencing its value
|
||
|
gitlab_instance_variable:
|
||
|
api_url: "{{ gitlab_host }}"
|
||
|
api_token: "{{ gitlab_login_token }}"
|
||
|
state: absent
|
||
|
variables:
|
||
|
- name: delete_me
|
||
|
register: gitlab_instance_variable_state
|
||
|
|
||
|
- name: verify deletion
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_instance_variable_state.changed
|
||
|
- gitlab_instance_variable_state.instance_variable.removed|length == 1
|