diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..e6df6ff --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,29 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +NNODES=2 + +$script = <<-SCRIPT +echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQClVS1uxDfwS6OusQ4qgcZ6hBc8YRBE8MyXu0sUfGN7S3itjI3W2ixD18v80el8dVQVR12jCY0ueavgoV1cHrfGWkFoLKi+QrA4MuSNUChj0NBbyLTmdwPvne8LRv3ttCbRSJ/6bIEveX8y/7kGn/R1NDFlfE6b5R8ersBUKCQM6YxblAkv/XH8cJlQXhr1nLhVOl/ae+Q/pTCbgioB8qrmGEuMvOLmavcFf7IJbJcSgeiXSOnyIRl2n64X6lbRK+MRZ61pF6vAOXA+Ixyt/fAbO7sjqU0+cEhU5Br5/VcqG4Bc5nhWimtXIHPry3aLV5PtN6K9/i3eA5F6Jpa82JzmUMEbWSBIga02yIw9GjRyAI6ccH/kJGuB6QN5/YwGHpOF2f0FGiEAbUz41mLngN3SsXL1pdV2hT3x56/GIcGe6p/f1cytwVCyOaE7W87B05w5JYb1sSFj6QuGW0rHWfnHT5SY87Mk/H8VgZPaPbm+hSjLIQRAmUYQR+Rub1o9bXE=" >> /home/vagrant/.ssh/authorized_keys +SCRIPT + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + (0..NNODES - 1).each do |i| + config.vm.define "k8s-ubuntu-#{i}" do |node| + #node.vm.box = "ubuntu/focal64" + node.vm.box = "ubuntu/jammy64" + node.vm.hostname = "k8s-ubuntu-#{i}" + config.vm.provider "virtualbox" do |v| + v.memory = 2048 + v.cpus = 2 + end + node.vm.network "private_network", ip: "192.168.25.11#{i}" + node.vm.provision "shell", inline: $script + node.vm.provision "shell", inline: "echo hello from node #{i}" + end + end +end \ No newline at end of file diff --git a/group_vars/kubernetes.yml b/group_vars/kubernetes.yml new file mode 100644 index 0000000..28636f4 --- /dev/null +++ b/group_vars/kubernetes.yml @@ -0,0 +1,12 @@ +--- + +disable_firewall: true +kubernetes_subnet: 192.168.25.0/24 + +# vip control plan 192.168.25.255 +setup_vip: false +install_nginx_ingress: false +install_longhorn: false + +# This variable is used when the cluster is bootstrapped for the first time +kubernetes_init_host: k8s-ubuntu-0 \ No newline at end of file diff --git a/hosts b/hosts index 6a46c7c..b28ac89 100644 --- a/hosts +++ b/hosts @@ -1,6 +1,20 @@ -[perso] -ovh_fr ansible_host=37.187.127.90 ansible_user=stephane -scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane +# Test VM vagrant +[kubernetes:children] +kubemaster +kubeworker + +[kubemaster] +k8s-ubuntu-0 ansible_host=192.168.25.110 + +[kubeworker] +k8s-ubuntu-1 ansible_host=192.168.25.111 + + + + +; [perso] +; ovh_fr ansible_host=37.187.127.90 ansible_user=stephane +; scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane ; # TO KNOW WHOIS CHISEL SERVER ; [server] @@ -20,13 +34,4 @@ scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane ; ubuntu-worker ansible_host=192.168.33.11 ansible_user=vagrant ansible_password=vagrant -#kubectl label node ubuntu-worker node-role.kubernetes.io/worker ubuntu-worker - - -; curl -v -X POST \ -; -H "Content-Type: application/json" \ -; -d '{ -; "auth": "admin", -; "password": "test" -; }' \ -; https://semaphore.jingoh.fr/auth/login \ No newline at end of file +#kubectl label node ubuntu-worker node-role.kubernetes.io/worker ubuntu-worker \ No newline at end of file diff --git a/kubernetes.yml b/kubernetes.yml new file mode 100644 index 0000000..15efffc --- /dev/null +++ b/kubernetes.yml @@ -0,0 +1,27 @@ +--- +- name: Main playbook for Kubernetes cluster + hosts: kubernetes + become: true + remote_user: vagrant + + roles: + - { role: ansible-role-linux-kubernetes } + + + +# --- +# - hosts: kubemaster +# become: yes +# remote_user: vagrant +# roles: +# - role: ansible-role-linux-kubernetes +# vars_files: +# - vars.yaml + +# - hosts: kubeworker +# become: yes +# remote_user: vagrant +# roles: +# - role: ansible-role-linux-kubernetes +# vars_files: +# - vars.yaml \ No newline at end of file diff --git a/papa b/papa deleted file mode 100644 index cc6dc85..0000000 --- a/papa +++ /dev/null @@ -1 +0,0 @@ -papa diff --git a/roles/.gitignore b/roles/.gitignore index b711f0e..898d10d 100644 --- a/roles/.gitignore +++ b/roles/.gitignore @@ -10,6 +10,7 @@ geerlingguy.kubernetes/ geerlingguy.pip/ geerlingguy.containerd/ tumf.systemd-service/ +ansible-role-linux-kubernetes/ # SSH client side linux-system-roles.ssh/ # SSH server side diff --git a/roles/requirements.yml b/roles/requirements.yml index db8a568..624bcaa 100644 --- a/roles/requirements.yml +++ b/roles/requirements.yml @@ -6,7 +6,10 @@ - src: GROG.sudo # DOCKER - src: geerlingguy.docker +# CONTAINERD - src: geerlingguy.containerd +# KUBERNETES +- src: git+https://github.com/garutilorenzo/ansible-role-linux-kubernetes.git - src: geerlingguy.kubernetes # PIP - src: geerlingguy.pip