crowdstrike.falcon.response_policy_precedence module – Set the precedence of Falcon Real Time Response policies

Note

This module is part of the crowdstrike.falcon collection (version 4.15.0).

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.response_policy_precedence.

New in crowdstrike.falcon 4.16.0

Synopsis

  • Sets the order in which Falcon applies the Real Time Response policies of one platform. When a host is in the host groups of more than one policy, the policy with the highest precedence applies.

  • The API needs the full order of every policy of the platform except platform_default, so the module reads the current order and sends the full list.

  • The module changes the order only when it differs, so a second run makes no change.

  • The platform_default policy always has the lowest precedence and cannot be ordered.

  • In Flight Control, the policy search also returns the policies of the parent or the child CIDs. The module then reads the CID of the credentials and orders only the policies of that CID.

Requirements

The below requirements are needed on the host that executes this module.

  • Response policies [READ, WRITE] API scope

  • Sensor download [READ] API scope, only in Flight Control, to read the CID of the credentials

  • crowdstrike-falconpy >= 1.5.0

  • python >= 3.12

Parameters

Parameter

Comments

auth

dictionary

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.

access_token

string

The OAuth2 access token to use for authentication.

cloud

string

The CrowdStrike cloud region to use.

This can differ from the module’s cloud argument due to autodiscovery.

client_id

aliases: falcon_client_id

string

The CrowdStrike API client ID to use.

See the Falcon documentation for more information about API clients.

The FALCON_CLIENT_ID environment variable can also be used.

client_secret

aliases: falcon_client_secret

string

The CrowdStrike API secret that corresponds to the client ID.

See the Falcon documentation for more information about API clients.

The FALCON_CLIENT_SECRET environment variable can also be used.

cloud

string

The CrowdStrike cloud region to use.

All clouds are automatically discovered if not specified, except for the us-gov-1 cloud.

The FALCON_CLOUD environment variable can also be used.

Choices:

  • "us-1" ← (default)

  • "us-2"

  • "us-3"

  • "us-gov-1"

  • "us-gov-2"

  • "eu-1"

enforcement

string

With dynamic, the policies in policy_ids get the highest precedence, in that order, and the other policies keep their order after them.

With strict, policy_ids must list every policy on the platform except platform_default. The module fails before any change when one is missing.

Choices:

  • "dynamic" ← (default)

  • "strict"

ext_headers

dictionary

Extended headers that are prepended to the default headers dictionary.

member_cid

string

The CrowdStrike member CID for MSSP authentication.

See the Falcon documentation for more information about API clients.

The FALCON_MEMBER_CID environment variable can also be used.

platform_name

string / required

The platform of the Real Time Response policies. The value is case-sensitive.

Choices:

  • "Windows"

  • "Mac"

  • "Linux"

policy_ids

list / elements=string / required

The IDs of the Real Time Response policies, highest precedence first.

The IDs are compared without regard to case, after leading and trailing spaces are removed. An ID must be in the list only once.

The module fails before any change when an ID is not a policy on platform_name, or is the platform_default policy.

user_agent

string

Custom User-Agent string to use for requests to the API.

The user agent string is prepended to the default user agent string (crowdstrike-ansible/<version>).

See RFC 7231 for more information.

The FALCON_USER_AGENT environment variable can also be used.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target, if not supported the action will be skipped.

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

platform

Platforms: all

Target OS/families that can be operated against

See Also

See also

crowdstrike.falcon.response_policy

Manage Falcon Real Time Response policies.

crowdstrike.falcon.response_policy_info

Get information about Falcon Real Time Response policies.

Response Policies API reference

The CrowdStrike API operations that this module uses.

Examples

- name: Give two Windows Real Time Response policies the highest precedence
  crowdstrike.falcon.response_policy_precedence:
    platform_name: Windows
    policy_ids:
      - "abcdef1234567890abcdef1234567890"
      - "1234567890abcdef1234567890abcdef"

- name: Set the full order of the Linux Real Time Response policies
  crowdstrike.falcon.response_policy_precedence:
    platform_name: Linux
    enforcement: strict
    policy_ids: "{{ linux_policy_ids }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

precedence

list / elements=string

The IDs of the Real Time Response policies of the platform in precedence order, without platform_default, read again from the API after the change.

In check mode, the order that the module would set.

Returned: success

Sample: ["abcdef1234567890abcdef1234567890", "1234567890abcdef1234567890abcdef"]

previous_precedence

list / elements=string

The IDs in precedence order before the change.

Returned: success

Sample: ["1234567890abcdef1234567890abcdef", "abcdef1234567890abcdef1234567890"]

Authors

  • Gabe Alford (@redhatrises)