DevOps Tools/Configuration/Ansible

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
Line 14: Line 14:
 
   executable location = /usr/bin/ansible
 
   executable location = /usr/bin/ansible
 
   python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]</nowiki>
 
   python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]</nowiki>
 +
=Configuration=
 +
Basic configuration, define the inventory path & specify the sudo user
 +
<nowiki>~$ sudo vim /etc/ansible/ansible.cfg
 +
uncomment
 +
...
 +
inventory      = /etc/ansible/hosts
 +
...
 +
sudo_user      = root</nowiki>
 +
Nodes are determined by their names.  These live in the inventory hosts file: <code>/etc/ansible/hosts</code>.  By default there is a file there that can be used as an example.
 +
<nowiki>~$ sudo vim /etc/ansible/hosts
 +
[local]
 +
localhost
 +
 +
[group1]
 +
ansible2.r00tedvw.local
 +
 +
[group2]
 +
ansible3.r00tedvw.local</nowiki>

Revision as of 17:49, 21 October 2018

Configuration
Ansible

Installation

Ansible does not require any server component, no daemon needs to be running. Ansible runs over SSH.
Where ever you are going to run your playbooks from, needs to have ansible installed, the clients do not.
To get ansible 2.0+, at the time of this writing, use the epel repo

~$ sudo yum install epel-release
~$ sudo yum install git python python-devel python-pip openssl ansible -y
~$ ansible --version
ansible 2.7.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/fgiuliani/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

Configuration

Basic configuration, define the inventory path & specify the sudo user

~$ sudo vim /etc/ansible/ansible.cfg
uncomment
...
inventory      = /etc/ansible/hosts
...
sudo_user      = root

Nodes are determined by their names. These live in the inventory hosts file: /etc/ansible/hosts. By default there is a file there that can be used as an example.

~$ sudo vim /etc/ansible/hosts
[local]
localhost

[group1]
ansible2.r00tedvw.local

[group2]
ansible3.r00tedvw.local
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
MagicMirror
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox