diff --git a/create_inventory_lxc.yml b/create_inventory_lxc.yml index 4c639b3..d89591c 100644 --- a/create_inventory_lxc.yml +++ b/create_inventory_lxc.yml @@ -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') }}"