Views: 3352
Last Modified: 18.01.2021

Scenarios and roles

Server is configured via the following scenarios:

Scenario – set of actions to be executed at the server or group. Scenarios are grouped by roles.

Roles – the method for organizing scenario storage. Allows storing all the necessary files in a separate catalog.

Main roles:

  • monitor – monitoring server settings;
  • web – web server settings: multiple node organization, creating new site, certification configuration;
  • mysql – mysql server configuration: creating master-slave configuration, moving mysql server to a separate host;
  • sphinx – configuring and deleting sphinx server;
  • memcached – configuring and deleting memcached service;
  • push-server – configuring and deleting push-server service.

Additional roles:

  • common – general server configuration: network screen, time sync, additional software installation;
  • clean – cache clearing.

ansible scenarios API

Ansible scenario API is used for launching scenarios, retrieving their status and returning it in a convenient format (json, txt).

Scenarios are launched via API in background mode so that any current web- or ssh-session would not affect configuration process. During this process, current ongoing task status is saved, and its log can be retrieved in case of an error.


Ansible scenario start

The scenario is initiated via the following command:

ansible-playbook /etc/ansible/<PLAY>.yml -e ansible_playbook_file=/opt/webdir/temp/<TASK_ID>/opts.yml

Command ansible-playbook launches yml scenario and additional options are collected from the menu and sent via the file opts.yml in the parameter ansible_playbook_file.

Before launching ansible scenario, API creates the task directory /opt/webdir/temp/<TASK_ID> and then places the following files into it:

  • opts.yml – start options (if they are available).
  • status – contains start log when started
  • pid – background process PID, to prove information if process is being executed or not.

After processing successful or failed task, the file opts.yml is deleted, because it can contain confidential data (passwords, for example).

Task statues can be viewed via the virtual appliance menu item 10. Background pool tasks:





Courses developed by Bitrix24