User Tools

Site Tools


ansible:ansible_install

This is an old revision of the document!


Ansible installation

EXTEND ANSIBLE: MODULES, PLUGINS and API

Should you want to write your own, Ansible modules can be written in any language that can return JSON (Ruby, Python, bash, etc). Inventory can also plug in to any datasource by writing a program that speaks to that datasource and returns JSON. There's also various Python APIs for extending Ansible’s connection types (SSH is not the only transport possible), callbacks (how Ansible logs, etc), and even for adding new server side behaviors

Files used by ansible

  ANSIBLE_CONFIG (environment variable if set) defult: /etc/ansible/ansible.cfg
  ansible.cfg (in the current directory)
  ~/.ansible.cfg (in the home directory)
  /etc/ansible/ansible.cfg

First install ansible package

Configure /etc/ansible/hosts

it can contain hosts and group them

Ex:

  [webservers]
  www1.example.com ansible_ssh_user=root ansible_ssh_pass=mypassord
  www2.example.com

  [dbservers]
  db0.example.com
  db1.example.com
  10.1.1.1

Example of basic commands

# ansible all -m ping 
# ansible foo.example.com -m yum -a "name=httpd state=installed"
# ansible foo.example.com -a "/usr/sbin/reboot"

Writing a playbook

Check syntax

ansible-playbook sample.yml --syntax-check
ansible/ansible_install.1629459006.txt.gz · Last modified: 2021/08/20 13:30 by manu