2024-10-10 23:30:37 +02:00
|
|
|
---
|
|
|
|
- name: Goatcounter
|
2024-10-09 22:53:35 +02:00
|
|
|
hosts: servers
|
2024-10-10 23:55:47 +02:00
|
|
|
gather_facts: false
|
2024-10-09 22:53:35 +02:00
|
|
|
tasks:
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Get latest release
|
|
|
|
community.general.github_release:
|
2024-10-09 22:53:35 +02:00
|
|
|
action: latest_release
|
|
|
|
user: arp242
|
|
|
|
repo: goatcounter
|
|
|
|
register: release
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Print release
|
2024-10-09 22:53:35 +02:00
|
|
|
ansible.builtin.debug:
|
|
|
|
var: release.tag
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Download binary
|
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: https://github.com/arp242/goatcounter/releases/download/{{ release.tag }}/goatcounter-{{ release.tag }}-linux-amd64.gz
|
2024-10-11 11:29:20 +02:00
|
|
|
dest: "{{ dir }}/goatcounter-{{ release.tag }}.gz"
|
2024-10-10 23:30:37 +02:00
|
|
|
mode: "0644"
|
|
|
|
- name: Uncompress
|
2024-10-11 11:29:20 +02:00
|
|
|
ansible.builtin.command: gunzip {{ dir }}/goatcounter-{{ release.tag }}.gz
|
2024-10-09 22:53:35 +02:00
|
|
|
args:
|
2024-10-11 11:29:20 +02:00
|
|
|
creates: "{{ dir }}/goatcounter-{{ release.tag }}"
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Make executable
|
|
|
|
ansible.builtin.file:
|
2024-10-11 11:29:20 +02:00
|
|
|
path: "{{ dir }}/goatcounter-{{ release.tag }}"
|
2024-10-11 19:10:10 +02:00
|
|
|
mode: "0755"
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Symlink
|
|
|
|
ansible.builtin.file:
|
2024-10-11 11:29:20 +02:00
|
|
|
src: "{{ dir }}/goatcounter-{{ release.tag }}"
|
|
|
|
dest: "{{ dir }}/goatcounter"
|
2024-10-09 22:53:35 +02:00
|
|
|
state: link
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Write service unit file
|
2024-10-09 22:53:35 +02:00
|
|
|
become: true
|
2024-10-10 23:30:37 +02:00
|
|
|
ansible.builtin.template:
|
2024-10-17 17:32:09 +02:00
|
|
|
src: templates/goatcounter/goatcounter.service.j2
|
2024-10-09 22:53:35 +02:00
|
|
|
dest: /etc/systemd/system/goatcounter.service
|
2024-10-11 19:10:10 +02:00
|
|
|
mode: "0600"
|
2024-10-10 23:30:37 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
2024-10-09 22:53:35 +02:00
|
|
|
notify:
|
2024-10-10 23:30:37 +02:00
|
|
|
- Restart service
|
|
|
|
- name: Flush handlers
|
|
|
|
ansible.builtin.meta: flush_handlers
|
|
|
|
- name: Ensure service is running
|
2024-10-09 22:53:35 +02:00
|
|
|
become: true
|
2024-10-10 23:30:37 +02:00
|
|
|
ansible.builtin.service:
|
2024-10-09 22:53:35 +02:00
|
|
|
name: goatcounter
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
|
|
|
|
handlers:
|
2024-10-10 23:30:37 +02:00
|
|
|
- name: Restart service
|
2024-10-09 22:53:35 +02:00
|
|
|
become: true
|
2024-10-17 17:32:09 +02:00
|
|
|
ansible.builtin.systemd:
|
2024-10-09 22:53:35 +02:00
|
|
|
name: goatcounter
|
|
|
|
state: restarted
|
2024-10-17 17:32:09 +02:00
|
|
|
daemon_reload: true
|
2024-10-09 22:53:35 +02:00
|
|
|
|
|
|
|
vars:
|
|
|
|
ansible_python_interpreter: /tmp/ansible/bin/python
|
2024-10-11 11:29:20 +02:00
|
|
|
dir: /mnt/data/goatcounter
|
2024-10-09 22:53:35 +02:00
|
|
|
gc_mailgun_api_key: !vault |
|
|
|
|
$ANSIBLE_VAULT;1.1;AES256
|
|
|
|
31386237653033306338393237353961396535363061363931643863653461333631376365663338
|
|
|
|
3266346337353564656539666235656265356435343834380a616232383839663639616537393233
|
|
|
|
64303764306639636136346233366666633765393565353062396632636163643031616235303130
|
|
|
|
3662343162643033380a326161313036643835636562636165356464393236303533303435353365
|
|
|
|
36336163313338346235396565363631366564393562326536353262363637653432643830663532
|
|
|
|
30356133383335653330613965623261323531613131663437363430636565393262353565326132
|
2024-10-10 22:50:45 +02:00
|
|
|
323830313235313462633335333763363161
|