Skip to content
Pavel Zinin edited this page Jul 2, 2019 · 4 revisions

Ansible playbooks

Prerequisites

In order to use an Ansible playbook, you must

  1. (Optional) mount a folder with Ansible playboks to a container's ./ansible directory. Default: ./ansible directory in project root. This directory contains example playbooks
  2. Mount a folder/volume to store logs to a container according to a config.ini file. Default: ./logs/ansible directory in project root.
  3. Generate a SSH key for Ansible and make sure it exists for a container according to a config.ini file. If you use VMEmperor auto-installation, this key will be authorized in a VM
  4. (if you don't use docker-compose) Set ansible_playbook parameter to the path to ansible-playbook binary if you use custom Ansible distribution

Preparing playbooks

Supply a vmemperor.conf file with each playbook as described here.

Ansible user

If you use VMEmperor to install a VM with unattended installation, it'll authorize VMEmperor's ansible_pubkey to access user you've created. The ansible playbook will run under this user and it can be assumed that the user has a no-password sudo access. You can change the user name by editing other_config field of a desired VM with a tool like xe on a Xen Server:

Get user

xe vm-param-get uuid=YOUR_UUID  param-name=other-config:first_user

If there's no such user, then root is assumed.

Set user

NB: You should make the user "USERNAME" a sudoer with no password required

 xe vm-param-set uuid=YOUR_UUID other-config:first_user=USERNAME
Clone this wiki locally