top of page

Ansible Overview


Ansible is a modern configuration management tool that doesn’t require the use of an agent software on remote nodes. Instead, it uses only SSH and Python to communicate and execute commands on managed servers.

Ansible allows users to manage servers in two different ways: via ad hoc commands, and via playbooks.

Ansible Playbook

An Ansible playbook is a file where users write Ansible code, an organized collection of scripts defining the work of a server configuration. They describe a set of steps in a general IT process or a policy for your remote systems to enforce.

Playbooks consist of one or more plays run in a particular order. A play is an ordered set of tasks run against hosts chosen from your inventory. Plays define the work to be done. Each play contains a set of hosts to configure, and a list of tasks to be executed. There are no standardized plays; an administrator must write each play.


Sample ansible playbook for install docker container and connection test of deploy ansible nodes from Jenkins.

- hosts: all
  become: yes
  gather_facts: yes

    - name: get actual hostname
        msg: I am actually {{ ansible_hostname }}

    - name: get ip addr
        msg: My core IP address is {{ ansible_facts['eth1']['ipv4']['address'] }}
      when: ansible_facts['eth1'] is defined

    - name: get mgmt ip addr
        msg: My management IP address is {{ ansible_facts['eth0']['ipv4']['address'] }}
      when: ansible_facts['eth0'] is defined

    - name: Run a docker container
        name: hello-world
        image: hello-world:latest
        detach: False
      register: hello_world_container_info

    - name: Print hello_world output
        msg: "{{ hello_world_container_info.container.Output }}"

    - name: Remove a docker container
        name: hello-world
        state: absent

    - name: Remove a docker image
        name: hello-world
        tag: latest
        state: absent

Kubernetes Cluster - RBAC Examples

Creating Service Account Run the following command to add a new service account called king: $ kubectl create serviceaccount king serviceaccount/king created Find the name of the secret that stores t

Kubernetes - Role-based access control (RBAC)

Kubernetes RBAC The Kubernetes API provides access to sensitive data, including deployment details, persistent storage settings, and secrets. Over the years, the Kubernetes community has provided seve

Kubernetes Cheat Sheet

This page contains a list of commonly used kubectl commands and flags. Kubectl apply - Creating objects # create resource(s) kubectl apply -f ./my-manifest.yaml # create from multiple files kubectl a


bottom of page