Version control¶
Old-style docs:
-
nornir.plugins.tasks.version_control.
gitlab
(task: nornir.core.task.Task, url: str, token: str, repository: str, filename: str, content: str = '', action: str = 'create', dry_run: Optional[bool] = None, branch: str = 'master', destination: str = '', ref: str = 'master', commit_message: str = '') → nornir.core.task.Result¶ Exposes some of the Gitlab API functionality for operations on files in a Gitlab repository.
Example
- nornir.run(files.gitlab,
- action=”create”, url=”https://gitlab.localhost.com”, token=”ABCD1234”, repository=”test”, filename=”config”, ref=”master”)
Parameters: - dry_run – Whether to apply changes or not
- url – Gitlab instance URL
- token – Personal access token
- repository – source/destination repository
- filename – source/destination file name
- content – content to write
- action –
create
,update
,get
- branch – destination branch
- destination – local destination filename (only used in get action)
- ref – branch, commit hash or tag (only used in get action)
- commit_message – commit message
Returns: - changed (
bool
): - diff (
str
): unified diff
Return type: Result object with the following attributes set