We need documents for human, not for robots.

What is ansible?

Ansible is a tool for DevOps. It can be used to：

• define server groups in inventory
• control a group of servers like localhost
• setup environments on servers
• install, update, remove apps
• write, copy files
• execute command on servers
• use playbooks to execute a series of tasks
• use others' playbooks as roles from ansible galaxy

## Tutorial

The easiest way to learn how to use ansible is learning from examples. Only when you find some key words that confuse you that you need to check the official documents with search engines.

Here I'd like to give you some simple introductions.

### Playbooks and roles

You can execute a series of tasks defined in the playbooks. First of all, check if there exists roles that already done the same thing you need. Roles can be found from Ansible Galaxy.

Playbooks is defined in yaml file.

- hosts: all
become: yes
roles:
- nvidia.nvidia_driver
- nvidia.nvidia_docker
- name: turn off swap
command: swapoff -a
when: ansible_swaptotal_mb > 0

- name: add k8s GPG key

- name: install kubectl kubelet kubeadm
apt:
state: present
update_cache: yes


For each task, you can do almost everything like command, apt, copy, replace. Find what you need with search engines.

Execute playbooks:

ansible-playbook -i inventory k8s.yml


## Finally

This is almost everything you need to know about ansible as a beginner :)

As usual, GitHub and StackOverflow are still your best friends.