1
0
Fork 0

Few changes for creating the jumps correctly

Signed-off-by: Arnaud M <arnaud.choupinette@mailops.fr>
This commit is contained in:
Arnaud M 2024-01-07 20:02:20 +01:00
parent 5c71a320eb
commit 7bfacd5880
2 changed files with 24 additions and 11 deletions

View File

@ -1,15 +1,21 @@
# E.G. to boot 20 instances
# Create jumps
```bash
openstack server create --user-data isen-postinstall.sh --min 20 --max 20 --flavor d2-4 --image 'Debian 11' --net Ext-Net --key-name arnaud-choupinette isen
c=20
openstack server create --user-data isen-postinstall.sh --min $c --max $c --flavor small --image 'Debian 12' --net public --key-name arnaud-choupinette isen
```
# Then copy/paste openrc files into the servers so that students can do
# List jumps
```bash
source /root/openrc
openstack server list -c Name -c Networks
```
# Clean the project, from k8s-1
# Delete jumps
```bash
openstack server list -c ID -c Name -f value | grep isen | awk '{print $1}' | xargs openstack server delete
```
# Clean the projects, from k8s-1
```bash
for o in $(ls -1 /root/openrc_is*) ; do

View File

@ -82,6 +82,18 @@ alias os=/opt/oscli/bin/openstack
alias k=kubectl
EOF
title.print "Create openrc file"
isen=$(cat /etc/hostname | tr -d '-')
cat <<EOF>>/root/openrc
export OS_USERNAME=${isen}_user1
export OS_PASSWORD=changeme
export OS_PROJECT_NAME=${isen}
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://keystone.54.36.119.253.xip.opensteak.fr/v3
export OS_IDENTITY_API_VERSION=3
export debian_chroot=${isen}_user1
EOF
title.print "Install docker"
@ -95,7 +107,7 @@ add-apt-repository \
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
title.print "Clone ansible-training"
title.print "Clone trainings"
cd /root/
git clone https://git.arnaudmorin.fr/arnaud/trainings.git
@ -105,11 +117,6 @@ title.print "Building docker image 'demo'"
cd /root/trainings/ansible/training/docker
docker build -t demo .
#NOTE(arnaud) commented because this is something I want the student to do
#title.print "Configuring nginx as reverse proxy"
#cp /root/ansible-training/conf/proxy.conf /etc/nginx/site-enabled/
#systemctl restart nginx
title.print "Starting demo container"
docker run -d --rm -p 127.0.0.2:8080:8080 -p 127.0.0.2:2222:22 --name demo demo