Fix break with download template in LXC 4.0.12
LXC 0.4.12 removes "--no-validate" from lxc-download template. So old versions should use this flag but not 4.0.12+ Closes: #3
This commit is contained in:
parent
f281ee5836
commit
f41c3e2b59
|
@ -66,13 +66,20 @@
|
|||
when: inventory_hostname in groups.lxc_hosts
|
||||
|
||||
|
||||
- name: Check for no-validate parameter in download template
|
||||
shell: "/usr/share/lxc/templates/lxc-download --help | grep no-validate || true"
|
||||
changed_when: false
|
||||
register: lxc_download_validate
|
||||
delegate_to: "{{ ansible_host|default('localhost') }}"
|
||||
|
||||
|
||||
- name: Create LXContainer
|
||||
lxc_container:
|
||||
name: "{{ inventory_hostname }}"
|
||||
state: started
|
||||
template: download
|
||||
template_options: "-a amd64 -d {{ os_d }} -r {{ os_r }} --no-validate"
|
||||
config: /etc/lxc/ansible.conf
|
||||
template_options: "-a amd64 -d {{ os_d }} -r {{ os_r }} {% if 'no-validate' in lxc_download_validate.stdout %}--no-validate{% endif %}"
|
||||
config: "{{ lxc_config_file|default('/etc/lxc/ansible.conf') }}"
|
||||
register: lxc_created
|
||||
delegate_to: "{{ ansible_host|default('localhost') }}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue