terraform-k8s/roles/terraform/templates/cloud-init.cfg.j2
2019-02-04 13:22:51 +01:00

20 lines
709 B
Django/Jinja

#cloud-config
users:
- name: {{ ansible_ssh_user }}
lock-passwd: false
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 {{ ansible_ssh_user }}:{{ ansible_ssh_user }} /home/{{ ansible_ssh_user }}
path: /home/{{ ansible_ssh_user }}/cloud-init.sh
owner: {{ ansible_ssh_user }}:{{ ansible_ssh_user }}
permissions: '0744'
runcmd:
- [ '/home/{{ ansible_ssh_user }}/cloud-init.sh' ]