mirror of
https://github.com/khuedoan/homelab.git
synced 2025-01-24 18:06:16 +07:00
fd6ab62a12
Because default profile was removed
49 lines
1.0 KiB
YAML
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
|