Export metal secrets to an env file

This commit is contained in:
Khue Doan 2021-03-21 18:24:48 +07:00
parent 7e22d2455f
commit 9d30d0e328
3 changed files with 17 additions and 18 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.vagrant/
.venv/
build/
metal/secrets/
*.log
.terraform*

View File

@ -35,22 +35,18 @@
creates: /var/snap/lxd/common/lxd/server.crt
when: inventory_hostname != groups['metal'][0]
# - name: Add remote
# command:
# argv:
# - lxc
# - remote
# - add
# - vagrant
# - "{{ hostvars[groups['metal'][0]]['ansible_host'] }}"
# - --accept-certificate
# - --password
# - 1
- name: Add LXD server to environment variables
lineinfile:
path: "{{ playbook_dir }}/secrets/env"
line: "LXD_ADDR={{ hostvars[groups['metal'][0]]['ansible_host'] }}"
create: yes
delegate_to: localhost
run_once: yes
# - name: Change default remote
# command:
# argv:
# - lxc
# - remote
# - switch
# - vagrant
- name: Add LXD password to environment variables
lineinfile:
path: "{{ playbook_dir }}/secrets/env"
line: "LXD_PASSWORD={{ lxd_password }}"
create: yes
delegate_to: localhost
run_once: yes

View File

@ -0,0 +1,2 @@
LXD_ADDR={{ hostvars[groups['metal'][0]]['ansible_host'] }}
LXD_PASSWORD={{ lxd_password }}