Ansible

Ansible is Article description::a configuration management system written in [[Python.]] It can be used for automating machine deployments.

Emerge
Install :

Configuration
The ansible ebuild has a example configuration generate the basic configuration. Change to home directory:

Extract the example configuration to the home directory:

Additionally a example configuration file is available on the official site of the project.

Inventory
The default inventory file is named. It should be created in the directory:

This file contains the managed nodes organized in groups.

With  and   remote users and ssh ports can be specified per hosts. From 2.0 version they are deprecated, use  and   instead.

The first two lines are crucial to explicitly set Ansible's python interpreter for all hosts, Ansible only works with python 2.7, and even is the  flag is set, it will use the system's python by default. It is unnecessary if the system python is version 2.7, but still recommended to avoid unexpected failure if you change it.

To show current ansible configuration, issue:

Authentication
The credentials username and password should be handled by ansible-vault change to the ansible directory in the home path:

Create a ansible vault for the credentials. The ansible-vault asks for a passphrase. This passphrase is used to encrypt and decrypt the vault.yml file:

New Vault password:

The vault file contains the credentials used to authenticate to remote nodes:

Roles for Gentoo
Over 40 roles specifically for Gentoo can be found in the https://github.com/gentoo-ansible project.

Usage
Check if ansible can manage remote machine with given user:

Get info from remote machine, what can be used later in playbooks:

Run on evapc under myuser via :

The command can be used to read module documentation. For example, to list available modules:

To print out info about the ping module:

External resources

 * Example configuration file