aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-08 19:15:49 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-09 16:43:04 +0000
commitd955edab044335b4b599963df078a4f85d7faa7b (patch)
tree7f8a1937043f9ee628584975ac296a5764e8b29f
parentf86e57ffc10bc85168eff90269824d1462c22187 (diff)
downloadinfrastructure-d955edab044335b4b599963df078a4f85d7faa7b.tar.gz
roles/vmm: Use lookup for public key and passwords
-rw-r--r--roles/vmm/defaults/main.yml4
-rw-r--r--roles/vmm/templates/autoinstall.conf.j211
2 files changed, 7 insertions, 8 deletions
diff --git a/roles/vmm/defaults/main.yml b/roles/vmm/defaults/main.yml
index 2e2ceb1..e91c7a1 100644
--- a/roles/vmm/defaults/main.yml
+++ b/roles/vmm/defaults/main.yml
@@ -5,10 +5,10 @@ vmm_disk_dir: /data/vmm/disk.d
vmm_disk_format: qcow2
vmm_configuration_file: /etc/vm.conf
-vmm_default_password: a
vmm_default_timezone: Europe/Stockholm
vmm_default_fallback_http: true
-vmm_default_ssh_key: a
+vmm_default_password: "{{ lookup('password', lookup('env', 'PWD') ~ '/files/secrets/hosts/default/root-password') }}"
+vmm_default_ssh_key: "{{ lookup('file', lookup('env', 'PWD') ~ '/files/keys/rgoncalves.pub') }}"
vmm_image_openbsd_kernel_prefix: /bsd.vm
diff --git a/roles/vmm/templates/autoinstall.conf.j2 b/roles/vmm/templates/autoinstall.conf.j2
index 7a784ab..093b823 100644
--- a/roles/vmm/templates/autoinstall.conf.j2
+++ b/roles/vmm/templates/autoinstall.conf.j2
@@ -1,11 +1,11 @@
-{% set guest = hostvars[item.name] %}
+{% set host = hostvars[item.name] %}
System hostname = {{ item.name }}
Which network interface do you wish to configure = vio0
-IPv4 address for vio0 = {{ guest.__ip.external }}
-Default IPv4 route = "{{ ansible_default_ipv4.gateway }}"
-Using DNS domainname = {{ guest.__domain_name }}
+IPv4 address for vio0 = {{ host.__ip.external }}
+Default IPv4 route = {{ ansible_default_ipv4.gateway }}
+Using DNS domainname = {{ host.inventory_hostname }}.{{ __global_domain_name_hosts }}.{{ __global_domain_name }}
Using DNS nameservers = {{ __global_domain_name_servers | join (" ") }}
-Password for root = {{ vmm_default_password }}
+Password for root = {{ lookup('password', lookup('env', 'PWD') ~ '/files/secrets/hosts/' ~ host.inventory_hostname ~ '/root-password') }}"
Public ssh key for root account = {{ vmm_default_ssh_key }}
Which disk is the root disk = sd0
URL to autopartitioning template for disklabel = http://{{ ansible_default_ipv4.address }}/{{ item.lladdr }}-disklabel.conf
@@ -13,5 +13,4 @@ Allow root ssh login = yes
What timezone are you in = {{ vmm_default_timezone }}
Unable to connect using https. Use http instead = {{ "yes" if vmm_default_fallback_http else "no" }}
Location of sets = http
-HTTP Server = cdn.openbsd.org
Set name(s) = -all bsd* base* comp* man*
remember that computers suck.