add repo creation

This commit is contained in:
nazunalika 2022-04-07 14:17:14 -07:00
parent 7884b6e95d
commit d3064c5fc9
Signed by: label
GPG Key ID: 6735C0E1BD65D048
2 changed files with 61 additions and 4 deletions

57
adhoc-create-repo.yml Normal file
View File

@ -0,0 +1,57 @@
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Creates a repo for a Gitea Organization or User
# What is expected (at a minimum):
# -> gitea_api_user + gitea_api_password *OR* gitea_api_token
# -> gitea_repo_name
# -> gitea_repo_owner
# -> gitea_repo_state
# Optional items:
# -> gitea_repo_desc
# -> gitea_repo_private
# -> gitea_auto_init
# -> gitea_default_branch
# -> gitea_repo_license
# -> gitea_allow_merge_commits
# -> gitea_allow_rebase
# -> gitea_allow_rebase_explicit
# -> gitea_allow_squash_merge
# -> gitea_repo_archived
# -> gitea_ignore_whitespace_conflicts
# -> gitea_has_issues
# -> gitea_has_wiki
# -> gitea_has_pull_requests
# -> gitea_repo_website
- name: Create Gitea Repo for a User or Org
hosts: all
become: false
vars_files:
- "vars/common.yml"
# Create repo
tasks:
- name: "Create Repository"
lazyutilitynet.ansible_gitea.gitea_repo:
api_url: "https://{{ gitea_basename }}"
api_username: "{{ gitea_api_user|default(omit) }}"
api_password: "{{ gitea_api_password|default(omit) }}"
api_token: "{{ gitea_api_token|default(omit) }}"
state: "{{ gitea_repo_state|default('present') }}"
owner: "{{ gitea_repo_owner }}"
name: "{{ gitea_repo_name }}"
description: "{{ gitea_repo_desc|default(omit) }}"
private: "{{ gitea_repo_private|default(omit) }}"
auto_init: "{{ gitea_auto_init|default(omit) }}"
default_branch: "{{ gitea_default_branch|default('main') }}"
license: "{{ gitea_repo_license|default(omit) }}"
allow_merge_commits: "{{ gitea_allow_merge_commits|default(omit) }}"
allow_rebase: "{{ gitea_allow_rebase|default(omit) }}"
allow_rebase_explicit: "{{ gitea_allow_rebase_explicit|default(omit) }}"
allow_squash_merge: "{{ gitea_allow_squash_merge|default(omit) }}"
archived: "{{ gitea_repo_archived|default(omit) }}"
ignore_whitespace_conflicts: "{{ gitea_ignore_whitespace_conflicts|default(omit) }}"
has_issues: "{{ gitea_has_issues|default(omit) }}"
has_wiki: "{{ gitea_has_wiki|default(omit) }}"
has_pull_requests: "{{ gitea_has_pull_requests|default(omit) }}"
website: "{{ gitea_repo_website|default(omit) }}"
...

View File

@ -1,11 +1,11 @@
--- ---
# This playbook is meant to be used with callable variables, like adhoc or AWX. # This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Creates an team in a Gitea Organization, relying on the gitea collection # What: Creates an team in a Gitea Organization, relying on the gitea collection
# What is expected: # What is expected (at a minimum):
# -> gitea_api_user + gitea_api_password *OR* gitea_api_token # -> gitea_api_user + gitea_api_password *OR* gitea_api_token
# -> gitea_org_name # -> gitea_org_name
# -> gitea_team_name # -> gitea_team_name
# -> gitea_state, present or absent (defaults to present) # -> gitea_team_state, present or absent (defaults to present)
# -> gitea_permission, none/read/write/admin (default read) # -> gitea_permission, none/read/write/admin (default read)
# -> gitea_permissions, this is a dictionary, cannot be paired with # -> gitea_permissions, this is a dictionary, cannot be paired with
# gitea_permission # gitea_permission
@ -23,10 +23,10 @@
api_username: "{{ gitea_api_user|default(omit) }}" api_username: "{{ gitea_api_user|default(omit) }}"
api_password: "{{ gitea_api_password|default(omit) }}" api_password: "{{ gitea_api_password|default(omit) }}"
api_token: "{{ gitea_api_token|default(omit) }}" api_token: "{{ gitea_api_token|default(omit) }}"
state: "{{ gitea_org_state|default('present') }}" state: "{{ gitea_team_state|default('present') }}"
org_name: "{{ gitea_org_name }}" org_name: "{{ gitea_org_name }}"
name: "{{ gitea_team_name }}" name: "{{ gitea_team_name }}"
description: "{{ gitea_org_desc|default(omit) }}" description: "{{ gitea_team_desc|default(omit) }}"
members: "{{ gitea_team_members|default(omit) }}" members: "{{ gitea_team_members|default(omit) }}"
permission: "{{ gitea_permission|default(omit) }}" permission: "{{ gitea_permission|default(omit) }}"
permissions: "{{ gitea_permissions|default(omit) }}" permissions: "{{ gitea_permissions|default(omit) }}"