khuedoan-homelab/metal/roles/tfstate/tasks/main.yml
Khue Doan fd6ab62a12 Add root device for tfstate container
Because default profile was removed
2021-05-17 01:09:38 +07:00

49 lines
1.0 KiB
YAML

- name: Create a tfstate container
lxd_container:
name: tfstate
state: started
url: "https://{{ hostvars[groups['metal'][0]]['ansible_host'] }}:8443"
source:
type: image
mode: pull
server: https://images.linuxcontainers.org
alias: ubuntu/focal/amd64
wait_for_ipv4_addresses: yes
devices:
eth0:
type: nic
nictype: macvlan
parent: "{{ network_interface }}"
root:
type: disk
pool: default
path: /
size: 8GiB
- name: Add tfstate container to host list
add_host:
name: tfstate
groups: lxd
ansible_connection: lxd
ansible_lxd_remote: homelab
- name: Install etcd
delegate_to: tfstate
apt:
name: etcd
- name: Add etcd config
delegate_to: tfstate
template:
src: etcd.j2
dest: /etc/default/etcd
- name: Restart etcd
delegate_to: tfstate
systemd:
name: etcd
state: restarted
enabled: yes
# TODO (feature) Enable etcd authentication and generate terraform backend config variables