Skip to content

Commit

Permalink
Move OS checking tasks to the pre-checks role
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Aug 9, 2023
1 parent fa84970 commit a20fa4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
10 changes: 0 additions & 10 deletions config_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always

- name: Checking Linux distribution
ansible.builtin.fail:
msg: "{{ ansible_distribution }} is not supported"
when: ansible_distribution not in os_valid_distributions

- name: Checking version of OS Linux
ansible.builtin.fail:
msg: "{{ ansible_distribution_version }} of {{ ansible_distribution }} is not supported"
when: ansible_distribution_version is version_compare(os_minimum_versions[ansible_distribution], '<')

- name: Update apt cache
ansible.builtin.apt:
update_cache: true
Expand Down
10 changes: 0 additions & 10 deletions deploy_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,6 @@
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always

- name: Checking Linux distribution
ansible.builtin.fail:
msg: "{{ ansible_distribution }} is not supported"
when: ansible_distribution not in os_valid_distributions

- name: Checking version of OS Linux
ansible.builtin.fail:
msg: "{{ ansible_distribution_version }} of {{ ansible_distribution }} is not supported"
when: ansible_distribution_version is version_compare(os_minimum_versions[ansible_distribution], '<')

- name: Build a firewall_ports_dynamic_var
ansible.builtin.set_fact:
firewall_ports_dynamic_var: "{{ firewall_ports_dynamic_var | default([]) + (firewall_allowed_tcp_ports_for[item] | default([])) }}"
Expand Down
10 changes: 10 additions & 0 deletions roles/pre-checks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
when:
- ansible_version.full is version(minimal_ansible_version, '<')

- name: Checking Linux distribution
ansible.builtin.fail:
msg: "{{ ansible_distribution }} is not supported"
when: ansible_distribution not in os_valid_distributions

- name: Checking version of OS Linux
ansible.builtin.fail:
msg: "{{ ansible_distribution_version }} of {{ ansible_distribution }} is not supported"
when: ansible_distribution_version is version_compare(os_minimum_versions[ansible_distribution], '<')

- name: Perform pre-checks for timescaledb
ansible.builtin.import_tasks: timescaledb.yml
when:
Expand Down

0 comments on commit a20fa4d

Please sign in to comment.