tasks: lxc_volume: Always create the machines.raw file

The machines.raw file is only created if the 'machinectl set-limit'
command returns non-zero exit code. However, this file is expected to
be present later on so we need to make sure that we create without
taking the 'machinectl' exit code into consideration.

Fixes the following problem:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Device /var/lib/machines.raw not found."}

Depends-On: https://review.openstack.org/#/c/574382/
Change-Id: I8bfd8f2c698241d7b62d01f1674aff8e5c3d2eeb
This commit is contained in:
Markos Chandras 2018-06-12 11:58:50 +01:00
parent 25b074a464
commit 3260f59035

View File

@ -26,9 +26,8 @@
# value properly during a major upgrade.
- name: Set volume size
shell: |
if ! machinectl set-limit {{ lxc_host_machine_volume_size | regex_replace("\D*$", "") }}G; then
truncate -s '>{{ lxc_host_machine_volume_size | regex_replace("\D*$", "") }}G' /var/lib/machines.raw
fi
machinectl set-limit {{ lxc_host_machine_volume_size | regex_replace("\D*$", "") }}G
truncate -s '>{{ lxc_host_machine_volume_size | regex_replace("\D*$", "") }}G' /var/lib/machines.raw
changed_when: false
register: machines_create
args: