add k8s/manual folder

This commit is contained in:
Pavel Umansky 2026-04-22 18:58:52 +02:00
parent 360b8d4f0e
commit b5c8b10e6f
57 changed files with 730 additions and 0 deletions

View File

@ -0,0 +1 @@
{"dependencies":[["racc",["~> 1.4"]],["nokogiri",["~> 1.6"]],["diffy",[">= 0"]],["rexml",[">= 0"]],["xml-simple",[">= 0"]],["logger",[">= 0"]],["mime-types-data",["~> 3.2025",">= 3.2025.0507"]],["mime-types",[">= 0"]],["io-console",["~> 0.5"]],["reline",[">= 0"]],["formatador",[">= 0.2","< 2.0"]],["excon",["~> 1.0"]],["builder",[">= 0"]],["fog-core",["~> 2"]],["ruby-libvirt",[">= 0.7.0"]],["json",[">= 0"]],["fog-xml",["~> 0.1.1"]],["multi_json",["~> 1.10"]],["fog-json",[">= 0"]],["fog-libvirt",[">= 0.6.0"]],["vagrant-libvirt",["= 0.12.2"]]],"checksum":"b69e3c206e3d26fb25b062fbb15a80865764c5efb5e9cce85cfac1f745449033","vagrant_version":"2.4.9"}

View File

@ -0,0 +1 @@
1.5:fb1ee880-af31-47e4-8257-9b6942229d85

View File

@ -0,0 +1 @@
{"name":"generic/ubuntu2204","version":"4.3.12","provider":"libvirt","directory":"boxes/generic-VAGRANTSLASH-ubuntu2204/4.3.12/amd64/libvirt"}

View File

@ -0,0 +1,16 @@
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
fb1ee880-af31-47e4-8257-9b6942229d85

View File

@ -0,0 +1 @@
021e3e0b226f406aac0bd39cd4969856

View File

@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAA
AAtzc2gtZWQyNTUxOQAAACBS02VuYXy2eHhr3mUHj91WhrbQRF62QC5ulUeR
IK46KAAAAJD85A88/OQPPAAAAAtzc2gtZWQyNTUxOQAAACBS02VuYXy2eHhr
3mUHj91WhrbQRF62QC5ulUeRIK46KAAAAEBXYMaWzuG4tZdGHqPkk3q8jKE1
NfvBVHJutsnBhtUTEFLTZW5hfLZ4eGveZQeP3VaGttBEXrZALm6VR5Egrjoo
AAAAB3ZhZ3JhbnQBAgMEBQY=
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
/home/pavel/K8s_project/k8s_manual

View File

@ -0,0 +1 @@
1.5:e31b6a83-be42-4a1f-8afa-1241262e96df

View File

@ -0,0 +1 @@
{"name":"generic/ubuntu2204","version":"4.3.12","provider":"libvirt","directory":"boxes/generic-VAGRANTSLASH-ubuntu2204/4.3.12/amd64/libvirt"}

View File

@ -0,0 +1,16 @@
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
e31b6a83-be42-4a1f-8afa-1241262e96df

View File

@ -0,0 +1 @@
29daa6b87e3c4d6d90102d3ac373caae

View File

@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAA
AAtzc2gtZWQyNTUxOQAAACBaK+qV9FCXssfPTv8IqW5VbEOOedFnsVP4MVrp
9qKQdAAAAJDqn/Ty6p/08gAAAAtzc2gtZWQyNTUxOQAAACBaK+qV9FCXssfP
Tv8IqW5VbEOOedFnsVP4MVrp9qKQdAAAAEBzm/9P82nTcicTfT0y+Ni3iPwE
c+AMggac/Ni1eDipeFor6pX0UJeyx89O/wipblVsQ4550WexU/gxWun2opB0
AAAAB3ZhZ3JhbnQBAgMEBQY=
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
/home/pavel/K8s_project/k8s_manual

View File

@ -0,0 +1 @@
1.5:4bf079f3-c084-4087-a83f-97a585c3d705

View File

@ -0,0 +1 @@
{"name":"generic/ubuntu2204","version":"4.3.12","provider":"libvirt","directory":"boxes/generic-VAGRANTSLASH-ubuntu2204/4.3.12/amd64/libvirt"}

View File

@ -0,0 +1,16 @@
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604
a4ec2c9f-4014-4a68-a3a4-2a944bce1750
68e2412b-1309-40a6-98f9-e7274b6a0604

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
4bf079f3-c084-4087-a83f-97a585c3d705

View File

@ -0,0 +1 @@
87c47bfa3e15444fb3943a829ffac979

View File

@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAA
AAtzc2gtZWQyNTUxOQAAACDVc9ubngiOpSM6dPy43qqtGWfoM4wg3G+cp+3g
OVE3ZgAAAJC/UjXAv1I1wAAAAAtzc2gtZWQyNTUxOQAAACDVc9ubngiOpSM6
dPy43qqtGWfoM4wg3G+cp+3gOVE3ZgAAAECQ0UWHxmdvU+y4URXN7VJvOLco
IqGP55L4DDr0WIC5hNVz25ueCI6lIzp0/Ljeqq0ZZ+gzjCDcb5yn7eA5UTdm
AAAAB3ZhZ3JhbnQBAgMEBQY=
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
/home/pavel/K8s_project/k8s_manual

View File

@ -0,0 +1,12 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

20
z2/k8s_manual/Vagrantfile vendored Normal file
View File

@ -0,0 +1,20 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204"
nodes = [
{ name: "master", ip: "192.168.56.10", mem: 3072, cpus: 2 },
{ name: "worker-1", ip: "192.168.56.11", mem: 3072, cpus: 2 },
{ name: "worker-2", ip: "192.168.56.12", mem: 3072, cpus: 2 }
]
nodes.each do |node|
config.vm.define node[:name] do |n|
n.vm.hostname = node[:name]
n.vm.network "private_network", ip: node[:ip], libvirt__forward_mode: "nat"
n.vm.provider :libvirt do |v|
v.memory = node[:mem]
v.cpus = node[:cpus]
end
end
end
end

View File

@ -0,0 +1,3 @@
[defaults]
inventory = inventory.ini
host_key_checking = False

View File

@ -0,0 +1,11 @@
[master]
master ansible_host=192.168.56.10
[workers]
worker-1 ansible_host=192.168.56.11
worker-2 ansible_host=192.168.56.12
[all:vars]
ansible_user=vagrant
ansible_ssh_private_key_file=.vagrant/machines/{{ inventory_hostname }}/libvirt/private_key
ansible_ssh_common_args='-o StrictHostKeyChecking=no'

View File

@ -0,0 +1,18 @@
---
- name: Prepare K8s nodes
hosts: all
become: true
roles:
- common
- name: Configure Master node
hosts: master
become: true
roles:
- master
- name: Configure Worker nodes
hosts: workers
become: true
roles:
- worker

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,30 @@
---
k8s_version: "1.31"
k8s_package_version: "1.31.14-1.1"
k8s_kernel_modules:
- overlay
- br_netfilter
k8s_sysctl_params:
- { name: "net.bridge.bridge-nf-call-iptables", value: "1" }
- { name: "net.bridge.bridge-nf-call-ip6tables", value: "1" }
- { name: "net.ipv4.ip_forward", value: "1" }
k8s_required_packages:
- containerd
- conntrack
- socat
- apt-transport-https
- curl
k8s_packages:
- kubelet
- kubeadm
- kubectl
containerd_config_path: /etc/containerd/config.toml
k8s_gpg_key_url: "https://pkgs.k8s.io/core:/stable:/v{{ k8s_version }}/deb/Release.key"
k8s_gpg_keyring: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
k8s_repo: "deb [signed-by={{ k8s_gpg_keyring }}] https://pkgs.k8s.io/core:/stable:/v{{ k8s_version }}/deb/ /"

View File

@ -0,0 +1,4 @@
---
# handlers file for common
- name: Restart Containerd
service: name=containerd state=restarted

View File

@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,84 @@
---
- name: Disable SWAP
shell: |
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
- name: Mask swap.target to prevent swap after reboot
systemd:
name: swap.target
masked: yes
- name: Load kernel modules
modprobe:
name: "{{ item }}"
state: present
loop: "{{ k8s_kernel_modules }}"
- name: Persist kernel modules across reboots
copy:
dest: /etc/modules-load.d/k8s.conf
content: "{% for mod in k8s_kernel_modules %}{{ mod }}\n{% endfor %}"
- name: Set sysctl parameters
sysctl:
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
sysctl_file: /etc/sysctl.d/k8s.conf
reload: yes
loop: "{{ k8s_sysctl_params }}"
- name: Install containerd & utils
apt:
name: "{{ k8s_required_packages }}"
state: present
update_cache: yes
- name: Check if containerd is already configured
stat:
path: "{{ containerd_config_path }}"
register: containerd_config
- name: Generate default containerd config
shell: |
mkdir -p /etc/containerd
containerd config default > {{ containerd_config_path }}
when: not containerd_config.stat.exists
notify: Restart Containerd
- name: Enable systemdCgroup in containerd
replace:
path: "{{ containerd_config_path }}"
regexp: "SystemdCgroup = false"
replace: "SystemdCgroup = true"
notify: Restart Containerd
- name: Download K8s GPG key
get_url:
url: "{{ k8s_gpg_key_url }}"
dest: "{{ k8s_gpg_keyring | regex_replace('.gpg$', '.asc') }}"
mode: "0644"
- name: Dearmor K8s GPG key
shell: "gpg --dearmor -o {{ k8s_gpg_keyring }} {{ k8s_gpg_keyring | regex_replace('.gpg$', '.asc') }}"
args:
creates: "{{ k8s_gpg_keyring }}"
- name: Add K8s repository
apt_repository:
repo: "{{ k8s_repo }}"
state: present
filename: kubernetes
- name: Install K8s tools
apt:
name: "{{ k8s_packages | map('regex_replace', '$', '=' + k8s_package_version) | list }}"
state: present
update_cache: yes
- name: Hold K8s packages at current version
dpkg_selections:
name: "{{ item }}"
selection: hold
loop: "{{ k8s_packages }}"

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- common

View File

@ -0,0 +1,2 @@
---
# vars file for common

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,20 @@
---
# defaults file for master
master_apiserver_address: "192.168.56.10"
master_pod_network_cidr: "10.244.0.0/16"
master_user: vagrant
flannel_manifest_url: "https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml"
metrics_server_manifest_url: "https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml"
metrics_server_insecure_tls: true
metrics_server_ready_retries: 20
metrics_server_ready_delay: 10
master_remove_taint: true
argocd_manifest_url: "https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml"
local_path_provisioner_url: "https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.35/deploy/local-path-storage.yaml"
install_helm: "https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4"
git_repo_url: "https://github.com/miracleqxz/K8s_project.git"

View File

@ -0,0 +1,2 @@
---
# handlers file for master

View File

@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,124 @@
---
# tasks file for master
- name: Initialize K8s cluster
shell: >
kubeadm init
--apiserver-advertise-address={{ master_apiserver_address }}
--pod-network-cidr={{ master_pod_network_cidr }}
args:
creates: /etc/kubernetes/admin.conf
- name: Setup kubeconfig for {{ master_user }}
shell: |
mkdir -p /home/{{ master_user }}/.kube
cp -i /etc/kubernetes/admin.conf /home/{{ master_user }}/.kube/config
chown {{ master_user }}:{{ master_user }} /home/{{ master_user }}/.kube/config
args:
creates: "/home/{{ master_user }}/.kube/config"
- name: Wait for API server to be ready
become: false
shell: kubectl cluster-info
register: api_check
until: api_check.rc == 0
retries: 30
delay: 10
changed_when: false
- name: Install Flannel CNI
become: false
shell: "kubectl apply -f {{ flannel_manifest_url }}"
- name: Check if metrics server is installed
become: false
shell: kubectl get deployment metrics-server -n kube-system -o name
register: metrics_check
failed_when: false
changed_when: false
- name: Remove taint
become: false
shell: "kubectl taint nodes {{ inventory_hostname }} node-role.kubernetes.io/control-plane:NoSchedule-"
register: taint_result
failed_when: taint_result.rc != 0 and 'not found' not in taint_result.stderr
changed_when: taint_result.rc == 0
when: master_remove_taint
- name: Install metrics server
become: false
shell: "kubectl apply -f {{ metrics_server_manifest_url }}"
when: metrics_check.rc != 0
- name: Check if insecure-tls flag is already set
become: false
shell: >
kubectl get deployment metrics-server -n kube-system
-o jsonpath='{.spec.template.spec.containers[0].args}'
register: metrics_args
changed_when: false
when: metrics_server_insecure_tls
- name: Patch metrics server to allow insecure TLS
become: false
shell: >
kubectl patch deployment metrics-server -n kube-system --type='json'
-p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
when:
- metrics_server_insecure_tls
- "'--kubelet-insecure-tls' not in metrics_args.stdout"
- name: Wait for metrics server to be ready
become: false
shell: kubectl get deployment metrics-server -n kube-system -o jsonpath='{.status.readyReplicas}'
register: ready_replicas
until: ready_replicas.stdout == "1"
retries: "{{ metrics_server_ready_retries }}"
delay: "{{ metrics_server_ready_delay }}"
changed_when: false
- name: Get join command
shell: kubeadm token create --print-join-command
register: join_command_raw
- name: Set join command fact
set_fact:
join_command: "{{ join_command_raw.stdout }}"
- name: Install Helm
shell: curl {{ install_helm }} | bash
args:
creates: /usr/local/bin/helm
- name: Install local-path-provisioner
become: false
shell: kubectl apply -f {{ local_path_provisioner_url }}
- name: Set local-path as default StorageClass
become: false
shell: >
kubectl patch storageclass local-path
-p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
- name: Create argocd namespace
become: false
shell: kubectl create namespace argocd
register: argocd_ns
failed_when: argocd_ns.rc != 0 and 'already exists' not in argocd_ns.stderr
changed_when: argocd_ns.rc == 0
- name: Install ArgoCD
become: false
shell: kubectl apply -n argocd -f {{ argocd_manifest_url }} --server-side
- name: Patch ArgoCD server to NodePort
become: false
shell: >
kubectl patch svc argocd-server -n argocd
-p '{"spec": {"type": "NodePort"}}'
- name: Clone Git repository
git:
repo: "{{ git_repo_url }}"
dest: /home/{{ master_user }}/K8s_project
version: main
become: false

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- master

View File

@ -0,0 +1,2 @@
---
# vars file for master

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,3 @@
---
# defaults file for worker
master_hostname: master

View File

@ -0,0 +1,2 @@
---
# handlers file for worker

View File

@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,6 @@
---
# tasks file for worker
- name: Join Workers to cluster
shell: "{{ hostvars[master_hostname]['join_command'] }}"
args:
creates: /etc/kubernetes/kubelet.conf

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- worker

View File

@ -0,0 +1,2 @@
---
# vars file for worker