From dc09613b2e07562ab00694fa500d9a5a5b6051d8 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sun, 20 Apr 2025 14:07:20 -0400 Subject: [PATCH] reorg, consolidate playbooks/k8s and clean up --- playbooks/helm/install_helm.yaml | 6 ---- playbooks/helm/install_helm_apt.yaml | 20 ------------- ...tall_kubectl.yml => install_k8s_tools.yml} | 28 +++++++++++-------- 3 files changed, 17 insertions(+), 37 deletions(-) delete mode 100644 playbooks/helm/install_helm.yaml delete mode 100644 playbooks/helm/install_helm_apt.yaml rename playbooks/k8s/{install_kubectl.yml => install_k8s_tools.yml} (66%) diff --git a/playbooks/helm/install_helm.yaml b/playbooks/helm/install_helm.yaml deleted file mode 100644 index 062d160..0000000 --- a/playbooks/helm/install_helm.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: use Jeff GeerlingGuy's role to install helm - become: true - hosts: helm - roles: - - role: geerlingguy.helm diff --git a/playbooks/helm/install_helm_apt.yaml b/playbooks/helm/install_helm_apt.yaml deleted file mode 100644 index 05e6fff..0000000 --- a/playbooks/helm/install_helm_apt.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: installs helm repo and its repository on ubuntu - hosts: helm - become: true - tasks: - - name: install needed dependencies via apt - ansible.builtin.apt: - pkg: - - curl - - apt-transport-https - - - name: install repository and key (not idempotent) - ansible.builtin.shell: | - curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list - apt update - - - name: install helm kubernetes package manager - ansible.builtin.apt: - name: helm diff --git a/playbooks/k8s/install_kubectl.yml b/playbooks/k8s/install_k8s_tools.yml similarity index 66% rename from playbooks/k8s/install_kubectl.yml rename to playbooks/k8s/install_k8s_tools.yml index 723d1d3..de9aa38 100644 --- a/playbooks/k8s/install_kubectl.yml +++ b/playbooks/k8s/install_k8s_tools.yml @@ -1,11 +1,12 @@ --- - name: adds the kubernetes repo and installs kubectl - hosts: all + hosts: localhost + become: true tasks: +########## KUBECTL INSTALL ########## - name: update apt cache ansible.builtin.apt: update_cache: true - become: true - name: install core pre-reqs ansible.builtin.apt: @@ -14,35 +15,30 @@ - ca-certificates - curl - gnupg - become: true - name: check to see if gpg key exists ansible.builtin.stat: path: /etc/apt/keyrings/kubernetes-apt-keyring.gpg register: st - become: true - name: download the key and install it ansible.builtin.shell: | - curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.31/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring when: st.stat.exists != true - become: true - name: add the kubernetes apt repository ansible.builtin.apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.31/deb/ /" + repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /" state: present filename: kubernetes.list - become: true - name: update apt cache and install kubectl ansible.builtin.apt: name: kubectl update_cache: true - become: true - +########## ARGOCD INSTALL ########## - name: does argocd exists ansible.builtin.stat: path: /usr/local/bin/argocd @@ -54,4 +50,14 @@ sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd rm argocd-linux-amd64 when: st.stat.exists != true - become: true + +########## HELM INSTALL ########## + - name: install repository and key (not idempotent) + ansible.builtin.shell: | + curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list + apt update + + - name: install helm kubernetes package manager + ansible.builtin.apt: + name: helm