Created
March 15, 2017 14:46
-
-
Save ser/1d214423c7387d9c7528a8c1df71c6f3 to your computer and use it in GitHub Desktop.
lxd deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 | |
# | |
#set -x | |
# Create LXD container | |
# | |
if [ $# -eq 0 ] | |
then | |
echo "dolxd \$NAME \$IP \$GW" | |
echo "dolxd kupa 10.33.1.1 10.33.0.1" | |
exit | |
fi | |
###### VARS | |
NAME=$1 | |
IP_4=$2 | |
GW=$3 | |
E="lxc exec $NAME --" | |
FP="lxc file push" | |
DNS=77.88.8.8 | |
NM=255.0.0.0 | |
HA="/home/head/HEAD" | |
# NETWORK CONFIG | |
NC="#cloud-config | |
version: 1 | |
config: | |
- type: physical | |
name: eth0 | |
subnets: | |
- type: static | |
ipv4: true | |
address: $IP_4 | |
netmask: 255.0.0.0 | |
gateway: $GW | |
control: auto | |
- type: nameserver | |
address: $DNS | |
" | |
# USER CONFIG | |
UC="#cloud-config | |
users: | |
- name: root | |
gecos: root | |
primary-group: root | |
groups: root | |
home: /root | |
ssh_authorized_keys: | |
- ssh-ed25519 AAAA ser@kupa | |
packages: | |
- exuberant-ctags | |
package_upgrade: true | |
runcmd: | |
- [ /usr/bin/apt-get, -y, purge, nano ] | |
- [ /usr/bin/apt-get, -y, autoremove ] | |
- [ /usr/bin/git, clone, --depth=1, 'https://github.com/Bash-it/bash-it.git', /root/.bash_it ] | |
- [ /usr/bin/git, clone, --depth=1, 'https://github.com/junegunn/fzf.git', /root/.fzf ] | |
- [ /bin/su, -, -c, '~/.fzf/install --all', root ] | |
- [ /bin/su, -, -c, '~/.bash_it/install.sh --silent', root ] | |
- [ /bin/su, -, -c, 'bash-it enable plugin todo python ssh history git edit-mode-vi explain extract fzf fasd hub git history', root ] | |
- [ /bin/su, -, -c, 'bash-it enable alias apt clipboard curl git vim', root ] | |
- [ /bin/su, -, -c, 'bash-it enable completion all', root ] | |
- [ /bin/su, -, -c, 'bash-it disable completion conda', root ] | |
- [ /bin/su, -, -c, 'curl https://raw.githubusercontent.com/ser/varia/master/dot-bashrc.lxd -o ~/.bashrc', root ] | |
- [ /bin/su, -c, 'curl -o /tmp/setup.sh https://raw.githubusercontent.com/kepbod/ivim/master/setup.sh', root ] | |
- [ /bin/su, -c, 'bash /tmp/setup.sh -m', root ] | |
- [ /bin/su, -c, 'rm -f /tmp/setup.sh', root ] | |
" | |
###### create and deploy for ansible | |
lxc launch ubuntu: $NAME -c user.network-config="$NC" -c user.user-data="$UC" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment