Skip to content
Snippets Groups Projects
Commit 941186d1 authored by Florentin Labelle's avatar Florentin Labelle
Browse files

Fix deployment

parent 00cbc19b
Branches
No related tags found
No related merge requests found
......@@ -4,9 +4,6 @@
1. Les faire papser
2. Figer le paps 10-15 mins avant le tp de déploiment
3. Exporter en csv
4. Mettre le résultat dans le paps.csv
5. Lancer le cloudinit.py
## Création des vms
......@@ -26,4 +23,11 @@
- `source openrc`
- récupérer les ips
- `openstack server list --project formation -f yaml | yq ".[].Networks.vm[1]"`
- les copier dans un fichier vscode, puis attribuer une vm à chaque mec en mode tu prends le numéro de ton paps et l'ip de la ligne associé.
- Appeler Marc-Antoine ou Quentin si ça marche pas
- les copier dans un fichier vscode, puis attribuer une vm à chaque mec en mode tu prends le numéro de son paps et l'ip de la ligne associé.
## Se connecter à une vm
- attendre 1-2 min que le cloud-init s'execute
- user: viazero
mdp: viazero
"""
Generate cloud-init configuration for the VMs.
"""
import crypt
cloudinit="""
#cloud-config
apt_upgrade: true
ssh_pwauth: 1
users:
"""
with open("paps.csv", encoding="utf-8") as file:
for line in file.readlines()[1:]:
login = line.split(";")[0][4:]
password = crypt.crypt(login, crypt.mksalt(crypt.METHOD_SHA256))
cloudinit += f"""
- name: {login}
primary_group: {login}
groups: users
lock_passwd: false
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
passwd: {password}
"""
with open("cloudinit.yaml", "w", encoding="utf-8") as file:
file.write(cloudinit)
#cloud-config
apt_upgrade: true
ssh_pwauth: 1
runcmd:
- apt install -y zsh curl python3-pip git ca-certificates fail2ban
- mkdir -p /etc/zsh
- git clone https://github.com/robbyrussell/oh-my-zsh.git /etc/zsh/.oh-my-zsh
- mkdir -p /etc/zsh/.oh-my-viarezo
- git clone https://gitlab.viarezo.fr/ViaRezo/oh-my-viarezo.git /etc/zsh/.oh-my-viarezo/themes/oh-my-viarezo
- git clone https://gitlab.viarezo.fr/ViaRezo/zsh-plugins.git /etc/zsh/.oh-my-viarezo/plugins
- curl https://gitlab.viarezo.fr/-/snippets/40/raw/main/zshrc > /etc/zsh/zshrc
- chsh -s /bin/zsh
- touch /root/.zshrc
- touch /home/viazero/.zshrc
users:
- name: viazero
primary_group: viazero
lock_passwd: false
shell: /bin/zsh
sudo: ALL=(ALL) NOPASSWD:ALL
passwd: $5$mPCaWrI78yDsgbTd$ipZkGn/CAuo4A9Y9fO21C6CcW2JmrzI100XD9xSCHE1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment