Skip to content

Commit

Permalink
Implemented force new token for agent_legacy role
Browse files Browse the repository at this point in the history
  • Loading branch information
mwester117 committed Sep 26, 2024
1 parent e5d2d6d commit 4f87c01
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
11 changes: 6 additions & 5 deletions roles/sentinelone_client_legacy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ No requirements.

## Role Variables

| Variable | Default | Description |
| -------- | ------- | ----------- |
| `sentinelone_client_filename` | *(empty)* | Package file to install |
| `sentinelone_client_token` | *(empty)* | Group/Site token |
| `sentinelone_client_gpgkey` | *(empty)* | GPG signing key to import |
| Variable | Default | Description |
| ------------------------------------ | --------- | -------------------------------- |
| `sentinelone_client_filename` | *(empty)* | Package file to install |
| `sentinelone_client_token` | *(empty)* | Group/Site token |
| `sentinelone_client_gpgkey` | *(empty)* | GPG signing key to import |
| `sentinelone_client_force_new_token` | `false` | Set to true to force a new token |

## Dependencies

Expand Down
1 change: 1 addition & 0 deletions roles/sentinelone_client_legacy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
sentinelone_client_token: ''
sentinelone_client_gpgkey: ''
sentinelone_client_force_new_token: false
7 changes: 7 additions & 0 deletions roles/sentinelone_client_legacy/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ argument_specs:
required: false
description:
- "GPG signing key to import"

sentinelone_client_force_new_token:
type: "bool"
required: false
default: false
description:
- "Set to true to force a new token"
10 changes: 10 additions & 0 deletions roles/sentinelone_client_legacy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
path: "/tmp/{{ sentinelone_client_filename | basename }}"
state: absent

- name: Check if we need to force a new token
ansible.builtin.file:
path: /opt/sentinelone/.INITIALIZATION_COMPLETE
state: absent
become: true
when:
- sentinelone_client_force_new_token
- sentinelone_client_token is defined
- sentinelone_client_token | length > 0

- name: Set Group/Site token
ansible.builtin.command: "/opt/sentinelone/bin/sentinelctl management token set {{ sentinelone_client_token }}"
args:
Expand Down

0 comments on commit 4f87c01

Please sign in to comment.