mirror of
https://github.com/hak8or/proxmox_scripts.git
synced 2025-01-15 11:57:57 +00:00
deploy script almost done! :D
This commit is contained in:
parent
1890f3fb43
commit
a741cde852
@ -18,7 +18,7 @@ pacman-key --populate archlinux
|
|||||||
# with USA and worldwide mirrors but eh.
|
# with USA and worldwide mirrors but eh.
|
||||||
echo "----> Setting up mirror list"
|
echo "----> Setting up mirror list"
|
||||||
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
||||||
cat > /etc/pacman.d/mirrorlist <<-`EOM05594313219813`
|
cat <<- 'EOM05594313219813' > /etc/pacman.d/mirrorlist
|
||||||
# Server list generated by rankmirrors on 2017-11-03
|
# Server list generated by rankmirrors on 2017-11-03
|
||||||
##
|
##
|
||||||
## Arch Linux repository mirrorlist
|
## Arch Linux repository mirrorlist
|
||||||
@ -32,7 +32,8 @@ cat > /etc/pacman.d/mirrorlist <<-`EOM05594313219813`
|
|||||||
Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch
|
Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch
|
||||||
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
|
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
|
||||||
Server = http://mirror.math.princeton.edu/pub/archlinux/$repo/os/$arch
|
Server = http://mirror.math.princeton.edu/pub/archlinux/$repo/os/$arch
|
||||||
`EOM05594313219813`
|
EOM05594313219813
|
||||||
|
cat /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
# Do an update and install some packages.
|
# Do an update and install some packages.
|
||||||
echo "----> Updating and installing base-devel, git, htop, vim, and cowsay"
|
echo "----> Updating and installing base-devel, git, htop, vim, and cowsay"
|
||||||
|
38
deploy.sh
38
deploy.sh
@ -57,8 +57,42 @@ if [[ $1 == "-ID" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure SSH public key is in proxmox host. This overwrites if it exists.
|
||||||
|
scp $HOME/.ssh/id_rsa.pub root@$PROXMOX_IP_ADDR:/tmp/id_rsa.pub > /dev/null
|
||||||
|
|
||||||
# No specific container was provided, so we create one.
|
# No specific container was provided, so we create one.
|
||||||
# Can pass small script like this: https://stackoverflow.com/a/3872762/516959
|
# Can pass small script like this: https://stackoverflow.com/a/3872762/516959
|
||||||
ssh root@$PROXMOX_IP_ADDR /usr/bin/env bash <<-'AcRP030CAlfad6'
|
VMID=$(ssh root@$PROXMOX_IP_ADDR /usr/bin/env bash <<-'AcRP030CAlfad6'
|
||||||
echo "Hello world! :D"
|
# use the highest VMID+1 as our new VMID. This returns 1 if no VMID's exist.
|
||||||
|
VMID=$(pct list | awk 'NR > 1 {print $1}' | sort -nr | head -n1)
|
||||||
|
VMID=$(($VMID + 1))
|
||||||
|
|
||||||
|
# VMID's less than 100 are for internal proxmox use, make sure we are >= 100.
|
||||||
|
# This also could mean there were no proxmox boxes created.
|
||||||
|
if [[ $VMID -lt 100 ]]; then
|
||||||
|
VMID=100
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a new container with the VMID
|
||||||
|
pct create $VMID /var/lib/vz/template/cache/archlinux-base_20170704-1_amd64.tar.gz -ssh-public-keys /tmp/id_rsa.pub -storage local-zfs -net0 name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp -ostype archlinux > /dev/null
|
||||||
|
|
||||||
|
# Start the container.
|
||||||
|
pct start $VMID > /dev/null
|
||||||
|
|
||||||
|
# And say all went well.
|
||||||
|
echo "$VMID"
|
||||||
AcRP030CAlfad6
|
AcRP030CAlfad6
|
||||||
|
)
|
||||||
|
echo "Completed Container Init, ID: $VMID"
|
||||||
|
|
||||||
|
# Send our default arch init script over to proxmox host. This overwrites any old file.
|
||||||
|
scp arch_setup.sh root@$PROXMOX_IP_ADDR:/tmp/arch_setup.sh > /dev/null
|
||||||
|
|
||||||
|
# Copy the script into the container and run it.
|
||||||
|
ssh root@$PROXMOX_IP_ADDR /usr/bin/env bash <<- AcRP030CAlfad6
|
||||||
|
pct push $VMID /tmp/arch_setup.sh /tmp/arch_setup.sh > /dev/null
|
||||||
|
pct exec $VMID chmod +x /tmp/arch_setup.sh
|
||||||
|
pct exec $VMID /tmp/arch_setup.sh
|
||||||
|
AcRP030CAlfad6
|
||||||
|
|
||||||
|
echo "Deploy.sh Complete!"
|
||||||
|
Loading…
Reference in New Issue
Block a user