checks.yml 763 Bytes
Newer Older
1
2
---
- name: look for installed postgres version
EKbfh's avatar
EKbfh committed
3
  shell: dpkg-query -W -f='${package} ${status}\n' postgresql-*|grep "install ok installed" | grep -Po "(\d.?\d+)"|sort -u
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  ignore_errors: "True"
  check_mode: "False"
  no_log: "{{ tower_show_secrets }}"
  register: pkg_postgres_version

- name: expose postgres used version as a fact
  set_fact:
    postgres_version_used: "{{ pkg_postgres_version.stdout }}"
  when:
    - not pkg_postgres_version is failed
    - pkg_postgres_version.stdout_lines | length == 1

- name: expose too may postgres installed fact
  set_fact:
    too_many_postgres_installed: "{{ pkg_postgres_version.stdout_lines | join(', ') }}"
  when:
    - not pkg_postgres_version is failed
    - pkg_postgres_version.stdout_lines | length > 1