adding first playbooks
This commit is contained in:
parent
04c3e14b0a
commit
6984ca6b2a
3
.ansible-lint
Normal file
3
.ansible-lint
Normal file
@ -0,0 +1,3 @@
|
||||
# .ansible-lint
|
||||
warn_list:
|
||||
- '106'
|
40
adhoc-creategroup.yml
Normal file
40
adhoc-creategroup.yml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||||
# What: Creates a group in gitlab. Use this to create a group that may not
|
||||
# exist and wish to have projects in.
|
||||
# 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: Create 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: "Creating GitLab Group"
|
||||
community.general.gitlab_group:
|
||||
api_token: "{{ gitlab_api_token }}"
|
||||
api_url: "{{ gitlab_endpoint }}"
|
||||
name: "{{ gitlab_group_name }}"
|
||||
description: "{{ gitlab_description|default(omit) }}"
|
||||
parent: "{{ gitlab_parent_group|default(omit) }}"
|
||||
state: present
|
||||
validate_certs: true
|
||||
visibility: "{{ gitlab_visibility|default('private') }}"
|
||||
delegate_to: localhost
|
||||
register: gitlab_group_return
|
43
adhoc-createproject.yml
Normal file
43
adhoc-createproject.yml
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||||
# What: Creates a project in gitlab. Use this to create a project that may not
|
||||
# exist. YOU MUST HAVE A GROUP THAT IT CAN BE PLACED IN.
|
||||
# What is expected:
|
||||
# -> gitlab_api_token: You must provide an API token to perform this.
|
||||
# -> gitlab_project_name: Name of the project
|
||||
# -> gitlab_group_name: Id or Path to the group in which the project is
|
||||
# is placed. This is not optional.
|
||||
# -> gitlab_description: Description of your project
|
||||
# -> gitlab_import_url: If you are importing from github or another git repo,
|
||||
# put the URL here.
|
||||
# -> gitlab_visibility: public, internal, private. Default is private.
|
||||
|
||||
- name: Create a gitlab project
|
||||
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_project_name | mandatory
|
||||
- gitlab_group_name | mandatory
|
||||
success_msg: "Required variables provided"
|
||||
fail_msg: "We are missing our required variables"
|
||||
|
||||
- name: "Creating GitLab Project"
|
||||
community.general.gitlab_project:
|
||||
api_url: "{{ gitlab_endpoint }}"
|
||||
api_token: "{{ gitlab_api_token }}"
|
||||
name: "{{ gitlab_project_name }}"
|
||||
description: "{{ gitlab_description|default(omit) }}"
|
||||
group: "{{ gitlab_group_name }}"
|
||||
import_url: "{{ gitlab_import_url|default(omit) }}"
|
||||
state: present
|
||||
validate_certs: true
|
||||
visibility: "{{ gitlab_visibility|default('private') }}"
|
||||
delegate_to: localhost
|
37
adhoc-deletegroup.yml
Normal file
37
adhoc-deletegroup.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
# 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
|
37
adhoc-deleteproject.yml
Normal file
37
adhoc-deleteproject.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||||
# What: Deletes a project in gitlab. THERE MUST BE A GOOD REASON FOR YOU TO
|
||||
# RUN THIS. THIS IS NOT REVERSIBLE.
|
||||
# What is expected:
|
||||
# -> gitlab_api_token: You must provide an API token to perform this.
|
||||
# -> gitlab_project_name: Name of the project
|
||||
# -> gitlab_group_name: Id or Path to the group in which the project is
|
||||
# is placed. This is not optional.
|
||||
# -> gitlab_description: Description of your project
|
||||
# -> gitlab_visibility: public, internal, private. Default is private.
|
||||
|
||||
- name: Delete a gitlab project
|
||||
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_project_name | mandatory
|
||||
- gitlab_group_name | mandatory
|
||||
success_msg: "Required variables provided"
|
||||
fail_msg: "We are missing our required variables"
|
||||
|
||||
- name: "Deleting GitLab Project"
|
||||
community.general.gitlab_project:
|
||||
api_url: "{{ gitlab_endpoint }}"
|
||||
api_token: "{{ gitlab_api_token }}"
|
||||
name: "{{ gitlab_project_name }}"
|
||||
state: absent
|
||||
validate_certs: true
|
||||
delegate_to: localhost
|
4
collections/requirements.yml
Normal file
4
collections/requirements.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
# need collections
|
||||
collections:
|
||||
- community.general
|
@ -1,4 +1,6 @@
|
||||
---
|
||||
# No tasks
|
||||
- debug: msg="No tasks are provided here. Please import the task as needed in your playbook."
|
||||
- name: "no tasks"
|
||||
debug:
|
||||
msg: "Please import the task as needed in your playbook."
|
||||
...
|
||||
|
0
tests/example.yml
Normal file
0
tests/example.yml
Normal file
Loading…
Reference in New Issue
Block a user