self-hosting/roles/forgejo/tasks/main.yml

61 lines
1.7 KiB
YAML
Raw Normal View History

2023-01-16 11:21:14 +01:00
---
- name: Get local public IP
ansible.builtin.uri:
url: https://ipinfo.io/ip
return_content: true
register: local_public_ip
- name: Get public IP of "{{ forgejo_domain }}"
ansible.builtin.set_fact:
target_public_ip: "{{ lookup('community.general.dig', forgejo_domain, '@1.1.1.1') }}"
- name: Deploy letsencrypt certificate (HTTP-01)
when: local_public_ip == target_public_ip
ansible.builtin.include_role:
name: add_cert_http_01
vars:
letsencrypt_domain: "{{ forgejo_domain }}"
letsencrypt_email: "{{ forgejo_server_admin }}"
letsencrypt_post_hook: systemctl restart apache2
- name: Deploy letsencrypt certificate (DNS-01)
when: local_public_ip != target_public_ip
2023-01-20 23:22:16 +01:00
ansible.builtin.include_role:
name: add_cert_dns_01
2023-01-20 23:22:16 +01:00
vars:
letsencrypt_domain: "{{ forgejo_domain }}"
letsencrypt_email: "{{ forgejo_server_admin }}"
letsencrypt_post_hook: systemctl restart apache2
2023-01-20 23:22:16 +01:00
2023-01-16 11:21:14 +01:00
- name: Include apache2 tasks
ansible.builtin.include_tasks: apache2.yml
- name: Include mariadb tasks
ansible.builtin.include_tasks: mariadb.yml
- name: Include unix tasks
ansible.builtin.include_tasks: unix.yml
2023-01-17 16:16:42 +01:00
- name: Include binary tasks
ansible.builtin.include_tasks: binary.yml
2023-01-17 16:52:21 +01:00
- name: Include backup tasks
ansible.builtin.include_tasks: backup.yml
2023-01-18 10:01:47 +01:00
- name: Include start tasks
ansible.builtin.include_tasks: start.yml
2023-01-18 10:07:47 +01:00
# fail2ban tasks need the forgejo log file, which should be created when forgejo runs
- name: Include fail2ban tasks
ansible.builtin.include_tasks: fail2ban.yml
2023-01-18 10:29:33 +01:00
2023-01-18 11:20:11 +01:00
- name: Include logrotate tasks
ansible.builtin.include_tasks: logrotate.yml
2023-01-18 10:29:33 +01:00
- name: Include repos tasks
ansible.builtin.include_tasks: repos.yml
2023-01-18 16:15:24 +01:00
- name: Include ssh tasks
ansible.builtin.include_tasks: ssh.yml