logicmonitor / logicmonitor.integration / 2.0.3 / module / lm_device LogicMonitor Device Ansible module for managing devices. | "added in version" 1.0.0 of logicmonitor.integration" Authors: Carlos Alvarenga (@cealvar) preview | supported by communitylogicmonitor.integration.lm_device (2.0.3) — module
Install with ansible-galaxy collection install logicmonitor.integration:==2.0.3
collections: - name: logicmonitor.integration version: 2.0.3
LogicMonitor is a hosted, full-stack, infrastructure monitoring platform.
This module manages devices within your LogicMonitor account (i.e. add, update, remove, sdt).
# Example of adding a device - name: Add Device hosts: localhost tasks: - name: Add LogicMonitor Device lm_device: action: add company: batman access_id: "id123" access_key: "key123" display_name: "Ansible Device" hostname: 127.0.0.1 collector_id: 1 groups: ["Devices by Type/Misc", 4] description: "test" disable_alerting: true properties: { snmp.community: commstring, type: dev }
# Example of updating a device - name: Update Device hosts: localhost tasks: - name: Update LogicMonitor Device lm_device: action: update company: batman access_id: "id123" access_key: "key123" id: 1 display_name: "New Ansible Device" hostname: 127.0.0.1 collector_description: "localhost 123" groups: ["Devices by Type/Misc", 4] description: "test" disable_alerting: true properties: { snmp.community: commstring, type: dev } optype: add
# Example of removing a device - name: Remove Device hosts: localhost tasks: - name: Remove LogicMonitor Device lm_device: action: remove company: batman access_id: "id123" access_key: "key123" display_name: "Ansible_Device"
# Example of putting a device in SDT - name: SDT Device hosts: localhost tasks: - name: Place LogicMonitor device into Scheduled downtime (default is 30 min.) logicmonitor: action: sdt company: batman access_id: "id123" access_key: "key123" display_name: "127.0.0.1_collector_4"
id: description: - ID of the device to target. - Required for update, remove, sdt if both display_name and hostname aren't provided. type: int action: choices: - add - update - remove - sdt description: - The action you wish to perform on the device. - Add = Add a device to your LogicMonitor account. - Update = Update properties, description, etc for a device in your LogicMonitor account. - Remove = Remove a device from your LogicMonitor account. - SDT = Schedule downtime for a device in your LogicMonitor account. required: true type: str groups: description: - A comma-separated list of device groups that the device should be a member of. - The list can contain device group IDs and/or full paths. - Must be enclosed within [] brackets. - Optional for managing devices (action=add or action=update). elements: str type: list optype: choices: - add - replace - refresh default: replace description: - A string describing the operation on properties when updating device... (1) replace - a property would be updated if it exists already else a new property will be created (2) refresh - a property would be updated if it exists already else a new property will be created, any existing property not provided during update will be removed (3) add - a property would be ignored if it exists already else a new property will be created - Optional for action=update. type: str comment: description: - The note/comment to add to an SDT action. - Optional for action=sdt. type: str company: description: - The LogicMonitor account company name. - A user logging into their account at "batman.logicmonitor.com" would use "batman". required: true type: str duration: default: 30 description: - The duration (minutes) of the Scheduled Down Time (SDT). - Optional for action=sdt. type: int end_time: description: - The time that the Scheduled Down Time (SDT) should end. - Format must be 'yyyy-MM-dd HH:mm' or "yyyy-MM-dd HH:mm z" where z is "am" or "pm". The former is used for a 24-hr clock while the latter is for a 12-hr clock. - If end time is provided it will be used otherwise duration would be used (duration defaults to 30 min). - Optional for action=sdt. type: str hostname: description: - The hostname (name) of a device (host) in your LogicMonitor account. - Required for action=add. - Required for update, remove, sdt if both id and display_name aren't provided. type: str access_id: description: - The Access ID API token associated with the user's account that's used to query the LogicMonitor API. - Please contact your LogicMonitor admin if you need new API tokens created for your account. required: true type: str access_key: description: - The Access Key API token associated with the user's account that's used to query the LogicMonitor API. - Please contact your LogicMonitor admin if you need new API tokens created for your account. - Must start with the "!unsafe" keyword if the the key starts with a special character (e.g. '[', ']', etc.) to prevent playbook issues. required: true type: str properties: description: - A JSON object of properties to configure for the LogicMonitor device. - This parameter will add or update existing properties in your LogicMonitor account. - Must be enclosed within {} braces. - Optional for managing devices (action=add or action=update). type: dict start_time: description: - The time that the Scheduled Down Time (SDT) should begin. - Format must be "yyyy-MM-dd HH:mm" or "yyyy-MM-dd HH:mm z" where z is "am" or "pm". The former is used for a 24-hr clock while the latter is for a 12-hr clock. - Optional for action=sdt. - Defaults to the time action is executed. - Required in case start time differ from the execution time of action. type: str description: description: - The long text description of the device to add. - Optional for managing devices (action=add or action=update). type: str auto_balance: choices: - true - false description: - A boolean flag to denote whether or not the collector group configured for the device should use auto balancing. - This value should only be True when the configured collector group is an Auto-Balanced Collector Group (ABCG). - Optional for managing devices (action=add or action=update). type: bool collector_id: description: - ID of a collector to monitor newly added device. - Required for action=add if a non-ABCG is being configured (auto_balance=False) and collector_description isn't provided. - NOTE - A collector can't be manually configured for an existing device (action=update) when an ABCG is in use and auto balance isn't being disabled. type: int display_name: description: - The display name of a device (host) in your LogicMonitor account. - Required for action=add. - Required for update, remove, sdt if both id and hostname aren't provided. type: str force_manage: choices: - true - false default: true description: - A boolean flag to enable/disable the feature to ... (1) update a device when the initial action=add because the device exists or (2) add a device when the initial action=update because the device doesn't exist. - Optional for managing devices (action=add or action=update). type: bool disable_alerting: choices: - true - false description: - A boolean flag to enable/disable alerting for a device. - Defaults to False when creating a device. - Optional for managing devices (action=add or action=update). type: bool collector_group_id: description: - ID of the collector group to configure for the device. - Required for action=add if an ABCG is being configured (auto_balance=True) and collector_group_name isn't provided. type: int collector_group_name: description: - Name of the collector group to configure for the device. - Default/Ungrouped group name should be denoted by empty string "" or "@default". - Required for action=add if an ABCG is being configured (auto_balance=True) and collector_group_name isn't provided. type: str collector_description: description: - Description of a collector to monitor newly added device. - Required for action=add if a non-ABCG is being configured (auto_balance=False) and collector_id isn't provided. - NOTE - A collector can't be manually configured for an existing device (action=update) when an ABCG is in use and auto balance isn't being disabled. type: str
action_performed: description: a string describing which action was performed returned: success sample: add type: str addition_info: description: any additional detail related to the action returned: success sample: Device updated successfully type: str changed: description: a boolean indicating that changes were made to the target returned: changed sample: true type: bool data: description: contain device or sdt details returned: success sample: display_name: new_device hostname: 192.168.147.188 id: 13 type: dict failed: description: a boolean indicating that execution failed returned: failed sample: false type: bool success: description: flag indicating that execution was successful returned: success sample: true type: bool