change gitea to forgejo

This commit is contained in:
Louis Abel 2024-12-21 14:01:14 -07:00
parent 6d0ea79487
commit 8a0404e231
Signed by: label
GPG key ID: 2A6975660E424560
7 changed files with 101 additions and 101 deletions

View file

@ -1,10 +1,10 @@
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Creates an organization/group in Gitea, relying on the gitea collection
# What: Creates an organization/group in Gitea, relying on the forgejo collection
# What is expected (at a minimum):
# -> gitea_api_user + gitea_api_password *OR* gitea_api_token
# -> gitea_org_name
# -> gitea_org_owner, optional (defaults to token or api user if not set)
# -> forgejo_api_user + forgejo_api_password *OR* forgejo_api_token
# -> forgejo_org_name
# -> forgejo_org_owner, optional (defaults to token or api user if not set)
- name: Create Gitea Organization or Group
hosts: all
become: false
@ -16,15 +16,15 @@
# Remove automated account
tasks:
- name: "Create organization"
lazyutilitynet.ansible_gitea.gitea_org:
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_org_state|default('present') }}"
org_name: "{{ gitea_org_name }}"
location: "{{ gitea_org_location|default(omit) }}"
full_name: "{{ gitea_org_full_name|default(omit) }}"
owner: "{{ gitea_org_owner|default(omit) }}"
description: "{{ gitea_org_desc|default(omit) }}"
lazyutilitynet.ansible_forgejo.forgejo_org:
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_org_state|default('present') }}"
org_name: "{{ forgejo_org_name }}"
location: "{{ forgejo_org_location|default(omit) }}"
full_name: "{{ forgejo_org_full_name|default(omit) }}"
owner: "{{ forgejo_org_owner|default(omit) }}"
description: "{{ forgejo_org_desc|default(omit) }}"
...

View file

@ -2,26 +2,26 @@
# 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
# -> forgejo_api_user + forgejo_api_password *OR* forgejo_api_token
# -> forgejo_repo_name
# -> forgejo_repo_owner
# -> forgejo_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
# -> 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
- name: Create Gitea Repo for a User or Org
hosts: all
become: false
@ -31,27 +31,27 @@
# 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) }}"
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) }}"
...

View file

@ -1,14 +1,14 @@
---
# 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 forgejo collection
# What is expected (at a minimum):
# -> gitea_api_user + gitea_api_password *OR* gitea_api_token
# -> gitea_org_name
# -> gitea_team_name
# -> gitea_team_state, present or absent (defaults to present)
# -> gitea_permission, none/read/write/admin (default read)
# -> gitea_permissions, this is a dictionary, cannot be paired with
# gitea_permission
# -> forgejo_api_user + forgejo_api_password *OR* forgejo_api_token
# -> forgejo_org_name
# -> forgejo_team_name
# -> forgejo_team_state, present or absent (defaults to present)
# -> forgejo_permission, none/read/write/admin (default read)
# -> forgejo_permissions, this is a dictionary, cannot be paired with
# forgejo_permission
- name: Create Gitea Team in an Organization or Group
hosts: all
become: false
@ -18,17 +18,17 @@
# Create team
tasks:
- name: "Create team and Add Users"
lazyutilitynet.ansible_gitea.gitea_team:
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_team_state|default('present') }}"
org_name: "{{ gitea_org_name }}"
name: "{{ gitea_team_name }}"
description: "{{ gitea_team_desc|default(omit) }}"
members: "{{ gitea_team_members|default(omit) }}"
permission: "{{ gitea_permission|default(omit) }}"
permissions: "{{ gitea_permissions|default(omit) }}"
lazyutilitynet.ansible_forgejo.forgejo_team:
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_team_state|default('present') }}"
org_name: "{{ forgejo_org_name }}"
name: "{{ forgejo_team_name }}"
description: "{{ forgejo_team_desc|default(omit) }}"
members: "{{ forgejo_team_members|default(omit) }}"
permission: "{{ forgejo_permission|default(omit) }}"
permissions: "{{ forgejo_permissions|default(omit) }}"
member_action: "add"
...

View file

@ -1,12 +1,12 @@
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Modifies a team in a Gitea Organization, relying on the gitea collection
# What: Modifies a team in a Gitea Organization, relying on the forgejo collection
# What is expected:
# -> gitea_api_user + gitea_api_password *OR* gitea_api_token
# -> gitea_org_name
# -> gitea_team_name
# -> gitea_team_members (in the form of a list)
# -> gitea_team_action, add or remove
# -> forgejo_api_user + forgejo_api_password *OR* forgejo_api_token
# -> forgejo_org_name
# -> forgejo_team_name
# -> forgejo_team_members (in the form of a list)
# -> forgejo_team_action, add or remove
- name: Create Gitea Team in an Organization or Group
hosts: all
become: false
@ -16,13 +16,13 @@
# Create team
tasks:
- name: "Create team and Add Users"
lazyutilitynet.ansible_gitea.gitea_team:
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) }}"
org_name: "{{ gitea_org_name }}"
name: "{{ gitea_team_name }}"
members: "{{ gitea_team_members }}"
member_action: "{{ gitea_team_action }}"
lazyutilitynet.ansible_forgejo.forgejo_team:
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) }}"
org_name: "{{ forgejo_org_name }}"
name: "{{ forgejo_team_name }}"
members: "{{ forgejo_team_members }}"
member_action: "{{ forgejo_team_action }}"
...

View file

@ -2,7 +2,7 @@
collections:
- name: community.general
- name: ansible.posix
- name: https://git.shootthej.net/lun/ansible-gitea.git
- name: https://git.shootthej.net/lun/ansible-forgejo.git
type: git
version: main
...

View file

@ -3,7 +3,7 @@
hosts: all
become: true
vars:
gitea_upgrade: "true"
forgejo_upgrade: "true"
pre_tasks:
- name: Check if ansible cannot be run here
@ -19,7 +19,7 @@
fail_msg: "/etc/no-ansible exists - skipping run on this node"
roles:
- role: lazyutilitynet.ansible_gitea.gitea_install
- role: lazyutilitynet.ansible_forgejo.forgejo_install
state: present
post_tasks:

View file

@ -1,5 +1,5 @@
---
# This does not use the gitea collection to install. Instead, we are installing
# This does not use the forgejo collection to install. Instead, we are installing
# from our own packages built for EL/Fedora in Copr.
- name: Setup Gitea
hosts: all
@ -21,22 +21,22 @@
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
# name: Enable the proper copr for gitea
# command: "dnf copr enable nalika/gitea -y"
# name: Enable the proper copr for forgejo
# command: "dnf copr enable nalika/forgejo -y"
# check_mode: false
# changed_when: "1 != 1"
roles:
- role: lazyutilitynet.ansible_gitea.gitea_install
- role: lazyutilitynet.ansible_forgejo.forgejo_install
state: present
- role: rockylinux.ipagetcert
state: present
when: gitea_web_config_certs_internal|bool
when: forgejo_web_config_certs_internal|bool
tasks:
- name: Install and Configure Gitea
import_tasks: "tasks/gitea.yml"
import_tasks: "tasks/forgejo.yml"
post_tasks:
- name: Open firewalld ports