Add the kubernetes role.

This commit is contained in:
Tom Alexander
2022-12-01 23:38:21 -05:00
parent 3637dcdfcc
commit 80083ff0cc
18 changed files with 202 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
- name: Install packages
package:
name:
- kubectl
- jq # for decrypt_k8s_secret
- helm
- sops # Encrypt secrets
state: present
# TODO: Make a FreeBSD package for kubeswitch or kubectx
# TODO: Make a FreeBSD package for stern
- name: Install scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: k
dest: /usr/local/bin/k
- src: ka
dest: /usr/local/bin/ka
- src: kd
dest: /usr/local/bin/kd
- src: kdel
dest: /usr/local/bin/kdel
- src: klog
dest: /usr/local/bin/klog
- src: ks
dest: /usr/local/bin/ks
- src: kshell
dest: /usr/local/bin/kshell
- src: kx
dest: /usr/local/bin/kx
- src: decrypt_k8s_secret
dest: /usr/local/bin/decrypt_k8s_secret
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'
- include_tasks:
file: tasks/peruser.yaml
apply:
become: yes
become_user: "{{ initialize_user }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@@ -0,0 +1,5 @@
- name: Install packages
package:
name:
- py39-yamllint
state: present

View File

@@ -0,0 +1,24 @@
- name: Build aur packages
register: buildaur
become_user: "{{ build_user.name }}"
command: "aurutils-sync --no-view {{ item }}"
args:
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
loop:
- kubeswitch
- name: Update cache
when: buildaur.changed
pacman:
name: []
state: present
update_cache: true
- name: Install packages
package:
name:
- yamllint
- stern
- kubectx
- kubeswitch
state: present

View File

@@ -0,0 +1 @@
- import_tasks: tasks/common.yaml

View File

@@ -0,0 +1,29 @@
- include_role:
name: per_user
# - name: Create directories
# file:
# name: "{{ account_homedir.stdout }}/{{ item }}"
# state: directory
# mode: 0700
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - ".config/foo"
# - name: Copy files
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
# mode: 0600
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - src: foo.conf
# dest: .config/foo/foo.conf
- import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/peruser_linux.yaml
when: 'os_flavor == "linux"'