Skip to content

Commit db11b61

Browse files
authored
Add status check for NetworkManager updates (#115)
Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent 4e56abe commit db11b61

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

roles/prereqs/pvc_ecs/tasks/main.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
# Copyright 2023 Cloudera, Inc.
24
#
35
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,13 +14,14 @@
1214
# See the License for the specific language governing permissions and
1315
# limitations under the License.
1416

15-
---
16-
1717
- name: Fail Fast if ECS OS is not RH family
18-
fail:
18+
ansible.builtin.fail:
1919
msg: ECS is not supported on this OS, should be Centos or RHEL
2020
when: ansible_os_family != 'RedHat'
2121

22+
- name: Populate service facts
23+
ansible.builtin.service_facts:
24+
2225
- name: Install necessary additional packages
2326
ansible.builtin.package:
2427
name: "{{ __package_item }}"
@@ -47,8 +50,7 @@
4750
when: ansible_distribution_major_version | int >= 8
4851
block:
4952
- name: Install iptables for rhel8, using rpm option tsflags=noscripts
50-
command: dnf install -y iptables --setopt=tsflags=noscripts
51-
53+
ansible.builtin.command: dnf install -y iptables --setopt=tsflags=noscripts
5254

5355
- name: Flush iptables
5456
ansible.builtin.iptables:
@@ -65,22 +67,21 @@
6567

6668
## see https://docs.rke2.io/known_issues
6769
- name: Set NetworkManager to ignore any ECS calico & flannel interfaces
68-
copy:
70+
ansible.builtin.copy:
6971
src: networkmanager.conf
7072
dest: /etc/NetworkManager/conf.d/rke2-canal.config
7173
owner: root
7274
group: root
7375
mode: 0644
7476
when:
75-
- ansible_distribution_major_version|int >= 7
76-
- ansible_facts.services['NetworkManager.service'] is defined
77+
- ansible_distribution_major_version|int >= 7
78+
- ansible_facts.services["NetworkManager.service"]['status'] != "not-found"
7779

7880
- name: Reload NetworkManager daemon
79-
systemd:
81+
ansible.builtin.service:
8082
state: restarted
8183
daemon_reload: true
8284
name: NetworkManager.service
8385
when:
84-
- ansible_distribution_major_version|int >= 7
85-
- ansible_facts.services['NetworkManager.service'] is defined
86-
86+
- ansible_distribution_major_version|int >= 7
87+
- ansible_facts.services["NetworkManager.service"]['status'] != "not-found"

0 commit comments

Comments
 (0)