Skip to content

Commit e3a91a7

Browse files
authored
refactor(ansible): bring our ansible up to modern ansible-lint standards (#1813)
* refactor(ansible): bring our ansible up to modern ansible-lint standards * fix(setup-gotrue.yml): here, you dropped this: /
1 parent e430828 commit e3a91a7

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

ansible/tasks/setup-gotrue.yml

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,47 @@
11
- name: UFW - Allow connections to GoTrue metrics exporter
2-
ufw:
3-
rule: allow
4-
port: "9122"
2+
community.general.ufw:
3+
port: '9122'
4+
rule: 'allow'
55

66
# use this user for the Gotrue build and for running the service
77
- name: Gotrue - system user
8-
user: name=gotrue
8+
ansible.builtin.user:
9+
name: 'gotrue'
10+
state: 'present'
911

10-
- name: Setting arch (x86)
11-
set_fact:
12-
arch: "x86"
13-
when: platform == "amd64"
14-
15-
- name: Setting arch (arm)
16-
set_fact:
17-
arch: "arm64"
18-
when: platform == "arm64"
12+
- name: Setting arch as a fact
13+
ansible.builtin.set_fact:
14+
arch: >-
15+
{%- if platform == 'amd64' -%}
16+
x86
17+
{%- elif platform == 'arm64' -%}
18+
arm64
19+
{%- endif -%}
1920
2021
- name: gotrue - download commit archive
21-
get_url:
22-
url: "https://github.com/supabase/gotrue/releases/download/v{{ gotrue_release }}/auth-v{{ gotrue_release }}-{{ arch }}.tar.gz"
23-
dest: /tmp/gotrue.tar.gz
22+
ansible.builtin.get_url:
2423
checksum: "{{ gotrue_release_checksum }}"
24+
dest: '/tmp/gotrue.tar.gz'
25+
url: "https://github.com/supabase/gotrue/releases/download/v{{ gotrue_release }}/auth-v{{ gotrue_release }}-{{ arch }}.tar.gz"
2526

26-
- name: gotrue - create /opt/gotrue
27-
file:
28-
path: /opt/gotrue
29-
state: directory
30-
owner: gotrue
31-
mode: 0775
32-
33-
- name: gotrue - create /etc/auth.d
34-
file:
35-
path: /etc/auth.d
36-
state: directory
37-
owner: gotrue
38-
mode: 0775
27+
- name: gotrue - create /opt/gotrue and /etc/auth.d
28+
ansible.builtin.file:
29+
mode: '0775'
30+
owner: 'gotrue'
31+
path: "{{ gotrue_dir_item }}"
32+
state: 'directory'
33+
loop:
34+
- '/etc/auth.d'
35+
- '/opt/gotrue'
36+
loop_control:
37+
loop_var: 'gotrue_dir_item'
3938

4039
- name: gotrue - unpack archive in /opt/gotrue
41-
unarchive:
42-
remote_src: yes
43-
src: /tmp/gotrue.tar.gz
44-
dest: /opt/gotrue
45-
owner: gotrue
40+
ansible.builtin.unarchive:
41+
dest: '/opt/gotrue'
42+
owner: 'gotrue'
43+
remote_src: true
44+
src: '/tmp/gotrue.tar.gz'
4645

4746
# libpq is a C library that enables user programs to communicate with
4847
# the PostgreSQL database server.
@@ -52,15 +51,15 @@
5251
# - libpq-dev
5352

5453
- name: gotrue - create service file
55-
template:
56-
src: files/gotrue.service.j2
57-
dest: /etc/systemd/system/gotrue.service
54+
ansible.builtin.template:
55+
dest: '/etc/systemd/system/gotrue.service'
56+
src: 'files/gotrue.service.j2'
5857

5958
- name: gotrue - create optimizations file
60-
template:
61-
src: files/gotrue-optimizations.service.j2
62-
dest: /etc/systemd/system/gotrue-optimizations.service
59+
ansible.builtin.template:
60+
dest: '/etc/systemd/system/gotrue-optimizations.service'
61+
src: 'files/gotrue-optimizations.service.j2'
6362

6463
- name: gotrue - reload systemd
65-
systemd:
66-
daemon_reload: yes
64+
ansible.builtin.systemd_service:
65+
daemon_reload: true

0 commit comments

Comments
 (0)