Use stat instead of file module for exists check
Ansible 2.8 does not return a "state" attribute if the file does not exist[1], so the task is changed to use stat instead. [1] https://github.com/ansible/ansible/pull/51350 Change-Id: I166186b6d8abf84317ba98af949d4ed887618912
This commit is contained in:
parent
b393915874
commit
e471feba83
@ -140,12 +140,11 @@
|
|||||||
|
|
||||||
# Check that the container bridge exists, if not bring it up
|
# Check that the container bridge exists, if not bring it up
|
||||||
- name: Check Container Bridge exists
|
- name: Check Container Bridge exists
|
||||||
file:
|
stat:
|
||||||
state: "file"
|
|
||||||
path: "/sys/class/net/{{ lxc_net_bridge }}/bridge/bridge_id"
|
path: "/sys/class/net/{{ lxc_net_bridge }}/bridge/bridge_id"
|
||||||
register: bridge_check
|
register: bridge_check
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: bridge_check.state == 'absent'
|
changed_when: not bridge_check.stat.exists
|
||||||
notify:
|
notify:
|
||||||
- Bring bridge up
|
- Bring bridge up
|
||||||
- Reload networkd
|
- Reload networkd
|
||||||
|
Loading…
Reference in New Issue
Block a user