ansible-gitea-management/adhoc-create-repo.yml

58 lines
2.4 KiB
YAML
Raw Normal View History

2022-04-07 21:17:14 +00:00
---
# 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):
2024-12-21 21:01:14 +00:00
# -> forgejo_api_user + forgejo_api_password *OR* forgejo_api_token
# -> forgejo_repo_name
# -> forgejo_repo_owner
# -> forgejo_repo_state
2022-04-07 21:17:14 +00:00
# Optional items:
2024-12-21 21:01:14 +00:00
# -> forgejo_repo_desc
# -> forgejo_repo_private
# -> forgejo_auto_init
# -> forgejo_default_branch
# -> forgejo_repo_license
# -> forgejo_allow_merge_commits
# -> forgejo_allow_rebase
# -> forgejo_allow_rebase_explicit
# -> forgejo_allow_squash_merge
# -> forgejo_repo_archived
# -> forgejo_ignore_whitespace_conflicts
# -> forgejo_has_issues
# -> forgejo_has_wiki
# -> forgejo_has_pull_requests
# -> forgejo_repo_website
2022-04-07 21:17:14 +00:00
- name: Create Gitea Repo for a User or Org
hosts: all
become: false
vars_files:
- "vars/common.yml"
# Create repo
tasks:
- name: "Create Repository"
2024-12-21 21:01:14 +00:00
lazyutilitynet.ansible_forgejo.forgejo_repo:
api_url: "https://{{ forgejo_basename }}"
api_username: "{{ forgejo_api_user|default(omit) }}"
api_password: "{{ forgejo_api_password|default(omit) }}"
api_token: "{{ forgejo_api_token|default(omit) }}"
state: "{{ forgejo_repo_state|default('present') }}"
owner: "{{ forgejo_repo_owner }}"
name: "{{ forgejo_repo_name }}"
description: "{{ forgejo_repo_desc|default(omit) }}"
private: "{{ forgejo_repo_private|default(omit) }}"
auto_init: "{{ forgejo_auto_init|default(omit) }}"
default_branch: "{{ forgejo_default_branch|default('main') }}"
license: "{{ forgejo_repo_license|default(omit) }}"
allow_merge_commits: "{{ forgejo_allow_merge_commits|default(omit) }}"
allow_rebase: "{{ forgejo_allow_rebase|default(omit) }}"
allow_rebase_explicit: "{{ forgejo_allow_rebase_explicit|default(omit) }}"
allow_squash_merge: "{{ forgejo_allow_squash_merge|default(omit) }}"
archived: "{{ forgejo_repo_archived|default(omit) }}"
ignore_whitespace_conflicts: "{{ forgejo_ignore_whitespace_conflicts|default(omit) }}"
has_issues: "{{ forgejo_has_issues|default(omit) }}"
has_wiki: "{{ forgejo_has_wiki|default(omit) }}"
has_pull_requests: "{{ forgejo_has_pull_requests|default(omit) }}"
website: "{{ forgejo_repo_website|default(omit) }}"
2022-04-07 21:17:14 +00:00
...