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:
Logan V 2019-05-16 19:51:09 -05:00
parent b393915874
commit e471feba83
1 changed files with 2 additions and 3 deletions

View File

@ -140,12 +140,11 @@
# Check that the container bridge exists, if not bring it up
- name: Check Container Bridge exists
file:
state: "file"
stat:
path: "/sys/class/net/{{ lxc_net_bridge }}/bridge/bridge_id"
register: bridge_check
failed_when: false
changed_when: bridge_check.state == 'absent'
changed_when: not bridge_check.stat.exists
notify:
- Bring bridge up
- Reload networkd