|
1 | 1 | ---
|
2 | 2 |
|
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)"" |
9 | 13 |
|
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 |
15 | 24 |
|
16 | 25 | - name: plugins_postgresql | Enable local peer access for root user
|
17 | 26 | ansible.builtin.lineinfile:
|
|
0 commit comments