Giter Site home page Giter Site logo

ansible-collection-k8s-toolbox's Introduction

Ansible Collection - k8s toolbox

Ansible Collection GitHub release Github license pre-commit

This Ansible Collection "k8s toolbox" contains roles and playbooks to deploy and configured tools to managed a kubernetes cluster.

Getting Started

This collection contains the following ressources.

Ressources Comment Privilege CI Status
roles/helm Install helm from the github package and make a symbolic link in /usr/local/bin. true Github pipeline status
roles/k9s Install k9s from the github package and make a symbolic link in /usr/local/bin. true Github pipeline status
roles/kubectl Install kubectl from google repositories (centos or debian supported). true Github pipeline status
roles/kubectx Install kubectx/kubens from the github package and make a symbolic link in /usr/local/bin. true Github pipeline status
roles/minikube Install minikube from google repositories (centos or debian supported). true Github pipeline status
roles/stern Install stern from the github package and make a symbolic link in /usr/local/bin. true Github pipeline status

Prerequisites

The only prerequisite is to have an Ansible >= 2.9

Installing

ansible-galaxy collection install pandemonium1986.k8s_toolbox

Deployment

There are no specific prerequisites for the use of the collection.

Simply create a playbook that may be briefly similar to this one :

---
- name :          K8s Toolbox deployement
  hosts:          local
  become:         true
  collections:
    - pandemonium1986.k8s_toolbox
  tasks:
    - import_role:
        name:    pandemonium1986.minikube
    - import_role:
        name:    pandemonium1986.kubectx
    - import_role:
        name:    pandemonium1986.k9s
    - import_role:
        name:    pandemonium1986.stern
    - import_role:
        name:    pandemonium1986.helm

Available variables are :

helm_cache_path:            "/var/cache/github"
helm_installation_path:     "/opt/github/helm"
helm_checksum:              "sha256:b664632683c36446deeb85c406871590d879491e3de18978b426769e43a1e82c"
helm_version:               "v3.3.4"

k9s_cache_path:             "/var/cache/github"
k9s_installation_path:      "/opt/github/k9s"
k9s_checksum:               "sha256:42d8aef6b839a9bc60de29d2461521596ce2d1f66347dbf5196983229cfeafd2"
k9s_version:                "v0.22.1"

kubectl_version:            "1.20.0"

kubectx_installation_path:  "/opt/github/kubectx"
kubectx_version:            "master"

minikube_version:           "1.17.1"

stern_installation_path:    "/opt/github/stern"
stern_checksum:             "sha256:e0b39dc26f3a0c7596b2408e4fb8da533352b76aaffdc18c7ad28c833c9eb7db"
stern_version:              "1.11.0"

Contributing

Pre-commit

I use pre commit to manage the commit-msg commit and pre-push hooks. To install the hooks proceed as follows

pre-commit install --hook-type commit-msg && \
pre-commit install --hook-type pre-push && \
pre-commit install
Monorepo

The ansible collections are composed of a set of roles/plug-ins/modules ... My choice was made to group all the roles in a "monorepo", the collection itself, and to ensure the building of the roles in "manyrepo".

This section is not only aimed at the collection itself, but potentially at all of them.

First of all if you start from a set of roles existing in "manyrepo" you have to group them in the roles directory of the collection.

I use tomono to create the monorepo from the manyrepos

To generate the monorepo folder (assuming that the user pandemonium exists and his homedir is /home/pandemonium):

mkdir -p ~/git/Pandemonium1986/ansible-collection-k8s-toolbox && git init

git clone https://github.com/hraban/tomono.git ~/git/github/hraban/tomono

vim ~/Documents/workspace/repos.txt

[email protected]:Pandemonium1986/ansible-role-helm ansible-role-helm roles/helm
[email protected]:Pandemonium1986/ansible-role-k9s ansible-role-k9s roles/k9s
[email protected]:Pandemonium1986/ansible-role-kubectl ansible-role-kubectl roles/kubectl
[email protected]:Pandemonium1986/ansible-role-kubectx ansible-role-kubectx roles/kubectx
[email protected]:Pandemonium1986/ansible-role-minikube ansible-role-minikube roles/minikube
[email protected]:Pandemonium1986/ansible-role-stern ansible-role-stern roles/stern

export MONOREPO_NAME=/home/pandemonium/git/Pandemonium1986/ansible-collection-k8s-toolbox
cd / && cat ~/Documents/workspace/repos.txt | /home/pandemonium/git/github/hraban/tomono/tomono.sh --continue

To ensure the synchronisation of the manyrepos from the monorepo I use splitsh-lite

An example of repo helm synchronisation :

cd ~/git/Pandemonium1986/ansible-collection-k8s-toolbox
SHA1=`splitsh-lite --prefix=roles/ansible-role-helm`
git push ansible-role-helm $SHA1\:refs/heads/CURRENT_BRANCH -f --no-verify

Each role can be tested independently via molecule.

Guidelines

Feel free to consul before you're contributing

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

ansible-collection-k8s-toolbox's People

Contributors

pandemonium1986 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.