drops revisó este gist 4 months ago. Ir a la revisión
1 file changed, 1 insertion, 1 deletion
gistfile1.md
| @@ -16,7 +16,7 @@ sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' | |||
| 16 | 16 | * Cleanup VM for template | |
| 17 | 17 | ```bash | |
| 18 | 18 | # cleanup current ssh keys so templated VMs get fresh key | |
| 19 | - | sudo rm -f /etc/ssh/ssh_host_* | |
| 19 | + | rm -f /etc/ssh/ssh_host_* | |
| 20 | 20 | ``` | |
| 21 | 21 | ```bash | |
| 22 | 22 | # add check for ssh keys on reboot...regenerate if neccessary | |
drops revisó este gist 4 months ago. Ir a la revisión
1 file changed, 4 insertions, 4 deletions
gistfile1.md
| @@ -10,15 +10,15 @@ apt upgrade -y | |||
| 10 | 10 | usermod -aG sudo administrator | |
| 11 | 11 | ``` | |
| 12 | 12 | * Allow sudo without password | |
| 13 | - | ``` | |
| 13 | + | ```bash | |
| 14 | 14 | sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' | |
| 15 | 15 | ``` | |
| 16 | 16 | * Cleanup VM for template | |
| 17 | - | ``` | |
| 17 | + | ```bash | |
| 18 | 18 | # cleanup current ssh keys so templated VMs get fresh key | |
| 19 | 19 | sudo rm -f /etc/ssh/ssh_host_* | |
| 20 | 20 | ``` | |
| 21 | - | ``` | |
| 21 | + | ```bash | |
| 22 | 22 | # add check for ssh keys on reboot...regenerate if neccessary | |
| 23 | 23 | tee /etc/rc.local >/dev/null <<EOL | |
| 24 | 24 | #!/bin/sh -e | |
| @@ -41,7 +41,7 @@ EOL | |||
| 41 | 41 | # make the script executable | |
| 42 | 42 | chmod +x /etc/rc.local | |
| 43 | 43 | ``` | |
| 44 | - | ``` | |
| 44 | + | ```bash | |
| 45 | 45 | # cleanup apt | |
| 46 | 46 | apt clean | |
| 47 | 47 | ||
drops revisó este gist 4 months ago. Ir a la revisión
1 file changed, 2 insertions, 2 deletions
gistfile1.md
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | apt update | |
| 5 | 5 | apt install open-vm-tools aptitude vim htop sudo -y | |
| 6 | 6 | apt upgrade -y | |
| 7 | - | ```bash | |
| 8 | - | * Add user to sudo group (in my scenario used for ansible) | |
| 9 | 7 | ``` | |
| 8 | + | * Add user to sudo group (in my scenario used for ansible) | |
| 9 | + | ```bash | |
| 10 | 10 | usermod -aG sudo administrator | |
| 11 | 11 | ``` | |
| 12 | 12 | * Allow sudo without password | |
drops revisó este gist 4 months ago. Ir a la revisión
1 file changed, 60 insertions, 1 deletion
gistfile1.md
| @@ -1,2 +1,61 @@ | |||
| 1 | 1 | * Install Debian | |
| 2 | - | * Update and install necessary packages (or needed in template) | |
| 2 | + | * Update and install necessary packages (or needed in template) | |
| 3 | + | ```bash | |
| 4 | + | apt update | |
| 5 | + | apt install open-vm-tools aptitude vim htop sudo -y | |
| 6 | + | apt upgrade -y | |
| 7 | + | ```bash | |
| 8 | + | * Add user to sudo group (in my scenario used for ansible) | |
| 9 | + | ``` | |
| 10 | + | usermod -aG sudo administrator | |
| 11 | + | ``` | |
| 12 | + | * Allow sudo without password | |
| 13 | + | ``` | |
| 14 | + | sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' | |
| 15 | + | ``` | |
| 16 | + | * Cleanup VM for template | |
| 17 | + | ``` | |
| 18 | + | # cleanup current ssh keys so templated VMs get fresh key | |
| 19 | + | sudo rm -f /etc/ssh/ssh_host_* | |
| 20 | + | ``` | |
| 21 | + | ``` | |
| 22 | + | # add check for ssh keys on reboot...regenerate if neccessary | |
| 23 | + | tee /etc/rc.local >/dev/null <<EOL | |
| 24 | + | #!/bin/sh -e | |
| 25 | + | # | |
| 26 | + | # rc.local | |
| 27 | + | # | |
| 28 | + | # This script is executed at the end of each multiuser runlevel. | |
| 29 | + | # Make sure that the script will "" on success or any other | |
| 30 | + | # value on error. | |
| 31 | + | # | |
| 32 | + | # In order to enable or disable this script just change the execution | |
| 33 | + | # bits. | |
| 34 | + | # | |
| 35 | + | ||
| 36 | + | # By default this script does nothing. | |
| 37 | + | test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server | |
| 38 | + | exit 0 | |
| 39 | + | EOL | |
| 40 | + | ||
| 41 | + | # make the script executable | |
| 42 | + | chmod +x /etc/rc.local | |
| 43 | + | ``` | |
| 44 | + | ``` | |
| 45 | + | # cleanup apt | |
| 46 | + | apt clean | |
| 47 | + | ||
| 48 | + | # reset the machine-id (DHCP leases in 18.04 are generated based on this... not MAC...) | |
| 49 | + | echo "" | sudo tee /etc/machine-id >/dev/null | |
| 50 | + | ||
| 51 | + | # disable swap | |
| 52 | + | swapoff --all | |
| 53 | + | sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab | |
| 54 | + | ||
| 55 | + | # cleanup shell history and shutdown for templating | |
| 56 | + | history -c | |
| 57 | + | history -w | |
| 58 | + | shutdown -h now | |
| 59 | + | ``` | |
| 60 | + | * Mark VM as a Template | |
| 61 | + | * Test with Terraform | |
drops revisó este gist 4 months ago. Ir a la revisión
1 file changed, 2 insertions
gistfile1.md(archivo creado)
| @@ -0,0 +1,2 @@ | |||
| 1 | + | * Install Debian | |
| 2 | + | * Update and install necessary packages (or needed in template) | |