TP-IaC-Ansible/ansible/cloud-config-gen.sh

15 lines
338 B
Bash
Executable File

#!/bin/bash
#
# Script to generate a cloud-config file with a custom user and the script user SSH public key as authorized key
#
cat << EOF > cloud-init-conf.yml
#cloud-config
users:
- name: ansuser
ssh-authorized-keys:
- $(cat ~/.ssh/id_rsa.pub)
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
EOF