1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00

simplify directory handling and start using new ansible name scheme

This commit is contained in:
L3D 2021-03-22 21:08:40 +01:00
parent 251b526574
commit 6096767d26
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 37 additions and 39 deletions

18
tasks/directory.yml Normal file
View file

@ -0,0 +1,18 @@
---
- name: "Create config and data directory"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: 'u=rwX,g=rX,o='
with_items:
- "/etc/gitea"
- "{{ gitea_home }}"
- "{{ gitea_home }}/data"
- "{{ gitea_home }}/custom"
- "{{ gitea_home }}/custom/https"
- "{{ gitea_home }}/custom/mailer"
- "{{ gitea_home }}/indexers"
- "{{ gitea_home }}/log"
- "{{ gitea_repository_root }}"

View file

@ -4,16 +4,10 @@
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ item }}" ansible.builtin.include_vars: "{{ lookup('first_found', gitea_variables) }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- name: "Check gitea version" - name: "Check gitea version"
shell: "set -eo pipefail; /usr/local/bin/gitea -v | cut -d' ' -f 3" ansible.builtin.shell: "set -eo pipefail; /usr/local/bin/gitea -v | cut -d' ' -f 3"
args: args:
executable: /bin/bash executable: /bin/bash
register: gitea_active_version register: gitea_active_version
@ -22,41 +16,17 @@
when: gitea_version_check|bool when: gitea_version_check|bool
- name: backup gitea before update - name: backup gitea before update
include_tasks: backup.yml ansible.builtin.include_tasks: backup.yml
when: gitea_backup_on_upgrade|bool when: gitea_backup_on_upgrade|bool
- name: create gitea user and role
ansible.builtin.include_tasks: create_user.yml
- name: install or update gitea - name: install or update gitea
include_tasks: install.yml ansible.builtin.include_tasks: install.yml
- include: create_user.yml - name: Create directorys
ansible.builtin.include_tasks: directory.yml
- name: "Create config directory"
file:
path: "{{ item }}"
state: directory
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: '0755'
with_items:
- "/etc/gitea"
- name: "Create data directory"
file:
path: "{{ item }}"
state: directory
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: 'u=rwX,g=rX,o='
recurse: true
with_items:
- "{{ gitea_home }}"
- "{{ gitea_home }}/data"
- "{{ gitea_home }}/custom"
- "{{ gitea_home }}/custom/https"
- "{{ gitea_home }}/custom/mailer"
- "{{ gitea_home }}/indexers"
- "{{ gitea_home }}/log"
- "{{ gitea_repository_root }}"
- include: install_systemd.yml - include: install_systemd.yml
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"

View file

@ -9,5 +9,15 @@ gitea_go_arch_map:
gitea_arch: "{{ gitea_go_arch_map[ansible_architecture] | default(ansible_architecture) }}" gitea_arch: "{{ gitea_go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
gitea_variables:
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
paths:
- 'vars'
playbook_version_number: 6 # should be int playbook_version_number: 6 # should be int
playbook_version_path: 'do1jlr.gitea.version' playbook_version_path: 'do1jlr.gitea.version'