ripclawffb.helix_core.helix_core_protect module – Manage the protection table on Perforce Helix Core
Note
This module is part of the ripclawffb.helix_core collection (version 1.3.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 ripclawffb.helix_core.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ripclawffb.helix_core.helix_core_protect.
New in ripclawffb.helix_core 1.1.0
Synopsis
Manage access control via the Perforce protection table.
Supports two modes: ‘entry’ for managing individual entries, ‘replace’ for whole-table management.
This module supports check mode.
Requirements
The below requirements are needed on the host that executes this module.
P4Python pip module is required
Parameters
Parameter |
Comments |
|---|---|
Character set used for translation of unicode files Can also use ‘P4CHARSET’ environment variable Default: |
|
Note that Choices:
|
|
The login password Can also use ‘P4PASSWD’ environment variable |
|
Where to insert new entries in the protections table. Only applies when state=present and mode=entry. Can be If the active protection entry already exists exactly, its position will not be changed. We only insert new entries at Default: |
|
List of protection entries Each entry must have Required when state is |
|
The access level (list, read, open, write, admin, super, review, =read, =open, =write, =branch) |
|
The host IP/pattern, or * for any host |
|
The user or group name, or * for all |
|
The depot path pattern (e.g., //…, //depot/…) |
|
The type of entity (user or group) Choices:
|
|
The hostname/ip and port of the server (perforce:1666) Can also use ‘P4PORT’ environment variable |
|
Determines if the protection entries are added or removed
Choices:
|
|
A user with access to perform this operation Can also use ‘P4USER’ environment variable |
See Also
See also
- Helix Core Protect
Manage access permissions
- P4Python Pip Module
Python module to interact with Helix Core
Examples
# Add individual protection entries (default mode)
- name: Add developer access
ripclawffb.helix_core.helix_core_protect:
state: present
protections:
- access: write
type: group
name: developers
host: "*"
path: //depot/...
server: '1666'
user: bruno
charset: auto
password: ''
# Remove specific protection entries
- name: Remove contractor access
ripclawffb.helix_core.helix_core_protect:
state: absent
protections:
- access: read
type: group
name: contractors
host: "*"
path: //depot/...
server: '1666'
user: bruno
charset: auto
password: ''
# Replace entire protection table
- name: Set complete protection table
ripclawffb.helix_core.helix_core_protect:
state: present
mode: replace
protections:
- access: super
type: user
name: admin
host: "*"
path: //...
- access: write
type: group
name: developers
host: "*"
path: //depot/...
server: '1666'
user: bruno
charset: auto
password: ''
# Add a base rule at the beginning of the table
- name: Add base rule at beginning
ripclawffb.helix_core.helix_core_protect:
state: present
position: beginning
protections:
- access: read
type: group
name: everyone
host: "*"
path: //...
server: '1666'
user: bruno
charset: auto
password: ''
# Insert a rule at a specific index
- name: Insert rule at index 2
ripclawffb.helix_core.helix_core_protect:
state: present
position: '2'
protections:
- access: write
type: group
name: qa_team
host: "*"
path: //depot/qa/...
server: '1666'
user: bruno
charset: auto
password: ''
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The action performed on the resource. Returned: always Can only return:
Sample: |
|
Whether any changes were made to the protection table. Returned: always Sample: |
|
Entries that were added or removed. Returned: always Sample: |
|
A dictionary containing ‘before’ and ‘after’ state of the resource. Returned: when diff mode is enabled |
|
The state of the resource after the action. Returned: success |
|
The state of the resource before the action. Returned: success |
|
The protection table entries after the operation. Returned: always Sample: |