Ansible devpro.system
collection provides a set of Ansible roles and playbooks to ease system administration by automating common actions. It can be used directly or viewed as an example.
- Look at Ansible roles
Ansible role | Action on the host |
---|---|
docker_engine |
Install Docker engine |
kubernetes_controlplane |
Install Kubernetes control plane |
kubernetes_node |
Install Kubernetes node and join a cluster |
linux_server |
Install most commonly required Linux packages |
vagrant |
Install Vagrant |
vagrant_k8s |
Provision VM and create a Kubernetes clusters |
- Review Ansible playbooks
Ansible playbook | Action on the host |
---|---|
kubernetes_controlplane |
Install Kubernetes control plane with kubeadm |
kubernetes_node |
Install Kubernetes node and join a cluster |
vagrant |
Install Vagrant |
vagrant_k8s |
Install Vagrant, provision VM and a create Kubernetes clusters |
-
Make sure Ansible is installed and an inventory is defined
-
Download the collection from Artifactory and install it locally
# downloads the file
ansible-galaxy collection download https://devpro.jfrog.io/artifactory/devpro-ansible/devpro-system-1.0.0.tar.gz
# installs the collection
ansible-galaxy collection install collections/devpro-system-1.0.0.tar.gz
# checks "devpro.system" appears in the list
ansible-galaxy collection list
- Create a local inventory file
[lab]
myservername_or_ipaddress
- Run a playbook (here Vagrant playbook)
ansible-playbook devpro.system.vagrant -i ./inventory --ask-become-pass
-
Make sure Ansible is installed
-
Create local inventories for the tests
-
Validate a code change by executing a playbook (use one or create a new one)
# checks the hosts can be reached ok
ansible all -m ping -i inventories/lab01
# run a playbook
ansible-playbook -i inventories/lab01 playbooks/demo.yml --ask-become-pass
- Publish the collection
ansible-galaxy collection build
- Push to Artifactory
# sets jfrog environment
export JFROG_INSTANCE=devpro.jfrog.io
export JFROG_REPOSITORY=rabbidsincubator-ansible
# sets jfrog authentication credentials
export JFROG_USERNAME=
export JFROG_TOKEN=
# sets artifact information
export ARTIFACT_FILENAME=devpro-system-1.0.0.tar.gz
# pushes the new version of the ansible collection to artifactory
curl -u$JFROG_USERNAME:$JFROG_TOKEN -T $ARTIFACT_FILENAME "https://${JFROG_INSTANCE}/artifactory/${JFROG_REPOSITORY}/${ARTIFACT_FILENAME}"
- Lint Ansible files
# https://hub.docker.com/r/pipelinecomponents/ansible-lint
docker run -it --rm --name ansible-lint -v $PWD:$PWD --workdir $PWD pipelinecomponents/ansible-lint
mkdir -p .gitlab/runner/local
docker run --rm --name gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/.gitlab/runner/local/config:/etc/gitlab-runner -v $PWD:$PWD --workdir $PWD gitlab/gitlab-runner exec docker ci
- Kubernetes Setup Using Ansible and Vagrant - March 15, 2019
- Ansible Collection structure
- Ansible MongoDB Communication Collection
- Deploy a Kubernetes cluster using Ansible
- MatTerra/ansiblekubernetes
- kairen/kube-ansible
- How to Install Containerd Container Runtime on Ubuntu 22.04
- How to install cri-dockerd and migrate nodes from dockershim - July 14, 2022
- How to Install CRI-O on Ubuntu 22.04 / Ubuntu 20.04 - Apr 30, 2022
- Deploying Kubernetes Cluster on Azure VMs using kubeadm, CNI and containerd - December 06, 2022
- Installing and Configuring containerd as a Kubernetes Container Runtime - 2021-12-27