Inventory Structure and Adding the Ansible Hosts File
The Ansible playbook installer requires configuration files to drive it.
In Ansible terminology, each Lightbits storage server is referred to as a “host”. Details about the Lightbits storage servers must be entered into the Ansible “hosts” file that is stored in an “inventory” temporary directory structure.
Complete the following steps to configure the Ansible "hosts" file, which describes all of the Lightbits storage server names and their management IPs.
- The servers' hostnames and Ansible names do not have to match. Lightbits usually refers to the servers' Ansible names as server00, server01, server02, etc. These will become the servers' identifying names with the Lightbits software. Therefore this will give the servers a name of serverXX going forward.
- For the ansible_host field, you should provide the management IP. However if the servers are only configured with data IPs and no management IP, then provide the data IPs of the server (in this case the data IP doubles as the management and data IP).
- From version 3.14 onward, Ansible variables have been moved to
all.yml
. see Configuring Global Variables in Ansible
- Open a text editor and edit the copied hosts example file, which is now found in the new
~/light-app/ansible/inventories/cluster_example/hosts
path. Replace the ansible_host, ansible_ssh_pass, and ansible_become_user values with your environment’s relevant values. This is for each server that will be in your cluster. Refer to the following example for reference.
server00 ansible_host=192.168.16.22 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
server01 ansible_host=192.168.16.92 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
server02 ansible_host=192.168.16.32 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
client00 ansible_host=192.168.16.45 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
[duros_nodes]
server00
server01
server02
[etcd]
server00
server01
server02
[initiators]
client00
- You can replace the ansible_host flag’s value with the interface DNS name or IP address. In this example, the management network IP addresses from the cluster details table are used, not the data network IPs.
- Remove the client00 line in the top section and "[initiators]" sections.
You can set up the Ansible files to install and configure clients. However, this section only describes how to install the Lightbits storage servers. The next section details how to configure and connect clients.
server00 ansible_host=192.168.16.22 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
server01 ansible_host=192.168.16.92 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
server02 ansible_host=192.168.16.32 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root ansible_become_pass=light
[duros_nodes]
server00
server01
server02
[etcd]
server00
server01
server02
[initiators]
client00
- Take into account the following information when filling out the "hosts" file.
More information about the hosts file:
- The top section of the "hosts" describes how Ansible will connect to other servers to install Lightbits. It also provides a friendly name for each Lightbits server; for example, "server00". These names will be used going forward by the Lightbits software as the identifying name for the servers.
- The "duros_nodes" section describes where Lightbits will be installed.
- Lightbits uses "etcd" for the key/value database of the cluster. The "etcd" section describes where etcd will be installed and which servers will become members of etcd. Every server appearing in "duros_nodes" must appear in the "etcd" section.
To use ansible_ssh_private_key_file instead of ansible_ssh_pass, see Using SSH-Key Authentication.
The final "hosts" file will look similar to the above output. Save and exit out of the ~/light-app/ansible/inventories/cluster_example/hosts
file.
Filling Out Ansible Hosts for Lightbits Deployment
The Ansible hosts file for a Lightbits deployment typically consists of four main sections, following Ansible's inventory rules. Below is a detailed breakdown of each section.
Server Mapping
This section maps server names to their management IPs and SSH connection details.
server00 ansible_host=192.168.40.46 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root
server01 ansible_host=192.168.40.47 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root
server02 ansible_host=192.168.40.48 ansible_connection=ssh ansible_ssh_user=root ansible_ssh_pass=light ansible_become_user=root
server00
,server01
, etc.: These names must match thehost_vars/server*.yml
files. Naming conventions can vary (e.g., server##, server#, hostname1, hostname2), but consistency is important.ansible_host
: IP or hostname used to connect to the Lightbits server. If using hostnames, ensure that the Ansible host can resolve them.ansible_connection
: This is almost always "ssh".ansible_ssh_user
: The user for SSH connection, which is almost always root.ansible_ssh_pass
: The password for the SSH connection.ansible_become_user
: The user with supreme privileges, typically root. This is crucial ifansible_ssh_user
is not root, as Lightbits needs root/sudo access for installation. This is optional but harmless ifansible_ssh_user
is already root.
Duros Nodes
This section specifies where to install Lightbits.
[duros_nodes]
server00
server01
server02
ETCD Section
This section specifies where to install ETCD.
[etcd]
server00
server01
server02
All servers mentioned in the duros_nodes
section must also be listed here.
Remember to adjust paths and values according to your specific deployment requirements. More settings can be provided in the host_vars/server*.yml
and group_vars/all.yml
files.