Skip to content

Commit 2295e51

Browse files
committed
fix: linting patterns command module changed_when
1 parent 19c7e93 commit 2295e51

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

roles/sap_general_preconfigure/tasks/SLES/installation.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,21 @@
2929
when: "'packagekit.service' in ansible_facts.services"
3030

3131

32+
# Pattern installation will run only if pattern is not installed
33+
# This ensures that command module shows correct changed status
34+
- name: Query installed zypper patterns
35+
ansible.builtin.command:
36+
cmd: zypper patterns --installed-only
37+
register: __sap_general_preconfigure_register_patterns
38+
changed_when: false
39+
ignore_errors: true
40+
3241
- name: Ensure that the required zypper patterns are installed
3342
ansible.builtin.command:
3443
cmd: zypper install -y -t pattern {{ item }}
3544
loop: "{{ sap_general_preconfigure_patterns }}"
45+
when: item not in __sap_general_preconfigure_register_patterns.stdout
46+
changed_when: item not in __sap_general_preconfigure_register_patterns.stdout
3647

3748
- name: Ensure that the required packages are installed
3849
ansible.builtin.package:

roles/sap_hana_preconfigure/tasks/SLES/installation.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,21 @@
2929
when: "'packagekit.service' in ansible_facts.services"
3030

3131

32+
# Pattern installation will run only if pattern is not installed
33+
# This ensures that command module shows correct changed status
34+
- name: Query installed zypper patterns
35+
ansible.builtin.command:
36+
cmd: zypper patterns --installed-only
37+
register: __sap_hana_preconfigure_register_patterns
38+
changed_when: false
39+
ignore_errors: true
40+
3241
- name: Ensure that the required zypper patterns are installed
3342
ansible.builtin.command:
3443
cmd: zypper install -y -t pattern {{ item }}
3544
loop: "{{ sap_hana_preconfigure_patterns }}"
45+
when: item not in __sap_hana_preconfigure_register_patterns.stdout
46+
changed_when: item not in __sap_hana_preconfigure_register_patterns.stdout
3647

3748
- name: Ensure that the required packages are installed
3849
ansible.builtin.package:

roles/sap_netweaver_preconfigure/tasks/SLES/installation.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,21 @@
2929
when: "'packagekit.service' in ansible_facts.services"
3030

3131

32+
# Pattern installation will run only if pattern is not installed
33+
# This ensures that command module shows correct changed status
34+
- name: Query installed zypper patterns
35+
ansible.builtin.command:
36+
cmd: zypper patterns --installed-only
37+
register: __sap_netweaver_preconfigure_register_patterns
38+
changed_when: false
39+
ignore_errors: true
40+
3241
- name: Ensure that the required zypper patterns are installed
3342
ansible.builtin.command:
3443
cmd: zypper install -y -t pattern {{ item }}
3544
loop: "{{ sap_netweaver_preconfigure_patterns }}"
45+
when: item not in __sap_netweaver_preconfigure_register_patterns.stdout
46+
changed_when: item not in __sap_netweaver_preconfigure_register_patterns.stdout
3647

3748
- name: Ensure that the required packages are installed
3849
ansible.builtin.package:

0 commit comments

Comments
 (0)