Skip to content

Commit 6249549

Browse files
authored
Better nix in ansible (#2394)
* ansible: Drop nix GCs We are doing GC and store optimise outside of ansible at the end of nix-provision.sh and qemu-bootstrap-nix.sh so no need to do them here. * ansible: Use nix shell to run supascan instead of installing/removing One task/command is easier to follow/understand than 3 over 2 files.
1 parent fd9294e commit 6249549

4 files changed

Lines changed: 4 additions & 28 deletions

File tree

‎ansible/files/supascan_ami.sh‎

100644100755
File mode changed.

‎ansible/playbook.yml‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,22 +195,11 @@
195195
196196
- name: Run supascan baseline validation
197197
when: stage2
198-
become: yes
199-
shell: |
198+
shell: >-
200199
baseline={{ 'ami' if not qemu else 'qemu' }}-build-{{ platform }}
201-
/bin/bash /tmp/ansible-playbook/ansible/files/supascan_ami.sh /tmp/ansible-playbook/audit-specs/baselines/$baseline
202-
203-
- name: Remove supascan after validation
204-
when: stage2
205-
become: yes
206-
shell: |
207-
sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile remove supascan"
208-
209-
- name: nix collect garbage
210-
when: stage2
211-
become: yes
212-
shell: |
213-
sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"
200+
nix shell github:supabase/postgres/{{ git_commit_sha }}#supascan --command
201+
/tmp/ansible-playbook/ansible/files/supascan_ami.sh
202+
/tmp/ansible-playbook/audit-specs/baselines/$baseline
214203
215204
- name: Setup Swap
216205
when: stage2 and not qemu

‎ansible/tasks/setup-wal-g.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@
4747
become: true
4848
become_user: wal-g
4949

50-
- name: nix collect garbage
51-
ansible.builtin.shell:
52-
cmd: sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"
53-
become: true
54-
5550
- name: Create symlink to make wal-g the default (v3 on orioledb builds, v2 otherwise)
5651
ansible.builtin.file:
5752
dest: '/usr/local/bin/wal-g'

‎ansible/tasks/stage2-setup-postgres.yml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@
7777
nix-env --set {{ postgres_env_path.stdout }}
7878
"
7979
80-
- name: Install supascan for baseline validation
81-
ansible.builtin.shell: |
82-
sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#supascan"
83-
84-
- name: nix collect garbage after supascan install
85-
ansible.builtin.shell:
86-
cmd: sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"
87-
8880
- name: Set ownership and permissions for file and dirs
8981
ansible.builtin.file:
9082
group: 'postgres'

0 commit comments

Comments
 (0)