diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..67873ac --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "c:\\Program Files\\Python312\\python.exe" +} \ No newline at end of file diff --git a/inventories/kubernetes b/inventories/kubernetes index d316a58..155b777 100644 --- a/inventories/kubernetes +++ b/inventories/kubernetes @@ -1,9 +1,9 @@ [masters] -KubeMaster ansible_host=192.168.100.2 master=true +kubemaster ansible_host=192.168.100.2 master=true [workers] -KubeWorker1 ansible_host=192.168.100.3 worker=true -KubeWorker2 ansible_host=192.168.100.4 worker=true +kubeworker1 ansible_host=192.168.100.3 worker=true +kubeworker2 ansible_host=192.168.100.4 worker=true [ansible] -Ansible ansible_host=192.168.100.5 \ No newline at end of file +ansible ansible_host=192.168.100.5 connection=local \ No newline at end of file diff --git a/playbooks/fedora_configure_node_for_k8s.yml b/playbooks/fedora_configure_node_for_k8s.yml new file mode 100644 index 0000000..059f634 --- /dev/null +++ b/playbooks/fedora_configure_node_for_k8s.yml @@ -0,0 +1,79 @@ +--- +- hosts: masters,workers + become: true + become_method: sudo + become_user: root + tasks: + - name: Stop and disable zram generator + ansible.builtin.service: + name: "swap-create@zram0" + enabled: false + state: stopped + + - name: Remove zram generator defaults + ansible.builtin.yum: + name: "zram-generator-defaults" + state: absent + + - name: Reboot the system to get rid of the zram swap that's already been set up + ansible.builtin.reboot: + reboot_timeout: 900 + + - name: Set SELinux to Permissive + ansible.posix.selinux: + state: permissive + + - name: Disable firewalld + ansible.builtin.service: + name: firewalld + enabled: false + state: stopped + + - name: Install iptables components + ansible.builtin.yum: + name: + - iptables + - iproute-tc + state: present + + - name: Add overlay modprobe module + community.general.modprobe: + name: overlay + persistent: present + state: present + + - name: Add br_netfilter module + community.general.modprobe: + name: br_netfilter + persistent: present + state: present + + - name: Create network settings configuration file + ansible.builtin.blockinfile: + path: "/etc/sysctl.d/99-kubernetes-cri.conf" + block: | + net.bridge.bridge-nf-call-iptables = 1 + net.ipv4.ip_forward = 1 + net.bridge.bridge-nf-call-ip6tables = 1 + create: true + + - name: Apply new sysctl settings + ansible.builtin.shell: + cmd: sysctl --system + changed_when: false + + - name: Install cri-o and kubernetes + ansible.builtin.yum: + name: + - cri-o + - containernetworking-plugins + - kubernetes + - kubernetes-kubeadm + - kubernetes-client + state: present + + - name: Enable and start cri-o + ansible.builtin.service: + name: crio + enabled: true + state: started diff --git a/playbooks/configure_node_for_k8s.yml b/playbooks/rocky_configure_node_for_k8s.yml similarity index 99% rename from playbooks/configure_node_for_k8s.yml rename to playbooks/rocky_configure_node_for_k8s.yml index 5c9d682..7c8d1ec 100644 --- a/playbooks/configure_node_for_k8s.yml +++ b/playbooks/rocky_configure_node_for_k8s.yml @@ -18,7 +18,7 @@ - name: Set SELinux to Permissive ansible.posix.selinux: - state: disabled + state: permissive - name: Set firewalld configuration | Master Nodes ansible.posix.firewalld: