How to Uninstall Linux Agents Using Ansible?

To achieve this, follow the steps below:

  1. Login to the Ansible control node.

  2. Next, download eG Enterprise's proprietary Ansible playbook, which automates agent uninstallation, to the /root/ansible directory on the control node. This playbook is available as a YAML file named egagent_linux_uninstall.yaml.

    If the version of eG Enterprise in use in your environment is v7.2.10 (or above), then download the playbook from the URL: https://www.eginnovations.com/releases/v7210/Additional Products/Scripts/Ansible

    On the other hand, if you are using an eG Enterprise version below v7.2.10 in your environment, then download the playbook from the URL: https://www.eginnovations.com/eval<version_number>/Additional Products/Scripts/Ansible

  3. Also, if you are using an eG Enterprise version below v7.2.10 in your environment, you will have to additionally download the following files to the /tmp/egagent folder:

    • A script named, uninstall_agent
    • A file named updateSudoers

    To download, access the URL: https://www.eginnovations.com/eval<version_number>/LINUX

    In the case of version 7.2.10 or above however, the uninstall_agent script and the updateSudoers file are bundled into the eG agent installation itself, and will be available in the /opt/egurkha/bin directory. In this case therefore, you do not have to separately download these files from the eG web site.

  4. Next, proceed to uninstall the eG agents from the Linux servers configured in the [remoteservers] section of the hosts file. For that, issue the following commands at the prompt, one after another, as a user with root user permissions to the target Linux systems:

    # cd /root/ansible

    # ansible-playbook egagent_linux_uninstall.yaml

  5. Upon successful execution, the playbook will first prompt you to confirm whether/not to proceed with the uninstallation.

    The eG Agent will be uninstalled now.

    The eG user, folders and services be removed.

    Do you want to continue y/n? [n]

    y

  6. Type y at the prompt to proceed with the uninstallation. Doing so will invoke the following messages:

    eG Agent Directory is: /opt/egurkha

    eG User: egurkha

    Before stopping the agent process status = 1

    Removed /etc/systemd/system/multi-user.target.wants/egagent.service.

    After stopping the agent process status = 0

  7. Once the agent is successfully uninstalled, the following message will appear:

    Successfully uninstalled the eG Agent ...