terraform-k8s/roles/terraform/files/cloud-init.cfg.j2

21 lines
712 B
Django/Jinja

#cloud-config
users:
- name: {{ remote_user }}
lock-passwd: false
passwd: {{ remote_user_pass }}
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- {{ remote_user_ssh_pubkey }}
write_files:
- content: |
#!/bin/bash
# inet6_addr=$(ip a s | grep "inet6 2001:470:6d:22c:" | awk '{print substr($2,0)}')
sudo hostnamectl set-hostname {{ item.hostname }}
sudo ip -6 addr add {{ item.ipv6 }}/64 dev eth0
sudo chown -R {{ remote_user }}:{{ remote_user }} /home/{{ remote_user }}
path: /home/{{ remote_user }}/cloud-init.sh
owner: {{ remote_user }}:{{ remote_user }}
permissions: '0744'
runcmd:
- [ '/home/{{ remote_user }}/cloud-init.sh' ]