Skip to content

Commit c2a3550

Browse files
authored
chore: write version file pam_jit_pg (#2024)
* chore: write version file pam_jit_pg Write a version file for pam_jit_pg so that salt doesn't try overwrite when applying to an image that already has the library installed. Salt knows to check the version and only update if salt specifies a different version should be used. * chore: dynamic get installed gk version
1 parent ae34501 commit c2a3550

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

ansible/tasks/stage2-setup-postgres.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
is_psql_oriole: "{{ psql_version in ['psql_orioledb-17'] }}"
66
is_psql_17: "{{ psql_version in ['psql_17'] }}"
77
is_psql_15: "{{ psql_version in ['psql_15'] }}"
8-
8+
99
- name: Execute tasks when (is_psql_oriole or is_psql_17) and stage2_nix
1010
become: true
1111
when:
@@ -83,7 +83,7 @@
8383
state: present
8484
when: is_psql_oriole and stage2_nix
8585
become: yes
86-
86+
8787
- name: Add ORIOLEDB_ENABLED environment variable
8888
ansible.builtin.lineinfile:
8989
line: 'ORIOLEDB_ENABLED=true'
@@ -176,6 +176,18 @@
176176
shell: |
177177
sudo ln -s /var/lib/postgresql/.nix-profile/lib/security/pam_jit_pg.so $(find /nix/store -type d -path "/nix/store/*-linux-pam-*/lib/security" -print -quit)/pam_jit_pg.so
178178
179+
- name: Get gatekeeper version
180+
ansible.builtin.shell: |
181+
sudo -u postgres bash -c "/nix/var/nix/profiles/default/bin/nix-store -q --requisites ~/.nix-profile | awk -F- '/gatekeeper/{print \$NF}'"
182+
register: gatekeeper_version
183+
184+
- name: Write version file
185+
ansible.builtin.copy:
186+
dest: "/root/pam_jit_pg-version"
187+
group: "root"
188+
owner: "root"
189+
content: "{{ gatekeeper_version.stdout }}"
190+
179191
- name: Create symlinks for Nix files into /usr/lib/postgresql/bin
180192
ansible.builtin.file:
181193
group: 'postgres'

0 commit comments

Comments
 (0)