53 lines
1.2 KiB
Bash
Executable File
53 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Crea la base para la plantilla para kubernetes, borrando el machine-id y apagandola
|
|
# Despues usar qm template para convertirla
|
|
#
|
|
|
|
USER="curso"
|
|
PASSWORD="1"
|
|
PASSWORD_HASH=$(openssl passwd -6 "$PASSWORD")
|
|
PUB_KEY=$(cat ~/.ssh/id_rsa.pub)
|
|
VMHOST="k8scp"
|
|
|
|
cat <<EOF > /mnt/pve/VMs_storage-E/snippets/user_data-clonar.yaml
|
|
#cloud-config
|
|
|
|
system_info:
|
|
default_user:
|
|
name: $USER
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
shell: /bin/bash
|
|
lock_passwd: false
|
|
passwd: $PASSWORD_HASH
|
|
# passwd: \$6\$ogQI1CDWE.wdcMWI\$6kIrEjVBNC5.YxxFwBY9CxFGnIg1SDhndG4niMn5Sz11NNqay4icJS4AAddY6WbcM7LZJsLzwiYeUCLq2ddmL0
|
|
ssh_authorized_keys:
|
|
- $PUB_KEY
|
|
ssh_pwauth: true
|
|
hostname: $VMHOST
|
|
manage_etc_hosts: true
|
|
fqdn: $VMHOST
|
|
write_files:
|
|
- path: /etc/netplan/50-cloud-init.yaml
|
|
content: |
|
|
network:
|
|
version: 2
|
|
renderer: networkd
|
|
ethernets:
|
|
default:
|
|
match:
|
|
name: e*
|
|
dhcp4: yes
|
|
dhcp-identifier: mac
|
|
|
|
runcmd:
|
|
- cd /root
|
|
- git clone https://git.lfgut.duckdns.org/luis/infra_cloudinit.git
|
|
- cd infra_cloudinit
|
|
# - ./k8s.sh
|
|
EOF
|
|
|
|
echo "Archivo user_data.yaml creado con éxito."
|
|
|
|
|