Skip to content

Commit 234da12

Browse files
authored
refactor(ansible): bring our ansible up to modern ansible-lint standards (#1856)
1 parent 9dec318 commit 234da12

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed
Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,130 @@
11
- name: AWS CLI dep
2-
apt:
2+
ansible.builtin.apt:
3+
install_recommends: false
34
pkg:
4-
- unzip
55
- jq
6-
install_recommends: no
6+
- unzip
77

8-
- name: AWS CLI (arm)
9-
get_url:
10-
url: "https://awscli.amazonaws.com/awscli-exe-linux-aarch64-{{ aws_cli_release }}.zip"
11-
dest: "/tmp/awscliv2.zip"
8+
- name: AWS CLI - get
9+
ansible.builtin.get_url:
10+
dest: '/tmp/awscliv2.zip'
1211
timeout: 60
13-
when: platform == "arm64"
12+
url: "https://awscli.amazonaws.com/awscli-exe-linux-{{ 'aarch64' if platform == 'arm64' else 'x86_64' }}-{{ aws_cli_release }}.zip"
1413

15-
- name: AWS CLI (x86)
16-
get_url:
17-
url: "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-{{ aws_cli_release }}.zip"
18-
dest: "/tmp/awscliv2.zip"
19-
timeout: 60
20-
when: platform == "amd64"
2114

2215
- name: AWS CLI - expand
23-
unarchive:
24-
remote_src: yes
25-
src: "/tmp/awscliv2.zip"
26-
dest: "/tmp"
16+
ansible.builtin.unarchive:
17+
dest: '/tmp'
18+
remote_src: true
19+
src: '/tmp/awscliv2.zip'
2720

2821
- name: AWS CLI - install
29-
shell: "/tmp/aws/install --update"
22+
ansible.builtin.command:
23+
cmd: /tmp/aws/install --update
3024
become: true
3125

3226
- name: install utilities to manage Amazon EC2 instance storage
33-
become: true
34-
apt:
27+
ansible.builtin.apt:
3528
pkg:
3629
- amazon-ec2-utils
30+
become: true
3731

3832
- name: AWS CLI - configure ipv6 support for s3
39-
shell: |
40-
aws configure set default.s3.use_dualstack_endpoint true
33+
ansible.builtin.command:
34+
cmd: aws configure set default.s3.use_dualstack_endpoint true
4135

4236
- name: install Vector for logging
43-
become: true
4437
apt:
45-
deb: "{{ vector_x86_deb }}"
46-
when: platform == "amd64"
47-
48-
- name: install Vector for logging
38+
deb: "{{ vector_x86_deb if platform == 'amd64' else vector_arm_deb }}"
4939
become: true
50-
apt:
51-
deb: "{{ vector_arm_deb }}"
52-
when: platform == "arm64"
5340

5441
- name: add Vector to postgres group
42+
ansible.builtin.user:
43+
append: true
44+
groups: 'postgres'
45+
name: 'vector'
5546
become: true
56-
shell:
57-
cmd: |
58-
usermod -a -G postgres vector
5947

6048
- name: create service files for Vector
61-
template:
62-
src: files/vector.service.j2
63-
dest: /etc/systemd/system/vector.service
49+
ansible.builtin.template:
50+
src: 'files/vector.service.j2'
51+
dest: '/etc/systemd/system/vector.service'
6452

6553
- name: configure tmpfiles for postgres - overwrites upstream package
66-
template:
67-
src: files/postgresql_config/tmpfiles.postgresql.conf
68-
dest: /etc/tmpfiles.d/postgresql-common.conf
54+
ansible.builtin.template:
55+
src: 'files/postgresql_config/tmpfiles.postgresql.conf'
56+
dest: '/etc/tmpfiles.d/postgresql-common.conf'
6957

7058
- name: fix permissions for vector config to be managed
71-
shell:
72-
cmd: |
73-
chown -R vector:vector /etc/vector
74-
chmod 0775 /etc/vector
59+
ansible.builtin.file:
60+
group: 'vector'
61+
mode: '0775'
62+
owner: 'vector'
63+
path: '/etc/vector'
64+
recurse: true
65+
state: 'directory'
7566

7667
- name: vector - reload systemd
77-
systemd:
78-
daemon_reload: yes
68+
ansible.builtin.systemd_service:
69+
daemon_reload: true
7970

8071
- name: Create checkpoints dir
72+
ansible.builtin.file:
73+
owner: 'vector'
74+
path: '/var/lib/vector'
75+
state: 'directory'
8176
become: true
82-
file:
83-
path: /var/lib/vector
84-
state: directory
85-
owner: vector
8677

8778
- name: Include file for generated optimizations in postgresql.conf
88-
become: true
89-
replace:
90-
path: /etc/postgresql/postgresql.conf
79+
ansible.builtin.replace:
80+
path: '/etc/postgresql/postgresql.conf'
9181
regexp: "#include = '/etc/postgresql-custom/generated-optimizations.conf'"
9282
replace: "include = '/etc/postgresql-custom/generated-optimizations.conf'"
83+
become: true
9384

9485
- name: Include file for custom overrides in postgresql.conf
95-
become: true
96-
replace:
97-
path: /etc/postgresql/postgresql.conf
86+
ansible.builtin.replace:
87+
path: '/etc/postgresql/postgresql.conf'
9888
regexp: "#include = '/etc/postgresql-custom/custom-overrides.conf'"
9989
replace: "include = '/etc/postgresql-custom/custom-overrides.conf'"
90+
become: true
10091

10192
- name: Install Postgres exporter
102-
import_tasks: internal/postgres-exporter.yml
93+
ansible.builtin.import_tasks:
94+
file: internal/postgres-exporter.yml
10395

10496
- name: Install admin-mgr
105-
import_tasks: internal/admin-mgr.yml
97+
ansible.builtin.import_tasks:
98+
file: internal/admin-mgr.yml
10699

107100
- name: Install adminapi
108-
import_tasks: internal/admin-api.yml
101+
ansible.builtin.import_tasks:
102+
file: internal/admin-api.yml
109103

110104
- name: Init nftabless
111-
import_tasks: internal/setup-nftables.yml
105+
ansible.builtin.import_tasks:
106+
file: internal/setup-nftables.yml
112107

113108
- name: Install pg_egress_collect
114-
import_tasks: internal/pg_egress_collect.yml
109+
ansible.builtin.import_tasks:
110+
file: internal/pg_egress_collect.yml
115111

116112
- name: Install PostgreSQL prestart script
117-
import_tasks: internal/postgresql-prestart.yml
113+
ansible.builtin.import_tasks:
114+
file: internal/postgresql-prestart.yml
118115

119116
- name: Install salt minion
120-
import_tasks: internal/install-salt.yml
117+
ansible.builtin.import_tasks:
118+
file: internal/install-salt.yml
121119
tags:
122120
- aws-only
123121

124122
- name: Install supabase-admin-agent
125-
import_tasks: internal/supabase-admin-agent.yml
123+
ansible.builtin.import_tasks:
124+
file: internal/supabase-admin-agent.yml
126125
tags:
127126
- aws-only
128127

129128
- name: Envoy - use lds.supabase.yaml for /etc/envoy/lds.yaml
130-
command: mv /etc/envoy/lds.supabase.yaml /etc/envoy/lds.yaml
129+
ansible.builtin.command:
130+
cmd: mv /etc/envoy/lds.supabase.yaml /etc/envoy/lds.yaml

0 commit comments

Comments
 (0)