Add handler, prevent accidental upgrades

This commit is contained in:
nazunalika 2022-03-03 22:27:20 -07:00
parent 1a5e867a5f
commit a6fa4ac5ff
Signed by: label
GPG Key ID: 6735C0E1BD65D048
4 changed files with 61 additions and 0 deletions

View File

@ -1,2 +1,7 @@
---
# Handlers
- name: restart_gitea
service:
name: gitea
state: restarted
...

38
init-gitea-update.yml Normal file
View File

@ -0,0 +1,38 @@
---
- name: Update Gitea
hosts: all
become: true
pre_tasks:
- name: Check if ansible cannot be run here
stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
- name: Enable the proper copr for gitea
command: "dnf copr enable nalika/gitea -y"
check_mode: false
changed_when: "1 != 1"
tasks:
- name: Update Gitea
dnf:
name: gitea
state: latest
post_tasks:
- name: Touching run file that ansible has ran here
file:
path: /var/log/ansible.run
state: touch
mode: '0644'
owner: root
group: root
...

View File

@ -1,3 +1,17 @@
---
# Configuration for gitea
- name: Enable Gitea
service:
name: gitea
state: started
enabled: true
# - name: Deploy Gitea configuration
# template:
# src: "etc/gitea/conf/app.ini.j2"
# dest: "/etc/gitea/conf/app.ini"
# owner: git
# group: git
# mode: '0660'
# notify: restart_gitea
...

View File

@ -3,11 +3,13 @@
- name: "Installing Gitea from COPR"
dnf:
name: gitea
state: present
# Install web front end
- name: "Installing httpd package and configuration"
dnf:
name: gitea-httpd
state: present
when:
- gitea_web_install == "httpd"
- gitea_web_config
@ -15,6 +17,7 @@
- name: "Installing nginx package and configuration"
dnf:
name: gitea-nginx
state: present
when:
- gitea_web_install == "nginx"
- gitea_web_config
@ -22,6 +25,7 @@
- name: "Installing caddy package and configuration"
dnf:
name: gitea-caddy
state: present
when:
- gitea_web_install == "caddy"
- gitea_web_config