reorg, consolidate playbooks/k8s and clean up

This commit is contained in:
Ibrahim Mkusa 2025-04-20 14:07:20 -04:00
parent c94147754f
commit dc09613b2e
3 changed files with 17 additions and 37 deletions

View File

@ -1,6 +0,0 @@
---
- name: use Jeff GeerlingGuy's role to install helm
become: true
hosts: helm
roles:
- role: geerlingguy.helm

View File

@ -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

View File

@ -1,11 +1,12 @@
--- ---
- name: adds the kubernetes repo and installs kubectl - name: adds the kubernetes repo and installs kubectl
hosts: all hosts: localhost
become: true
tasks: tasks:
########## KUBECTL INSTALL ##########
- name: update apt cache - name: update apt cache
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
become: true
- name: install core pre-reqs - name: install core pre-reqs
ansible.builtin.apt: ansible.builtin.apt:
@ -14,35 +15,30 @@
- ca-certificates - ca-certificates
- curl - curl
- gnupg - gnupg
become: true
- name: check to see if gpg key exists - name: check to see if gpg key exists
ansible.builtin.stat: ansible.builtin.stat:
path: /etc/apt/keyrings/kubernetes-apt-keyring.gpg path: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
register: st register: st
become: true
- name: download the key and install it - name: download the key and install it
ansible.builtin.shell: | 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 sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring
when: st.stat.exists != true when: st.stat.exists != true
become: true
- name: add the kubernetes apt repository - name: add the kubernetes apt repository
ansible.builtin.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 state: present
filename: kubernetes.list filename: kubernetes.list
become: true
- name: update apt cache and install kubectl - name: update apt cache and install kubectl
ansible.builtin.apt: ansible.builtin.apt:
name: kubectl name: kubectl
update_cache: true update_cache: true
become: true
########## ARGOCD INSTALL ##########
- name: does argocd exists - name: does argocd exists
ansible.builtin.stat: ansible.builtin.stat:
path: /usr/local/bin/argocd path: /usr/local/bin/argocd
@ -54,4 +50,14 @@
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64 rm argocd-linux-amd64
when: st.stat.exists != true 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