mirror of
https://github.com/rocky-linux/infrastructure
synced 2024-12-23 03:18:29 +00:00
38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
|
---
|
||
|
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||
|
# What: Deletes a group in gitlab. THERE MUST BE A REASON FOR YOU TO PERFORM
|
||
|
# THIS OPERATION.
|
||
|
# What is expected:
|
||
|
# -> gitlab_api_token: You must provide an API token to perform this.
|
||
|
# -> gitlab_group_name: Name of the group you wish to create.
|
||
|
# -> gitlab_parent_group: Id or full path of parent group if required.
|
||
|
# For example: "infrastructure/Public"
|
||
|
# -> gitlab_description: Description of your group
|
||
|
# -> gitlab_visibility: public, internal, private. Default is private.
|
||
|
|
||
|
- name: Delete a gitlab group
|
||
|
hosts: localhost
|
||
|
become: false
|
||
|
gather_facts: false
|
||
|
vars:
|
||
|
gitlab_endpoint: "https://git.rockylinux.org/"
|
||
|
|
||
|
tasks:
|
||
|
- name: "Checking for user variables"
|
||
|
assert:
|
||
|
that:
|
||
|
- gitlab_api_token | mandatory
|
||
|
- gitlab_group_name | mandatory
|
||
|
success_msg: "Required variables provided"
|
||
|
fail_msg: "We are missing our required variables"
|
||
|
|
||
|
- name: "Deleting GitLab Group"
|
||
|
community.general.gitlab_group:
|
||
|
api_token: "{{ gitlab_api_token }}"
|
||
|
api_url: "{{ gitlab_endpoint }}"
|
||
|
name: "{{ gitlab_group_name }}"
|
||
|
parent: "{{ gitlab_parent_group|default(omit) }}"
|
||
|
state: absent
|
||
|
validate_certs: true
|
||
|
delegate_to: localhost
|