khuedoan-homelab/metal/roles/tfstate/tasks/main.yml

44 lines
951 B
YAML
Raw Normal View History

- 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
2021-05-01 16:17:19 +07:00
parent: "{{ network_interface }}"
- 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
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
# TODO enable etcd authentication and generate terraform backend config variables