Merge remote-tracking branch 'origin/layers-secrets-share'

This commit is contained in:
Khue Doan 2021-03-21 18:26:16 +07:00
commit d2472f5fff
4 changed files with 21 additions and 20 deletions

1
.gitignore vendored
View File

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

View File

@ -6,7 +6,9 @@ init:
terraform init
plan:
terraform plan
source ../metal/secrets/env \
&& terraform plan
apply:
terraform apply
source ../metal/secrets/env \
&& terraform apply

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 }}