Installing NetBrain Ansible Agent on Linux

Pre-installation Tasks

Ensure you have installed following components on your Ansible Agent Server prior to installing NetBrain Ansible Agent:

oAnsible 2.5 or higher versions

oGit

oParamiko 2.6.0

Note: It is highly recommended to install the ansible by running the yum install ansible command because the paramiko will also be automatically installed.

NetBrain Ansible Agent has dependencies on the third-party package on gcc putty zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel openssl-devel libffi-devel. Run the rpm -qa|grep gcc putty zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel openssl-devel libffi-devel command to check whether gcc putty zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel openssl-devel libffi-devel has been installed on this Linux server. If it has not been installed yet and the Linux server has access to the Internet, run the yum -y install gcc putty zlib-devel readline-devel bzip2-devel ncurses-devel gdbm-devel xz-devel tk-devel openssl-devel libffi-devel command to install it online, otherwise refer to the Appendix for further instructions.

Installing Ansible Agent

1.Log in to the Linux server as the root user.

2.Run the mkdir command to create a directory under the /opt directory to place the installation package. For example, netbraintemp8.0.3.

3.Run the cd /opt/netbraintemp8.0.3 command to navigate to the /opt/netbraintemp8.0.3 directory.

4.Copy the installation file to the /opt/netbraintemp8.0.3 directory.

Option 1: If the Linux server has no access to the Internet, obtain the netbrain-ansibleagent-linux-x86_64-rhel7-8.0.3.tar.gz file from NetBrain and then upload it to the /opt/netbraintemp8.0.3 directory by using a file transfer tool.  

Option 2: If the Linux server has access to the Internet, run the wget <download link> command under the /opt/netbraintemp8.0.3 directory to directly download the netbrain-ansibleagent-linux-x86_64-rhel7-8.0.3.tar.gz file from NetBrain official download site.

Note: Contact NetBrain Support Team to get the download link. The download link is case-sensitive.

Tip: Run the yum -y install wget command to install the wget command if it has not been installed on the server.

5.Run the tar -zxvf netbrain-ansibleagent-linux-x86_64-rhel7-8.0.3.tar.gz command under the /opt/netbraintemp8.0.3 directory to extract installation files.

[[email protected] netbraintemp8.0.3]# tar -zxvf netbrain-ansibleagent-linux-x86_64-rhel7-8.0.3.tar.gz
netbrain-ansibleagent/
netbrain-ansibleagent/config/
netbrain-ansibleagent/config/setup.conf
...
netbrain-ansibleagent/install.sh
...

6.Run the cd netbrain-ansibleagent/config command to navigate to the config directory.

7.Modify the parameters in the setup.conf file located under the config directory and save the changes. For how to modify the configuration file, see Appendix: Editing a File with VI Editor for more details.

[[email protected] config]# vi setup.conf
#NetBrain Ansible Agent configuration file
#Note: Ansible Key can only contain letters, numbers or underscore.
AnsibleKey=admin
BindIp=0.0.0.0
#The port must be between 1025 and 65535.
Port=50051
LogPath=/var/log/netbrain/ansibleagent
# Specify whether to use SSL to encrypt the connections to the License Agent Server.
# By default, it is disabled. no indicates disabled; yes indicates enabled.
UseSSL=no
Certificate=/etc/ssl/cert.pem
PrivateKey=/etc/ssl/key.pem

8.Run the cd .. command to navigate to the netbrain-ansibleagent directory.

9.Run the ./install.sh script under the netbrain-ansibleagent directory to install the Ansible Agent.

1)Read the license agreement, and then type YES and press the Enter key.

2)Type I ACCEPT and press the Enter key to accept the license agreement. The script starts to install the Ansible Agent.

[[email protected] netbrain-ansibleagent]# ./install.sh
 
Please read the End User License Agreement (“EULA”) for the license type (perpetual or subscription) 
purchased in the order form at https://www.netbraintech.com/legal-tc/ carefully. I have read the 
subscription EULA, if I have purchased a subscription license, or the perpetual EULA, if I have purchased 
a perpetual license, at 
the link provided above. Please type “YES” if you have read the applicable EULA and understand its 
contents, or “NO” if you have not read the applicable EULA. [YES/NO]: YES 
 
Do you accept the terms in the subscription EULA, if you have purchased a subscription license, or the 
perpetual EULA, if you have purchased a perpetual license? If you accept, and to continue with the 
installation, please type "I ACCEPT" to continue. If you do not accept, and to quit the installation 
script, please type "CANCEL" to stop. [I ACCEPT/CANCEL]: I ACCEPT 
 
INFO: Dependent Package: 
INFO: Component Name: Ansible Agent
INFO: RPM name: netbrainansibleagent
INFO: RPM package list: 
INFO: Preprocessing SUCCEEDED
INFO: Starting install Ansible Agent ...
INFO: Starting to check system
INFO: Collecting system information SUCCEEDED.
INFO: Starting to check Linux OS info
INFO: Starting to check rpm exists
INFO: Starting to check systemd
INFO: System checking SUCCEEDED
INFO: Start dependencies checking...
WARNING: Paramiko has not been installed. Please run the following command after 
Ansible Agent has been installed: /usr/lib/netbrain/ansibleagent/python/bin/pip3.7 install paramiko
INFO: Dependencies checkingSUCCEEDED.
INFO: Starting configuration parameters checking...
INFO: Configuration parameters checking SUCCEEDED.
...
INFO: Starting permission assigning...
INFO: Permission assigning SUCCEEDED.
 netbrainansibleagent.service - NetBrain Ansible Agent Daemon
   Loaded: loaded (/usr/lib/systemd/system/netbrainansibleagent.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-04-24 02:56:25 EDT; 14ms ago
  Process: 12497 ExecStop=/usr/lib/netbrain/ansibleagent/python/bin/python3 NBAgent.py stop (code=exited, status=0/SUCCESS)
 Main PID: 12518 (python3)
   CGroup: /system.slice/netbrainansibleagent.service
           12518 /usr/lib/netbrain/ansibleagent/python/bin/python3 NBAgent.py start
Feb 05 14:53:55 perf-7187 systemd[1]: Started NetBrain Ansible Agent Daemon.
INFO: Starting service netbrainansibleagent SUCCEEDED.
INFO: Backing up uninstall.sh SUCCEEDED
INFO: Successfully installed Ansible Agent.

10. Run the /usr/lib/netbrain/ansibleagent/python/bin/pip3.7 install paramiko command to install Paramiko.

 ...
Feb 05 14:53:55 perf-7187 systemd[1]: Started NetBrain Ansible Agent Daemon.
INFO: Starting service netbrainansibleagent SUCCEEDED.
 ...
Requirement already satisfied: cryptography>=2.5 in /usr/lib/netbrain/ansibleagent/python/lib/python3.7/site-packages (from paramiko) (2.6.1)
Requirement already satisfied: six in /usr/lib/netbrain/ansibleagent/python/lib/python3.7/site-packages (from pynacl>=1.0.1->paramiko) (1.12.0)
Requirement already satisfied: cffi>=1.4.1 in /usr/lib/netbrain/ansibleagent/python/lib/python3.7/site-packages (from pynacl>=1.0.1->paramiko) (1.12.3)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/netbrain/ansibleagent/python/lib/python3.7/site-packages (from cryptography>=2.5->paramiko) (0.24.0)
Requirement already satisfied: pycparser in /usr/lib/netbrain/ansibleagent/python/lib/python3.7/site-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko) (2.19)
Installing collected packages: pynacl, bcrypt, paramiko
Successfully installed bcrypt-3.1.7 paramiko-2.7.1 pynacl-1.3.0

11.Run the service netbrainansibleagent status command to verify whether its service starts successfully.

[[email protected] netbrain-ansibleagent]# service netbrainansibleagent status
Redirecting to /bin/systemctl status  netbrainansibleagent.service
  netbrainansibleagent.service - NetBrain Ansible Agent Daemon
   Loaded: loaded (/usr/lib/systemd/system/netbrainansibleagent.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-04-24 02:58:08 EDT; 2min 14s ago
 Main PID: 19306 (python3)
   CGroup: /system.slice/netbrainansibleagent.service
 ...

Parameters

The following table describes the parameters that can be configured when installing Ansible Agent.

Parameter

Default Value

Description

AnsibleKey

admin

Specify the key used to authenticate the connections with Ansible Agent.

BindIP

0.0.0.0

Specify the IP address of Ansible Agent.

Note: Modify the value only if you have multiple network cards on this machine.

Port

50051

Specify the port that the service of Ansible Agent listens to. Keep the default value as it is.

LogPath

/var/log/netbrain/ansibleagent

Specify the storage path for all log files of Ansible Agent.

UseSSL

no

Set whether to enable the encrypted connections to Ansible Agent by using SSL.

Certificate

/etc/ssl/cert.pem

Specify the storage path for all the certificates and key files used for SSL authentication.

Note: It is required only if UseSSL is enabled.

PrivateKey

/etc/ssl/key.pem

Specify the name of SSL private key file.

Note: It is required only if UseSSL is enabled.