Skip to content

3. Configure deployment

Configure Deployment

This section describes the configuration of MiaRec deployment. Such configuration should be done on the Ansible controller host.

3.1. Create inventory file (hosts)

The Ansible inventory file is an INI-formatted file that defines the hosts and groups of hosts upon which commands, modules, and tasks in playbooks operate.

Create the file /opt/ansible-miarec/hosts and add entries for every server you want to manage with Ansible (the Inventory File is highly configurable, see the Ansible documentation for more information):

vim /opt/ansible-miarec/hosts

Example 1. Local installation (all-in-one):

For local installation (when Ansible is running on the same host as MiaRec software), create the following hosts file:

[all]
; ---------------------------------
; All-in-one host
; Parameters:
;   - private_ip_address => ip address to access the host from other components (for example, web application needs to connecto to database)
; ---------------------------------

miarec ansible_connection=local private_ip_address=127.0.0.1


[all:vars]
; -------------------------------
; Version of installed packages
; -------------------------------
miarecweb_version   = x.x.x.x
miarec_version      = x.x.x.x
miarec_screen_version = x.x.x.x
miarec_livemon_version = x.x.x.x
postgresql_version  = 12
python_version      = 3.8.18
redis_version       = 5.0.10

install_pgbouncer = true

; Use command `pwgen -s 32 1` to generate random password
secret_db_password = <GENERATE-RANDOM-PASSWORD-HERE>

; Use command `pwgen -s 32 1` to generate random password
miarecweb_secret = <GENERATE-RANDOM-PASSWORD-HERE>


[recorder]
miarec

[screen]
miarec

[db]
miarec

[redis]
miarec

[web]
miarec

[celery]
miarec

[celerybeat]
miarec

[livemon]
miarec

Example 2. Remote installation via SSH (all-in-one):

If you are running Ansible playbook from the Controller host over SSH, create the following hosts file (replace 1.2.3.4 ip-address with the target host address):

[all]
; ---------------------------------
; All-in-one host
; Parameters:
;   - ansible_ssh_host => ip address to access the host using Ansible    
;   - ansible_root     => root account to login to server. Usually, 'root', but for Ubuntu it may be 'ubuntu'
;   - private_ip_address => ip address to access the host from other components (for example, web application needs to connecto to database)
;                           For 'all-in-one' setup, the private_ip_address should be set to '127.0.0.1' as all communication is done internally
; ---------------------------------

miarec ansible_host=1.2.3.4 ansible_port=22 ansible_user=root private_ip_address=127.0.0.1


[all:vars]
; -------------------------------
; Version of installed packages
; -------------------------------
miarecweb_version   = x.x.x.x
miarec_version      = x.x.x.x
miarec_screen_version = x.x.x.x
miarec_livemon_version = x.x.x.x
postgresql_version  = 12
python_version      = 3.8.18
redis_version       = 5.0.10

install_pgbouncer = true

; Use command `pwgen -s 32 1` to generate random password
secret_db_password = <GENERATE-RANDOM-PASSWORD-HERE>

; Use command `pwgen -s 32 1` to generate random password
miarecweb_secret = <GENERATE-RANDOM-PASSWORD-HERE>

[recorder]
miarec

[screen]
miarec

[db]
miarec

[redis]
miarec

[web]
miarec

[celery]
miarec

[celerybeat]
miarec

[livemon]
miarec

Example 3. Remote installation via SSH to multiple hosts (decoupled architecture):

If you deploy MiaRec components on dedicated hosts, create the following hosts file (replace ip-adresses accordingly):

[all]

; ---------------------------------
; All hosts
; Parameters:
;   - ansible_ssh_host => ip address to access the host using Ansible
;   - ansible_root     => root account to login to server. Usually, 'root', but for Ubuntu it may be 'ubuntu'
;   - private_ip_address => ip address to access the host from other components (for example, web application needs to connecto to database)
;                           For 'all-in-one' setup, the private_ip_address should be set to '127.0.0.1' as all communication is done internally
; ---------------------------------

rec1.miarec  ansible_ssh_host=192.168.88.11  private_ip_address=192.168.88.11  ansible_user=root 
rec2.miarec  ansible_ssh_host=192.168.88.12  private_ip_address=192.168.88.12  ansible_user=root 
db.miarec    ansible_ssh_host=192.168.88.15  private_ip_address=192.168.88.15  ansible_user=root 
redis.miarec ansible_ssh_host=192.168.88.16  private_ip_address=192.168.88.16  ansible_user=root 
web1.miarec  ansible_ssh_host=192.168.88.21  private_ip_address=192.168.88.21  ansible_user=root 
web2.miarec  ansible_ssh_host=192.168.88.22  private_ip_address=192.168.88.22  ansible_user=root 


[all:vars]
; -------------------------------
; Version of installed packages
; -------------------------------
miarecweb_version   = x.x.x.x
miarec_version      = x.x.x.x
miarec_screen_version = x.x.x.x 
miarec_livemon_version = x.x.x.x
postgresql_version  = 12
python_version      = 3.8.18
redis_version       = 5.0.10

install_pgbouncer = true

; Use command `pwgen -s 32 1` to generate random password
secret_db_password = <GENERATE-RANDOM-PASSWORD-HERE>

; Use command `pwgen -s 32 1` to generate random password
miarecweb_secret = <GENERATE-RANDOM-PASSWORD-HERE>

[recorder]
rec1.miarec
rec2.miarec

[screen]
rec1.miarec
rec2.miarec

[db]
db.miarec

[redis]
redis.miarec

[web]
web1.miarec
web2.miarec

[celery]
web1.miarec
web2.miarec

[celerybeat]
web1.miarec

[livemon]
web1.miarec
web2.miarec

In this example, we define two remote machines miarec1 and miarec2 and then place them into group miarec. Ansible playbook is executed against whole group.

3.2 Edit the version info in the inventory file

The hosts file contains the version of to be installed packages.

You need to edit at least the following parameters:

  • miarecweb_version
  • miarec_version
  • miarec_screen_version
  • miarec_livemon_version

To get the latest MiaRec version, contact your MiaRec representative.

Example:

[all:vars]
; -------------------------------
; Version of installed packages
; -------------------------------
miarecweb_version   = 1.1.1.1
miarec_version      = 2.2.2.2
miarec_screen_version = 3.3.3.3
miarec_livemon_version = 4.4.4.4
postgresql_version  = 12
python_version      = 3.8.18
redis_version       = 5.0.10