get-automox.yml kb and playbook corrections

  • 18 May 2022
  • 1 reply
  • 22 views

Badge

In the automox kb the ansible playbook is broken and I wanted to submit my corrections- https://support.automox.com/help/deploying-the-automox-agent-in-bulk:

Deploying with Ansible
You can distribute the Automox agent with Ansible using the Ansible playbook: get-automox.yml. Contact Automox Support for further assistance.

From the directory where the ‘get-automox.yml’ file is located, invoke the playbook with the following command, substituting your unique user key (zone key) as indicated: 

ansible-playbook get-automox.yml --extra-vars "zone=YOUR-ZONE-KEY-HERE

In get-automox.yml:

    - name: Ensure amagent is enabled and started
      service: 
        name: amagent 
        state: running <- Causes the playbook to fail.
        enabled: yes

state: running is not a valid state.  
Changing it to state: started fixes the problem.

Also, the command fails: ansible-playbook get-automox.yml --extra-vars "zone=YOUR-ZONE-KEY-HERE

Changing the command to
ansible-playbook -i hosts get-automox.yml --extra-vars “organization=ZONE_KEY”

The variable zone does not exist, I think it may have been updated but the documentation doesn’t reflect the change.  Also the command is missing a trailing double quote.

In get-automox.yml:

  vars:
    automox_url: https://console.automox.com/downloadInstaller?accesskey={{ organization }} <- variable name is not zone

The organization variable is where the zone variable would be. 
 


1 reply

Badge
---
# Ansible playbook to install Automox Agent on Linux-based system
# Execute with following command (provide your organization key):
# ansible-playbook get-automox.yml --extra-vars "organization=your-organization-key-here"

- hosts: all
become: true
become_method: sudo

remote_user: root
vars:
automox_url: https://console.automox.com/downloadInstaller?accesskey={{ organization }}
automox_temp_dir: /tmp/automox_install
automox_temp_dir_mode: 0700

automox_temp_install_file: install.sh
automox_install_script_owner: root
automox_install_script_group: root
automox_install_script_mode: 0700

tasks:
- name: Ensure temp directory exists
file:
path: "{{ automox_temp_dir }}"
state: directory
owner: "{{ automox_install_script_owner }}"
group: "{{ automox_install_script_group }}"
mode: "{{ automox_temp_dir_mode }}"

- name: Download Automox Agent from automox_url
get_url:
url: "{{ automox_url }}"
dest: "{{ automox_temp_dir }}/{{ automox_temp_install_file }}"
owner: "{{ automox_install_script_owner }}"
group: "{{ automox_install_script_group }}"
mode: "{{ automox_install_script_mode }}"

- name: Execute Automox install script
command: "./{{ automox_temp_install_file }}"
args:
chdir: "{{ automox_temp_dir }}"
notify:
- restart Automox

- name: Ensure amagent is enabled and started
service:
name: amagent
state: started
enabled: yes

handlers:
- name: restart Automox
service:
name: amagent
state: restarted

This is copypasta of my updated playbook :)

Reply