Skip to content

Commit

Permalink
ci(vagrant): init
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeptossss committed Dec 2, 2023
1 parent 490bb9b commit fd72dd8
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
50 changes: 50 additions & 0 deletions deploy/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Variables
# Image à utiliser
IMAGE_NAME = "bento/ubuntu-20.04"
# RAM
MEM = 2048
# Nombre de CPU
CPU = 2
# Nombre de noeuds
WORKER_NB = 1
# Prefix pour la plage d'adresses IP à utiliser
NODE_NETWORK_BASE = "10.0.0"
# Master IP
MASTER_IP = "#{NODE_NETWORK_BASE}.10"

Vagrant.configure("2") do |config|
config.ssh.insert_key = true

# Configuration de la RAM et du CPU
config.vm.provider "virtualbox" do |v|
v.gui = false
v.memory = MEM
v.cpus = CPU
end

# Configuration du Master
config.vm.define "k8s-master" do |master|
master.vm.box = IMAGE_NAME
master.vm.network "private_network", ip: MASTER_IP
master.vm.hostname = "k8s-master"
end

# Configuration du/des Worker(s)
(1..WORKER_NB).each do |i|
config.vm.define "k8s-worker#{i}" do |worker|
worker.vm.box = IMAGE_NAME
worker.vm.network "private_network", ip: "#{NODE_NETWORK_BASE}.#{i + 10}"
worker.vm.hostname = "k8s-worker#{i}"
end
end

config.vm.provision "ansible" do |ansible|
ansible.playbook = "site.yml"
ansible.groups = {
"master" => ["k8s-master"],
"worker" => ["k8s-worker[1:#{WORKER_NB}]"],
"kube_cluster:children" => ["master", "worker"],
"kube_cluster:vars" => { "master_ip" => MASTER_IP }
}
end
end
11 changes: 11 additions & 0 deletions deploy/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[defaults]
roles_path = ./roles
inventory = ./hosts.ini

remote_tmp = $HOME/.ansible/tmp
local_tmp = $HOME/.ansible/tmp
pipelining = True
become = True
host_key_checking = False
deprecation_warnings = False
callback_whitelist = profile_tasks
24 changes: 24 additions & 0 deletions deploy/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- hosts: kube_cluster
gather_facts: yes
become: yes
roles:
- { role: commons/os-checker, tags: commons }
- { role: commons/package-update, tags: commons }
- { role: ntp, tags: ntp }
- { role: locale, tags: locale }
- { role: containerd, tags: containerd }
- { role: commons/pre-install, tags: commons }

- hosts: master
gather_facts: yes
become: yes
roles:
- { role: kubernetes/master, tags: master }
- { role: cni, tags: cni }

- hosts: worker
gather_facts: yes
become: yes
roles:
- { role: kubernetes/node, tags: node }
2 changes: 1 addition & 1 deletion scripts/installation/jenkins.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
printf "Installing jenkins"
helm install whanos /whanos/kube/helm/whanos --create-namespace --namespace whanos
helm install whanos kube/helm/whanos --create-namespace --namespace whanos
printf "Installed jenkins ✅"

0 comments on commit fd72dd8

Please sign in to comment.