ansible/roles/gitea/tasks/main.yaml
2019-11-24 18:50:21 -06:00

90 lines
2.0 KiB
YAML

---
#- name: OS specific variables
# include_vars: "{{ item }}"
# with_first_found:
# - "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
# - "{{ ansible_distribution }}.yml"
# - "{{ ansible_os_family }}.yml"
# - "default.yml"
#
- name: "download gitea {{ gitea_version }}"
get_url:
url: "{{ gitea_url }}"
checksum: "{{ gitea_checksum }}"
dest: "{{ gitea_path }}"
owner: root
group: root
mode: 0755
- name: create group
user:
name: "{{ gitea_group }}"
system: yes
- name: create user and group
user:
name: "{{ gitea_user }}"
group: "{{ gitea_group }}"
shell: "{{ gitea_shell }}"
comment: "{{ gitea_gecos }}"
system: yes
password: "{{ gitea_password }}"
home: "{{ gitea_home_path }}"
- name: "create {{ gitea_etc_path }}"
file:
path: "{{ gitea_etc_path }}"
owner: root
group: "{{ gitea_group }}"
mode: 750
state: directory
- name: configure
template:
src: app.ini.j2
dest: "{{ gitea_config_path }}"
owner: root
group: "{{ gitea_group }}"
mode: 0640
notify:
- restart gitea
- name: "create {{ gitea_var_path }} tree"
file:
path: "{{ item }}"
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: 750
state: directory
with_items: "{{ gitea_var_tree }}"
- name: "create {{ gitea_log_path }} path"
file:
path: "{{ gitea_log_path }}"
owner: "{{ gitea_user }}"
group: "{{ gitea_group }}"
mode: 755
state: directory
- name: configure systemd unit
template:
src: gitea.service.j2
dest: "{{ gitea_systemd_unit_path }}"
owner: root
group: root
mode: 0644
notify:
- gitea daemon-reload
- restart gitea
when: ansible_service_mgr == 'systemd'
- name: manage service
service:
name: "{{ gitea_service_name }}"
state: "{{ gitea_service_state }}"
enabled: "{{ gitea_service_enabled }}"
- name: configure nginx
include: nginx.yaml
when: "'nginx' in ansible_play_role_names"