How locations work
DCImanager system tools and Ansible configuration management systems are used for location management. Ansible utilizes playbooks — yaml-files that describe the actions to be performed. For more information about Ansible please refer to the official documentation.
To perform operations with locations, DCImanager uses the API-function location.
When performing operations, DCImanager sets an internal status to locations. Depending on a location status, the system can or cannot perform further operations with it.
Creating a location
To create a location, DCImanager performs the following operations:
- Creates a record about the creation in the database.
- Checks that the location can be connected.
- Collects information from the location.
- Performs preliminary setup of the location.
DCImanager sets the status CREATED for the newly created location.
To check that the location can be connected, DCImanager tries to connect via SSH using the encryption key /opt/ispsystem/dci/etc/.ssh/dci.1. If the connection failed, DCImanager will try to connect using the password. If it connects successfully, DCImanager will add a new public key from the file /opt/ispsystem/dci/etc/.ssh/dci.1.pub. If it cannot connect, it sets the status CHECK_FAILED for the location.
The setup module of the Ansible system is used for collecting statistics from the location. Ansible implements the playbook /opt/ispsystem/dci/etc/playbooks/location_info.yml. If an error occurs during this operation, the location is set the status CHECK_FAILED.
Ansible performs the preliminary setup using the playbook /opt/ispsystem/dci/etc/playbooks/location_presetup.yml:
- Connects the additional repository epel.
- Installs the software applications libselinux-python, net-snmp, python36, python36-libs, ipmitool, rsync, easysnmp.
- Disables SELinux.
- Copies the script repeater.py to the location. The script allows for communication with network switches through the SNMP protocol.
If the preliminary setup fails, the location is set the status CHECK_FAILED.
Configuring the location
To configure the location, DCImanager performs the following operations:
- Checks the parameters specified by the user.
- Configures the location.
- Installs and configures software on the location.
The system checks the parameters listed below:
- The record about the location in the database. If the record is missing, the error with the code 8000 "Location not found" will be returned.
- The status:
- CREATED — the error with the code 8055 "Location is still being created" will be returned;
- CHECK_FAILED — the error with the code 8056 "Location checking failed" will be returned;
- SETUP — the error with the code 8059 "Location is already setting up" will be returned.
- A list of network interfaces for DHCP:
- if any of the interfaces from the list is missing on the location, the error with the code 8058 "Location has no such interface" will be returned;
- if the list is empty, the error with the code 8057 "DHCP interfaces not set" will be returned.
- The IP address set for Nginx on the network interface. If the address is not assigned, the error with the code 8060 "Location has no such address" will be returned.
DCImanager saves the parameters in the database and sets the status SETUP for the location.
To install and configure software applications on the location, Ansible performs the operations from the playbook /opt/ispsystem/dci/etc/playbooks/location_setup.yml:
- Connects the additional repository epel.
- Configures the NFS.
- Installs docker.
- Removes the kea and kea-libs packages, if installed.
- Uploads, sets up, and runs software docker-containers of the location.
- Adds network connections used by docker-containers into the list of firewalld exclusions.
- Enables autostart for the docker and firewall services.
Editing the location
To edit the location, DCImanager performs the following operations:
- Checks the parameters specified by the user. If they differ from the parameters in the database or the location has the status CHECK_FAILED, it repeats the operations it has performed to create a new location.
- Creates a range of IP addresses for the location, if it was not allocated before.
Deleting the location
To delete the location, DCImanager performs the following operations:
- Checks its status. If it is CREATED or SETUP the error with the code 8066 "Location status is not OK" will be returned.
- Searches for servers, switches, and PDU assigned to the location. If the devices are found, the error with the code 8054 "Location cannot be removed" will be returned.
- Deletes the range of IP addresses on the location, if it was created before.
The log files are located in the container dci_back on the server with DCImanager:
- /var/log/dci_1_writer.log — the start of the location configuration and creation tasks;
- /var/log/dci_locationctl.log — operations that check the connection to the location via SSH;
- /var/log/dci_ansiblectl_location_<location id>.log — Ansible operations;
- /var/log/ansible.log — Ansible playbooks.
To go to the container, connect to the server with DCImanager via SSH and execute the command:
docker exec -it dci_back sh