2021-04-24 18:02:19 +07:00
|
|
|
- name: Create a tfstate container
|
|
|
|
lxd_container:
|
|
|
|
name: tfstate
|
|
|
|
state: started
|
2021-04-25 00:30:52 +07:00
|
|
|
url: "https://{{ hostvars[groups['metal'][0]]['ansible_host'] }}:8443"
|
2021-04-24 18:02:19 +07:00
|
|
|
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
|
2021-05-01 16:17:19 +07:00
|
|
|
parent: "{{ network_interface }}"
|
2021-05-17 01:09:38 +07:00
|
|
|
root:
|
|
|
|
type: disk
|
|
|
|
pool: default
|
|
|
|
path: /
|
|
|
|
size: 8GiB
|
2021-04-24 18:02:19 +07:00
|
|
|
|
2021-04-25 00:30:52 +07:00
|
|
|
- name: Add tfstate container to host list
|
|
|
|
add_host:
|
|
|
|
name: tfstate
|
|
|
|
groups: lxd
|
|
|
|
ansible_connection: lxd
|
|
|
|
ansible_lxd_remote: homelab
|
2021-04-24 18:02:19 +07:00
|
|
|
|
2021-04-24 19:07:41 +07:00
|
|
|
- name: Install etcd
|
2021-04-25 00:30:52 +07:00
|
|
|
delegate_to: tfstate
|
|
|
|
apt:
|
|
|
|
name: etcd
|
2021-04-25 00:55:04 +07:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2021-05-01 22:51:55 +07:00
|
|
|
# TODO (feature) Enable etcd authentication and generate terraform backend config variables
|