ansible_lxd_tests/Playbooks/roles/init_lxd/tasks/main.yml

37 lines
852 B
YAML

---
# tasks file for roles/init_lxd
- name: Install lxd
become: true
ansible.builtin.snap:
name: lxd
classic: yes
- ansible.builtin.debug:
var:
verbosity: 1
- delegate_to: localhost
delegate_facts: true
ansible.builtin.copy:
content: "{{hostvars[inventory_hostname]}}"
dest: ./test.json
- delegate_to: localhost
delegate_facts: true
ansible.builtin.template:
src: "{{lxd_init_template_config_path}}"
dest: "{{lxd_init_template_processed_path}}"
## tira el lxd init con los parametros
- name: "Preseeding LXD Init with template: {{lxd_init_template_config_path}}"
become: true
ansible.builtin.shell: |
cat <<EOF | lxd init --preseed
{{ lookup('file', lxd_init_template_processed_path) }}
EOF
register: lxd_init_output
- ansible.builtin.debug:
var: lxd_init_output
verbosity: 2