crowdstrike.falcon.sensor_update_policy module – Manage Falcon sensor update policies
Note
This module is part of the crowdstrike.falcon collection (version 4.9.1).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install crowdstrike.falcon.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: crowdstrike.falcon.sensor_update_policy.
New in crowdstrike.falcon 4.10.0
Synopsis
Create, update, delete, and manage Falcon sensor update policies.
Control sensor version updates, uninstall protection, and update schedules.
Manage host group assignments for sensor update policies.
Provides idempotent operations that only make changes when necessary.
Requirements
The below requirements are needed on the host that executes this module.
Sensor update policies [READ, WRITE] API scope
crowdstrike-falconpy >= 1.3.0
python >= 3.6
Parameters
Parameter |
Comments |
|---|---|
The registered result of the crowdstrike.falcon.auth module, or a dictionary containing the access_token and cloud keys. If provided, the client_id, client_secret, member_cid, and cloud options are ignored. Useful when needing to make multiple API calls to avoid rate limiting issues. |
|
The OAuth2 access token to use for authentication. |
|
The CrowdStrike cloud region to use. This can differ from the module’s cloud argument due to autodiscovery. |
|
The sensor version setting for the policy. Can be a specific sensor build string or version number from the builds API. Use sensor_update_builds_info module to get available build values for your tenant. Build format examples: For sensor updates disabled, omit this parameter entirely. Note: Simple values like |
|
The CrowdStrike API client ID to use. See the Falcon documentation for more information about API clients. The |
|
The CrowdStrike API secret that corresponds to the client ID. See the Falcon documentation for more information about API clients. The |
|
The CrowdStrike cloud region to use. All clouds are automatically discovered if not specified, except for the The Choices:
|
|
A description for the sensor update policy. Only used when state=present. |
|
Whether the policy should be enabled. Policies must be enabled to affect hosts. New policies are disabled by default. Choices:
|
|
Extended headers that are prepended to the default headers dictionary. |
|
The action to perform with the host groups specified in host_groups.
Requires host_groups to be specified. Choices:
|
|
List of host group IDs to add to or remove from the policy. Use with host_group_action to specify the operation. Only applicable for existing policies and when state=present. |
|
The CrowdStrike member CID for MSSP authentication. See the Falcon documentation for more information about API clients. The |
|
The name of the sensor update policy. Preferred method for idempotent operations - works for create, update, and delete. When used with platform_name, provides true Ansible idempotency across the entire policy lifecycle. Cannot be used to rename existing policies. |
|
The operating system platform for the policy. Required when using name for policy identification (create, update, or delete). Cannot be changed after policy creation. Choices:
|
|
Time blocks during which to prohibit sensor cloud updates. Dictionary containing scheduler configuration. Keys: Each schedule contains |
|
The ID of an existing sensor update policy. Alternative to name + platform_name for identifying existing policies. Provided for backward compatibility and when the policy ID is already known. |
|
The desired state of the sensor update policy.
Choices:
|
|
The uninstall protection setting for hosts with this policy.
Choices:
|
|
Custom User-Agent string to use for requests to the API. The user agent string is prepended to the default user agent string ( See RFC 7231 for more information. The |
Notes
Note
Idempotency: This module is idempotent and will only make changes when the current state differs from the desired state.
Preferred Pattern: Use name + platform_name for true Ansible idempotency. The same task definition can handle create, update, and delete operations by changing only the state parameter.
Alternative Pattern: Use sensor_update_policy ID for direct policy identification when the policy ID is already known or for backward compatibility.
Platform Types: The platform type cannot be changed after creation. To change a policy’s platform, delete the existing policy and create a new one.
Policy Deletion: Policies must be disabled before they can be deleted. The module handles this automatically.
Host Group Management: Adding or removing host groups only works with existing policies. Host group operations are performed after policy creation/update operations.
Examples
# PREFERRED IDEMPOTENT PATTERNS (using name + platform_name)
- name: Create a Windows sensor update policy (idempotent)
crowdstrike.falcon.sensor_update_policy:
name: "Windows Production Policy"
platform_name: Windows
description: "Windows hosts production sensor policy"
build: "20008|n-1|tagged|1"
uninstall_protection: ENABLED
state: present
- name: Update the same policy (same task definition, just different values)
crowdstrike.falcon.sensor_update_policy:
name: "Windows Production Policy"
platform_name: Windows
description: "UPDATED: Windows hosts production sensor policy"
build: "19320|Auto"
uninstall_protection: ENABLED
enabled: true
state: present
- name: Delete the same policy (same task definition, just state=absent)
crowdstrike.falcon.sensor_update_policy:
name: "Windows Production Policy"
platform_name: Windows
state: absent
- name: Create a Linux policy with scheduler (idempotent)
crowdstrike.falcon.sensor_update_policy:
name: "Linux Maintenance Policy"
platform_name: Linux
description: "Linux hosts with maintenance windows"
build: "18202|n-1|tagged|5"
scheduler:
enabled: true
timezone: "America/Chicago"
schedules:
- start: "08:00"
end: "14:00"
days: [1, 2, 3, 4, 5] # Weekdays
state: present
- name: Create policy with sensor updates disabled (omit build parameter)
crowdstrike.falcon.sensor_update_policy:
name: "No Updates Policy"
platform_name: "Mac"
description: "Mac hosts with updates disabled"
uninstall_protection: ENABLED
# Omit 'build' parameter to disable sensor updates
state: present
# ALTERNATIVE PATTERNS (using sensor_update_policy ID)
# These examples show the alternative approach using policy IDs
# for backward compatibility or when the ID is already known.
- name: Update an existing policy by ID
crowdstrike.falcon.sensor_update_policy:
sensor_update_policy: "12345678901234567890abcdef123456"
description: "Updated description for production policy"
- name: Enable a sensor update policy by ID
crowdstrike.falcon.sensor_update_policy:
sensor_update_policy: "12345678901234567890abcdef123456"
enabled: true
- name: Delete a sensor update policy by ID
crowdstrike.falcon.sensor_update_policy:
sensor_update_policy: "12345678901234567890abcdef123456"
state: absent
# HOST GROUP MANAGEMENT
# Host group operations work with both identification patterns
- name: Add host groups to a policy (using name)
crowdstrike.falcon.sensor_update_policy:
name: "Windows Production Policy"
platform_name: Windows
host_groups:
- "d78cd791785442a98ec75249d8c385dd"
- "a1b2c3d4e5f6789012345678901234ab"
host_group_action: add
- name: Remove host groups from a policy (using ID)
crowdstrike.falcon.sensor_update_policy:
sensor_update_policy: "12345678901234567890abcdef123456"
host_groups:
- "d78cd791785442a98ec75249d8c385dd"
host_group_action: remove
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Results of host group add/remove operations. Returned: when host_group_action is performed |
|
List of errors for host groups that failed to be processed. Returned: when there are failures Sample: |
|
List of host group IDs that were successfully processed. Returned: success Sample: |
|
Information about the sensor update policy that was created, updated, or managed. Returned: when state=present |
|
The user who created the policy. Returned: success Sample: |
|
The timestamp when the policy was created. Returned: success Sample: |
|
The description of the sensor update policy. Returned: success Sample: |
|
Whether the policy is enabled. Returned: success Sample: |
|
The host groups assigned to the policy. Returned: success Sample: |
|
The unique identifier of the sensor update policy. Returned: success Sample: |
|
The user who last modified the policy. Returned: success Sample: |
|
The timestamp when the policy was last modified. Returned: success Sample: |
|
The name of the sensor update policy. Returned: success Sample: |
|
The operating system platform the policy applies to. Returned: success Sample: |
|
The policy settings configuration. Returned: success |
|
The sensor version setting. Returned: success Sample: |
|
The update scheduler configuration. Returned: when configured Sample: |
|
The uninstall protection setting. Returned: success Sample: |