Skip to content

Commit 0c04fb0

Browse files
committed
fix(plugin): only run version tasks for Debian/Ubuntu
1 parent 9cb1421 commit 0c04fb0

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

tasks/plugins_postgresql.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
---
22

3-
- name: plugins_postgresql | Fetch postgresql version
4-
ansible.builtin.command:
5-
cmd: "pg_config --version"
6-
changed_when: false
7-
register: _psql_version
8-
# stdout example: "PostgreSQL 14.11 (Ubuntu 14.11-0ubuntu0.22.04.1)""
3+
- name: plugins_postgresql | Determine postgresql version for Debian/Ubuntu
4+
when:
5+
- ansible_facts.os_family == "Debian"
6+
block:
7+
- name: plugins_postgresql | Fetch postgresql version
8+
ansible.builtin.command:
9+
cmd: "pg_config --version"
10+
changed_when: false
11+
register: _psql_version
12+
# stdout example: "PostgreSQL 14.11 (Ubuntu 14.11-0ubuntu0.22.04.1)""
913

10-
# var is used by `bareos_fd_plugin_psql_root_dir`in vars/<Distro>.yml
11-
# to determine file location for configs (Debian/Ubuntu).
12-
- name: plugins_postgresql | Determine postgresql major version
13-
ansible.builtin.set_fact:
14-
bareos_fd_plugin_psql_version: "{{ ((_psql_version.stdout | split)[1] | split('.'))[0] }}"
14+
# var is used by `bareos_fd_plugin_psql_root_dir`in vars/<Distro>.yml
15+
# to determine file location for configs (Debian/Ubuntu).
16+
- name: plugins_postgresql | Register postgresql major version
17+
ansible.builtin.set_fact:
18+
bareos_fd_plugin_psql_version: "{{ ((_psql_version.stdout | split)[1] | split('.'))[0] }}"
19+
20+
- name: plugins_postgresql | Validate version number
21+
ansible.builtin.assert:
22+
that:
23+
- ( bareos_fd_plugin_psql_version | int) is number
1524

1625
- name: plugins_postgresql | Enable local peer access for root user
1726
ansible.builtin.lineinfile:

0 commit comments

Comments
 (0)