2022-07-16 23:28:28 -03:00
|
|
|
---
|
|
|
|
# tasks file for roles/init_lxd
|
|
|
|
- name: Install lxd
|
2022-07-17 01:24:18 -03:00
|
|
|
become: true
|
2022-07-16 23:28:28 -03:00
|
|
|
ansible.builtin.snap:
|
|
|
|
name: lxd
|
|
|
|
classic: yes
|
|
|
|
|
2022-08-05 01:34:36 -03:00
|
|
|
- register: tmp_file_stat
|
|
|
|
stat: path="{{lxd_init_template_processed_path}}"
|
|
|
|
- ansible.builtin.meta: end_batch
|
|
|
|
when: tmp_file_stat.stat.exists
|
|
|
|
|
2022-07-17 01:24:18 -03:00
|
|
|
- ansible.builtin.debug:
|
2022-07-28 20:52:07 -03:00
|
|
|
var: hostvars[inventory_hostname]['ansible_default_ipv4']['address']
|
2022-07-17 01:24:18 -03:00
|
|
|
verbosity: 1
|
|
|
|
|
2022-07-28 20:52:07 -03:00
|
|
|
#- delegate_to: localhost
|
|
|
|
# delegate_facts: true
|
|
|
|
# ansible.builtin.copy:
|
|
|
|
# content: "{{hostvars[inventory_hostname]}}"
|
|
|
|
# dest: ./test.json
|
2022-07-17 01:24:18 -03:00
|
|
|
|
|
|
|
- delegate_to: localhost
|
|
|
|
delegate_facts: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{lxd_init_template_config_path}}"
|
|
|
|
dest: "{{lxd_init_template_processed_path}}"
|
|
|
|
|
2022-07-16 23:28:28 -03:00
|
|
|
## tira el lxd init con los parametros
|
2022-07-17 01:24:18 -03:00
|
|
|
- name: "Preseeding LXD Init with template: {{lxd_init_template_config_path}}"
|
2022-07-16 23:28:28 -03:00
|
|
|
become: true
|
|
|
|
ansible.builtin.shell: |
|
|
|
|
cat <<EOF | lxd init --preseed
|
2022-07-17 01:24:18 -03:00
|
|
|
{{ lookup('file', lxd_init_template_processed_path) }}
|
2022-07-16 23:28:28 -03:00
|
|
|
EOF
|
|
|
|
register: lxd_init_output
|
|
|
|
|
|
|
|
- ansible.builtin.debug:
|
|
|
|
var: lxd_init_output
|