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

20 lines
709 B
Plaintext
Raw Normal View History

2019-01-22 12:10:16 +00:00
#cloud-config
users:
2019-01-25 18:04:04 +00:00
- name: {{ ansible_ssh_user }}
2019-01-22 12:10:16 +00:00
lock-passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
2019-01-22 14:28:46 +00:00
- {{ remote_user_ssh_pubkey }}
2019-01-22 12:10:16 +00:00
write_files:
2019-01-25 18:04:04 +00:00
- 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 }}
2019-01-22 12:10:16 +00:00
permissions: '0744'
runcmd:
2019-01-25 18:04:04 +00:00
- [ '/home/{{ ansible_ssh_user }}/cloud-init.sh' ]