initial role commit
This commit is contained in:
74
tasks/setup-compose.yaml
Normal file
74
tasks/setup-compose.yaml
Normal file
@@ -0,0 +1,74 @@
|
||||
---
|
||||
- name: Set up Docker and Docker compose
|
||||
ansible.builtin.include_role:
|
||||
name: geerlingguy.docker
|
||||
|
||||
- name: Create directory for Gitea Docker Compose stack
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_home_path }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Create directory for data
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_home_path }}/data"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "admin"
|
||||
group: "admin"
|
||||
notify: Deploy Docker Compose stack
|
||||
|
||||
- name: Create directory for config
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_home_path }}/config"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "admin"
|
||||
group: "admin"
|
||||
notify: Deploy Docker Compose stack
|
||||
|
||||
- name: Create directory for logs
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_home_path }}/log"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "admin"
|
||||
group: "admin"
|
||||
notify: Deploy Docker Compose stack
|
||||
when: gitea_log_mode == 'file'
|
||||
|
||||
- name: Get host IP
|
||||
set_fact:
|
||||
gitea_host_ip: "{{ ansible_default_ipv4.address }}"
|
||||
|
||||
- name: Create data directories for runners
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_home_path }}/{{ item.data_mount }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "admin"
|
||||
group: "admin"
|
||||
loop: "{{ gitea_runners }}"
|
||||
|
||||
- name: Create configuration files for each runner
|
||||
ansible.builtin.template:
|
||||
src: actions/config.yaml.j2
|
||||
dest: "{{ gitea_home_path }}/{{ item.config_file_mount }}"
|
||||
mode: "0755"
|
||||
owner: "admin"
|
||||
group: "admin"
|
||||
loop: "{{ gitea_runners }}"
|
||||
|
||||
- name: Create the Compose file based on template
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yaml.j2
|
||||
dest: "{{ gitea_home_path }}/docker-compose.yaml"
|
||||
mode: "0755"
|
||||
notify: Deploy Docker Compose stack
|
||||
|
||||
- name: Create the .env file based on template
|
||||
ansible.builtin.template:
|
||||
src: env.j2
|
||||
dest: "{{ gitea_home_path }}/.env"
|
||||
mode: "0644"
|
||||
notify: Deploy Docker Compose stack
|
||||
Reference in New Issue
Block a user