Initial commit
[ta/infra-ansible.git] / roles / baremetal_provision / templates / user_data.j2
diff --git a/roles/baremetal_provision/templates/user_data.j2 b/roles/baremetal_provision/templates/user_data.j2
new file mode 100644 (file)
index 0000000..16dbace
--- /dev/null
@@ -0,0 +1,34 @@
+Content-Type: multipart/mixed; boundary="===============9156907225490855809=="
+MIME-Version: 1.0
+
+--===============9156907225490855809==
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Disposition: attachment; filename
+
+#cloud-config
+disable_root: 0
+ssh_pwauth: 1
+cloud_init_modules: [migrator, bootcmd, write-files, update_etc_hosts, rsyslog, users-groups, ssh]
+preserve_hostname: true
+manage-resolv-conf: false
+users:
+  - name: "{{users.admin_user_name}}"
+    sudo: ['ALL=(ALL) NOPASSWD:ALL']
+    ssh-authorized-keys:
+      - "{{ lookup('file', ansible_env.PWD + '/.ssh/id_rsa.pub') }}"
+    passwd: {{users.admin_user_password}}
+    lock_passwd: False
+
+--===============9156907225490855809==
+Content-Type: text/cloud-boothook; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Disposition: attachment; filename="boothook.sh"
+
+#!/bin/bash
+mkdir -p /etc/os-net-config/
+echo '{{lookup('file', '/tmp/'+item[0].name+'_config.yaml')}}' > /etc/os-net-config/config.yaml
+/usr/bin/os-net-config
+--===============9156907225490855809==--