new role gitea_repo

This commit is contained in:
2024-08-16 13:53:03 +02:00
parent 1b832cbd1d
commit 459d255471
15 changed files with 336 additions and 16 deletions
@@ -0,0 +1,4 @@
gitea_user_name: arcodange
gitea_container_name: gitea
gitea_token_scopes: write:admin,write:organization,write:package,write:repository,write:user
# gitea_base_url: 'http://{{ groups.gitea[0] }}:3000'
@@ -0,0 +1,23 @@
# to see generated tokens
# go to https://gitea.arcodange.duckdns.org/user/settings/applications
- when: gitea_api_token is undefined
block:
- name: Create new token for ansible
delegate_to: "{{ groups.gitea[0] }}"
delegate_facts: true
ansible.builtin.command: >-
docker exec -u git {{ gitea_container_name }}
gitea admin user generate-access-token
--username {{ gitea_user_name }}
--token-name {{ gitea_token_name }}
--raw
--scopes {{gitea_token_scopes}}
register: gitea_api_token_cmd
vars:
# ansible_date_time requires having gathered facts
gitea_token_name: ansible-{{ ansible_date_time.iso8601 }}
- ansible.builtin.set_fact:
gitea_api_token: '{{ gitea_api_token_cmd.stdout }}'