Deploy User Agent via Ansible

Install, configure, update and uninstall the Kabeen user agent on a Linux fleet with Ansible

Beta version. The user agent for Linux is in beta. Its installation packages cannot yet be downloaded from the platform: request them from Kabeen support (support@kabeen.io), specifying your distributions and architectures.

This article describes how to install, update and uninstall the agent on a fleet of Linux workstations with Ansible. The package, its configuration and the specifics of each desktop environment are described in User Agent on Linux (beta). For a Windows or macOS fleet, see GPO, Intune, Jamf or Script.

Prerequisites

  • The .deb (Debian, Ubuntu) and .rpm (Fedora) packages provided by support, for each architecture in your fleet (x86_64, aarch64), placed in the files/ folder of your Ansible project. You can verify their signature before deploying them (see Verify a package signature).
  • The API key, the structure UUID and the team UUID (see Where to find the values). Keep the API key in Ansible Vault rather than in clear text.

Install and configure the agent

The playbook deploys the managed configuration /etc/kabeen/configuration.json, then copies the package to the workstation and installs it. The agent reads its configuration from its first startup.

- name: Kabeen agent
  hosts: workstations
  become: true
  vars:
    kabeen_version: "1.6.1"
    kabeen_format: "{{ 'deb' if ansible_os_family == 'Debian' else 'rpm' }}"
    kabeen_package: "kabeen-{{ kabeen_version }}-linux-{{ ansible_architecture }}.{{ kabeen_format }}"
  tasks:
    - name: Managed configuration folder
      ansible.builtin.file:
        path: /etc/kabeen
        state: directory
        owner: root
        group: root
        mode: "0755"
    - name: Managed configuration
      ansible.builtin.copy:
        dest: /etc/kabeen/configuration.json
        owner: root
        group: root
        mode: "0644"
        content: "{{ {'ApiKey': kabeen_api_key, 'StructureId': kabeen_structure, 'TeamId': kabeen_team} | to_json }}"
      no_log: true
    - name: Copy the package
      ansible.builtin.copy:
        src: "files/{{ kabeen_package }}"
        dest: "/var/tmp/{{ kabeen_package }}"
        mode: "0644"
    - name: Install the package (Debian, Ubuntu)
      ansible.builtin.apt:
        deb: "/var/tmp/{{ kabeen_package }}"
      when: ansible_os_family == "Debian"
    - name: Install the package (Fedora)
      ansible.builtin.dnf:
        name: "/var/tmp/{{ kabeen_package }}"
        disable_gpg_check: true   # signed by a separate .sig file, not in the RPM header
      when: ansible_os_family == "RedHat"

The kabeen_api_key, kabeen_structure and kabeen_team variables are defined per host group: one group per team, for example. The optional keys (LogLevel, HideTrayIcon) and the per-user files (/etc/kabeen/users/<login>.json) are described in User Agent Configuration.

Browser extension

The package automatically installs the Kabeen extension in Chrome, Chromium, Brave, Vivaldi, Edge and Firefox, through their policy files. If you already manage /etc/firefox/policies/policies.json, add the Kabeen entry to it yourself (see Browser extension).

To deploy no browser policy at all, add this task after "Managed configuration folder", so before the package is installed:

    - name: No Kabeen browser policies
      ansible.builtin.file:
        path: /etc/kabeen/no-browser-policies
        state: touch
        modification_time: preserve
        access_time: preserve

Update the agent

Put the new packages in files/, change kabeen_version, then run the playbook again. The package is updated over the old one, running agents restart on the new version by themselves within about one minute, and the configuration in /etc/kabeen is kept.

Uninstall the agent

- name: Uninstall the Kabeen agent
  hosts: workstations
  become: true
  tasks:
    - name: Uninstall the package (Debian, Ubuntu)
      ansible.builtin.apt:
        name: kabeen
        state: absent
        purge: true
      when: ansible_os_family == "Debian"
    - name: Uninstall the package (Fedora)
      ansible.builtin.dnf:
        name: kabeen
        state: absent
      when: ansible_os_family == "RedHat"
    - name: Delete the managed configuration
      ansible.builtin.file:
        path: /etc/kabeen
        state: absent

Uninstallation also removes the browser policies installed by the package. Each user's data stays in place: deleting it is described in Uninstall the agent.