Introduction

Let’s start digging into the Ansible documentation.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vehicula et ante eu interdum. Cras porttitor sed leo eu vehicula. Praesent a risus id eros condimentum imperdiet ut ac nulla. Nunc id dignissim nisi. Nunc sed mattis quam. Nulla viverra mi leo, id facilisis enim egestas in. Mauris placerat mauris quis sem euismod, vitae pretium ante hendrerit. Nulla vel consectetur turpis, pulvinar ullamcorper nulla. Nunc nec porta eros, et sollicitudin nulla. Suspendisse malesuada turpis et lacus mollis tempus.

Cras tincidunt quam orci. Nullam gravida nulla vel commodo pharetra. Nunc aliquam posuere elit, at tincidunt dui facilisis et. Aliquam lacinia auctor lobortis. Sed suscipit arcu ac molestie molestie. Praesent elementum faucibus dui, a rhoncus magna. Quisque pellentesque a sapien et sodales. Nullam rhoncus faucibus massa non convallis. Vestibulum et sapien vel sapien pellentesque consectetur.

Roles - Features

Role Cluster Type Description

After mytable. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ac nibh ac lectus lobortis molestie sit amet a purus. Cras eu augue a augue maximus fringilla sit amet quis turpis. Phasellus a nisl ut sem fermentum hendrerit. Praesent volutpat pulvinar consequat. Nullam et tellus bibendum, rhoncus dui lobortis, vestibulum neque. Aliquam sit amet egestas nisl. Duis vitae aliquet augue. Integer at bibendum ex. Vestibulum nec nunc quis augue ullamcorper sollicitudin nec quis augue. Morbi purus velit, maximus at fermentum quis, faucibus nec augue. Quisque ac felis finibus, dapibus odio vel, aliquam lacus.

Role: Docker

Cluster target type: K8s

Description

One description

Role: Ingress Nginx controller

Cluster target type: K8s

Description

This role will install the ingress nginx controller on a Kubernetes cluster. It can be deployed on a k8s cluster which has been created using kind tool or the standard approach: kubeadm, kubelet.

Requirements

A Kubernetes cluster or Kind kubernetes cluster is needed.

Role Variables

2 options are available for the parameter target_platform :

  • kind

  • cloud (default)

Example Playbook

ansible-playbook ./kubernetes/ansible/k8s-misc.yml -t ingress --connection=local -e override_host=localhost -e target_platform=kind

Author Information

This role has been created by the Snowdrop team.

Role: Kubernetes Cluster

Cluster target type: K8s

Description

This role will install a Kubernetes cluster on a linux machine using kubelet and kubeadmin.

Requirements

TODO

Role Variables

To play with a Kubernetes cluster, you must deploy a container runtime. We support 2 of them: docker, containerd which can be configured using the following variables:

Name

Type

Value

install_docker

bool

false (default)

install_containerd

bool

true

Example Playbook

ansible-playbook ....

Author Information

This role has been created by the Snowdrop team.

Role: Kubernetes Config

Cluster target type: K8s

Description

A brief description of the role goes here.

Requirements

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

  • hosts: servers roles:

  • { role: username.rolename, x: 42 }

Author Information

This role has been created by the Snowdrop team.

Role: Kubernetes Kind

Cluster target type: K8s

Description

This role will install the Kubernetes Kind tool, next create a Kubernetes cluster and optionally a docker container registry.

Requirements

A docker daemon must be installed using the following docker role if no there.

The following python3 packages should be installed using pip tool: - docker - openshift

REMARK: Configure the following ENV VAR export ANSIBLE_PYTHON_INTERPRETER=$(which python3) to be sure that ansible use Python3

Role Variables

The full set of variables can be found in the default file.

The version of the cluster to be installed can be changed using the parameter k8s_version. The following versions are currently supported.

Example Playbook

To use this role, create a playbook and pass it as parameter under the roles section

  - hosts: "{{ override_host | default('masters') }}"
    roles:
    - { role: kind }

You can also configure the role with a tag

    - { role: 'kind', tags: 'kind'}

Usage

To play with this role, call your playbook and pass the tag to execute your role :

ansible-playbook ./kubernetes/ansible/k8s-misc.yml -t kind

To execute the playbook on the host machine, override the host and setup the connection as local

ansible-playbook ./kubernetes/ansible/k8s-misc.yml \
    --connection=local -e override_host=localhost \
    -t kind

To use a kubernetes cluster previously released, specify the version to be used:

ansible-playbook ./kubernetes/ansible/k8s-misc.yml \
    -e k8s_version=1.16 \
    -t kind

Check if kind cluster is working

To verify if kind is well installed and running, if it can process ingress route or docker pull/push using the local registry, please execute the following commands on your local machine to create the cluster and deploy the ingress role:

ansible-playbook ./kubernetes/ansible/k8s-misc.yml \
   --connection=local -e override_host=localhost \
   -e registry=true \
   -t kind

ansible-playbook ./kubernetes/ansible/k8s-misc.yml  \
   --connection=local -e override_host=localhost \
   -t ingress \
   -e target_platform=kind

Next, pull a docker image, tag it

docker pull gcr.io/google-samples/hello-app:1.0
docker tag gcr.io/google-samples/hello-app:1.0 localhost:5000/hello-app:1.0
docker push localhost:5000/hello-app:1.0

and create a Hello world application to verify if it works

kubectl create ns demo
kubectl create deployment hello-server --image=localhost:5000/hello-app:1.0 -n demo

cat <<EOF | kubectl apply -n demo -f -
kind: Service
apiVersion: v1
metadata:
  name: hello-server
spec:
    selector:
      app: hello-server
    ports:
      - port: 8080
EOF

cat <<EOF | kubectl apply -n demo -f -
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hello-server
spec:
  rules:
  - http:
      paths:
      - path: /hello
        backend:
          serviceName: hello-server
          servicePort: 8080
EOF

Call the service using curl

curl -v http://localhost/hello

Author Information

This role has been created by the Snowdrop team.