Skip to content
Snippets Groups Projects
Commit 4938fdaf authored by František Řezníček's avatar František Řezníček
Browse files

feat: hands-on steps

parent e4a07e8a
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ FROM ubuntu:jammy
# standard packages
RUN apt -y update && \
apt -y install vim git-core util-linux python3-minimal python3-pip sshuttle iptables bash-completion net-tools apt-transport-https software-properties-common gnupg2 curl openssh-client
apt -y install vim git-core util-linux python3-minimal python3-pip sshuttle iptables bash-completion net-tools apt-transport-https software-properties-common gnupg2 curl openssh-client ncat mc
# terraform
RUN curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > hashicorp.gpg && \
......
......@@ -2,6 +2,98 @@
Container for Metaseminar hands-on 2023-04-28
## Hands-on Horizon
You may need to have testing SSH key pair
```sh
SSH_KEYPAIR_DIR="${HOME}/.ssh/generated-keypair"
mkdir -p ${SSH_KEYPAIR_DIR}
chmod 700 ${SSH_KEYPAIR_DIR}
ssh-keygen -t rsa -b 4096 -f "${SSH_KEYPAIR_DIR}/id_rsa.demo"
ls -la ${SSH_KEYPAIR_DIR}/id_rsa.demo*
```
## Hands-on command-line client in group project
```sh
docker run -it --rm registry.gitlab.ics.muni.cz:443/246254/metaseminar-hands-on-2023-04-28/hands-on-tools:latest
>> source /tmp/ac/prod-metaseminar-hands-on-2023-04-28-openrc.sh.inc
>> openstack version show | grep identity
>> cd openstack-infrastructure-as-code-automation/clouds/g1/brno/meta-metaseminar-hands-on-2023-04-28/commandline/
>> ./cmdline-demo-group-project.sh freznicek-demo # use your own name as custom infrastructure prefix in the single hands-on project
```
## Hands-on terraform
```sh
# generate in-container ssh keypair
ssh-keygen -t rsa -b 4096
...
# read-in the openstack credentials
source /tmp/ac/prod-metaseminar-hands-on-2023-04-28-openrc.sh.inc
# enter terraform workspace
cd openstack-infrastructure-as-code-automation/clouds/g1/brno/meta-metaseminar-hands-on-2023-04-28/terraform_group_project/
# change infrastructure prefix
mcedit main.tf # kusername = freznicek
# initial deploy via terraform
terraform init
terraform validate
terraform plan --out plan
terraform apply plan
# login to VM
ncat -z <ip-address> 22
ssh ubuntu@<ip-address>
# doublecheck in horizon in meta-metaseminar-hands-on-2023-04-28 project
# https://dashboard.cloud.muni.cz
# scaling 1->3 VMs
# https://gitlab.ics.muni.cz/cloud/g2/openstack-infrastructure-as-code-automation/-/blob/8c66c1502f2cba26cf9dd51e89c118966ba5e6ed/clouds/g1/brno/meta-metaseminar-hands-on-2023-04-28/terraform_group_project/main.tf#L25
mcedit main.tf # nodes_count = 3
terraform validate
terraform plan --out plan
terraform apply plan
# doublecheck in horizon in meta-metaseminar-hands-on-2023-04-28 project
# https://dashboard.cloud.muni.cz
# delete VM via Horizon, and re-deploy via Horizon
# * point out idential internal IP address
terraform validate && terraform plan --out plan && terraform apply plan
# scaling 3->1 VMs
# https://gitlab.ics.muni.cz/cloud/g2/openstack-infrastructure-as-code-automation/-/blob/8c66c1502f2cba26cf9dd51e89c118966ba5e6ed/clouds/g1/brno/meta-metaseminar-hands-on-2023-04-28/terraform_group_project/main.tf#L25
mcedit main.tf # nodes_count = 1
terraform validate && terraform plan --out plan && terraform apply plan
# doublecheck in horizon in meta-metaseminar-hands-on-2023-04-28 project
# https://dashboard.cloud.muni.cz
# two disks /dev/sd[ab]
ssh ubuntu@<ip-address> 'lsblk'
# add additional volume (not enough data)
mcedit main.tf # sdc_volume = 1
terraform validate && terraform plan --out plan && terraform apply plan
# two disks /dev/sd[abc]
ssh ubuntu@<ip-address> 'lsblk'
# remove original volume
mcedit main.tf # sdb_volume = 0
terraform validate && terraform plan --out plan && terraform apply plan
# two disks /dev/sd[ac]
ssh ubuntu@<ip-address> 'lsblk'
# destroy whole infrastructure
terraform destroy
```
## Build image transcript
```sh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment