This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from aleksei-burlakov/refactor-version-checks
Refactor version checks
- Loading branch information
Showing
11 changed files
with
21 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# | ||
readlink /etc/products.d/baseproduct | grep -i "{{ expected [name] }}" || exit 1 | ||
exit 0 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.rc != 0 | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ ansible_distribution is version(expected[name], '==') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
--- | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ ansible_distribution_version is version(expected[name], '>=') }}" | ||
status: "{{ ansible_distribution_version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the pacemaker version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" pacemaker || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'pacemaker' in ansible_facts.packages and ansible_facts.packages['pacemaker'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the corosync version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" corosync || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'corosync' in ansible_facts.packages and ansible_facts.packages['corosync'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the sbd version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" sbd || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'sbd' in ansible_facts.packages and ansible_facts.packages['sbd'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the SAPHanaSR version is at least | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" SAPHanaSR || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'SAPHanaSR' in ansible_facts.packages and ansible_facts.packages['SAPHanaSR'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check python version | ||
python3 --version | cut -d" " -f2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc !=0 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'python3' in ansible_facts.packages and ansible_facts.packages['python3'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters