Installing eG Agents on Linux Servers Using Ansible Playbook

An Ansible® playbook is a blueprint of automation tasks—which are complex IT actions executed with limited or no human involvement. Ansible playbooks are executed on a set, group, or classification of hosts, which together make up an Ansible inventory.

Where the Ansible playbook is in use, you can use the playbook to install eG agents on multiple remote Linux servers simultaneously, and 'silently' - i.e., without any human intervention.

To achieve this, follow the steps below:

  1. Login to the Ansible control node and create the following folders on it:

    • A folder named ansible in the root directory;

    • A temporary folder named egagent in the tmp directory

  2. Download the egagent_linux_install_716.yaml file from the eG web site to the root/ansible directory.

  3. Next, open a browser, and connect to the eG manager to which the Linux agents you will be installing need to report. Login to that manager as a user with rights to download and install agents.

  4. When the Admin Home page appears, click the icon in the top, right corner of the page that appears to download eG agents.

  5. Doing so will invoke Figure 16, where you need to indicate if the eG agent you are downloading should communicate with the eG manager via a proxy server. If not, then pick the No option. If a proxy server is to be used for agent-manager communication, then select the Yes option.

    Figure 16 : Indicating whether/not the eG agent being downloaded should communicate with the eG manager

  6. If the Yes option is chosen in Figure 16, then Figure 17 will appear. Here, you need to provide the details of the proxy server used for agent-manager communication.

    Figure 17 : Configuring agent-manager communication via a proxy server

  7. Specify the following in Figure 17:

    • Proxy Server IP/Hostname: Mention the IP address/hostname of the proxy server used for agent-manager communication.
    • Proxy Server Port: Specify the port number at which the proxy server listens.
    • Does the proxy server require authentication?: Indicate whether/not the proxy server requires authentication. Select the No option if authentication is required, and Yes if it is.
    • Username, Password, and Confirm Password: If the proxy server requires authentication, then provide the credentials of a valid proxy server user against the Username and Password text boxes. Confirm the password by retyping it in the Confirm Password text box.
    • Finally, click the Submit button to confirm the proxy server specifications and proceed with the downloading of the eG agent.

  8. Figure 18 will appear. To download Linux agent installables from the eG manager, first select Linux from the Operating System drop-down in Figure 18. The 32-bit and 64-bit Linux agent packages will then be available for download (see Figure 18).

    Figure 18 : eG's internal agent packages available for download from the eG manager console

  9. To download an agent package for Linux, click on the package in Figure 18 that corresponds to the bit version of Linux that the target hosts in your environment are using. For instance, to install an eG agent on 32-bit Linux hosts, download the Linux.zip file by clicking on it. If your environment comprises of both 32-bit and 64-bit Linux servers, then download both the packages from the eG manager.

  10. Make sure that the zip file you click on is downloaded to the /tmp/egagent folder you created at step 1. If you are downloading both the 32-bit and 64-bit agent packages from the manager, then download both the zip files to the /tmp/egagent folder.

  11. Next, from the Shell prompt, open the /tmp/egagent folder and run the following command to unzip the file and extract its contents.

    unzip <Zip_File_Name>

    If the folder contains two zip files - one for 32-bit and another for 64-bit Linux hosts - then make sure that you run the above command twice. Also, when unzipping, ensure that the contents of both the zip files are extracted into two different sub-folders of the egagent folder - say, a folder named 32-bit and another named 64-bit.

  12. The following files will then be extracted:

    • A tar file: If you downloaded the agent package for a 32-bit Linux host - i.e., if you downloaded Linux.zip - then upon unzipping the file, you will find a file named eGagent_linux.tar.gz. If you downloaded the agent package for a 64-bit Linux host - i.e., if you downloaded Linux_x64.zip - then upon unzipping the file, you will find a file named eGagent_linux_x64.tar.gz.

    • iAgent script: This is the script that installs the eG agent on a Linux host. An iAgent_linux script will be extracted from Linux.zip (32-bit package), and an iAgent_linux_x64 script will be extracted from Linux_64.zip (64-bit package).

    • silent_install: This is the shell script that drives the silent installation of the eG agent. Running setup invokes the iAgent script and silently installs the agent on the target host.

  13. Next, edit the /etc/ansible/hosts file. This file should be updated with the IP addresses of each of the remote Linux servers on which an eG agent is to be installed, along with details of how to connect to every server via SSH. For this, first search for the [remoteservers] section in the file. Under this section, provide the details of each remote Linux server in the following format:

    [remoteservers]

    <IPadress_of_Linux_server1> <Credentials_for_connecting_to_Linux_server1>

    <IPadress_of_Linux_server2> <Credentials_for_connecting_to_Linux_server2>

     

    For instance, if the SSH connection to a server uses Password authentication, then your specification will be:

    192.168.10.21 ansible_ssh_pass=password ansible_ssh_user=root

     

    If the SSH connection uses key-based authentication, then your specification will be:

    192.168.2.200 ansible_ssh_private_key_file=/path/to/your/.ssh/id_rsa.pub

     

  14. Next, proceed to push the eG agents to the Linux servers configured in the [remoteservers] section of the hosts file. For that, issue the following commands at the prompt, one after another:

    # cd /root/ansible

    # ansible-playbook egagent_linux_install_716.yaml

  15. Upon successful execution, these commands will return the following output:

    Figure 19 : The output of the command

  16. From the command output in Figure 19, it is clear that when Ansible runs the YAML file, it first connects to the target Unix server using the IP address and credentials provided in the hosts file. Upon connecting successfully, Ansible then pushes the extracted Linux agent installables to the target. Next, since super-user permissions are required to run the iAgent script on the target, these permissions are automatically granted to the install user. The iAgent script is then silently run on the target to install the eG agent.

Troubleshooting

Ansible enables host key checking by default. Checking host keys guards against server spoofing and man-in-the-middle attacks, but it does require some maintenance.

If you understand the implications and wish to disable this behavior, you can do so by editing /etc/ansible/ansible.cfg or ~/.ansible.cfg:

[defaults]

host_key_checking = False

Alternatively, this can be set by the ANSIBLE_HOST_KEY_CHECKING environment variable:

# export ANSIBLE_HOST_KEY_CHECKING=False