ansible
A set of Ansible tasks.
ansible template details
- Status: stable
- File: https://gitlab.com/op_so/task/task-templates/-/raw/main/Taskfile.d/ansible.yml
- Home: https://gitlab.com/op_so/task/task-templates
- License: MIT
List of tasks
Tasks | Description |
---|---|
ansible:command |
Run an Ansible command. Arguments: CMD|C="ansible --version" [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:galaxy-install |
Ansible Galaxy install requirements. Arguments: REQ|R="provision/requirements.txt" [FORCE|F= |
ansible:galaxy-publish |
[ANSIBLE] Publish collection in Galaxy. Arguments: VERSION|V=1.2.3 NAMESPACE|N=jfx COLLECTION|C=metrics TOKEN|T=abcdefg... [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:lint |
Lint Ansible playbooks and roles. Arguments: ARG|A="--force-color --offline -p playbook.yml" [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:ping |
Run Ansible ping. Arguments: ARG|A="-i inventory all" [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:playbook |
Run Ansible playbook. Arguments: ARG|A="-i inventory playbook.yml" [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:ssh |
SSH a host with Ansible inventory configuration. Arguments: FILE|F=inventory HOST|H=my_host (*) |
ansible:vault |
Operation on a file with Ansible Vault. Arguments: FILE|F=key.pem ACTION|A=ENC|DEC|EDIT [IMG|I=jfxs/ansible:latest] [PULL|P= |
ansible:vault-variable |
Operation on a variable with Ansible Vault. Arguments: VARIABLE|V=my_var SECRET|S=my_secret [IMG|I=jfxs/ansible:latest] [PULL|P= |
global variables
Variables | Description | Default value |
---|---|---|
DOCKER_RUN_OPTS |
Optional Docker options for docker run command | - |
IMAGE_ANSIBLE |
Default Ansible image | jfxs/ansible |
ansible:command
Run an Ansible command. Arguments: CMD|C="ansible --version" [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Run an Ansible command.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:command CMD|C=<ansible_command> [IMG|I=<docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
CMD | C |
Ansible command to run (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker
ansible:galaxy-install
Ansible Galaxy install requirements. Arguments: REQ|R="provision/requirements.txt" [FORCE|F=
[ANSIBLE] Ansible Galaxy install requirements.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:galaxy-install REQ|R=<file_path> [FORCE|F=<y|Y>] [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>] [PROXY|PX=<proxy_url>]
Arguments | Description |
---|---|
REQ | R |
Requirements file path (required) |
FORCE | F |
Force to install the last version of collections (optional, by default no) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
PROXY | PX |
Proxy (optional) |
Requirements:
- ansible or docker
ansible:galaxy-publish
[ANSIBLE] Publish collection in Galaxy. Arguments: VERSION|V=1.2.3 NAMESPACE|N=jfx COLLECTION|C=metrics TOKEN|T=abcdefg... [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Publish collection in Galaxy.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:galaxy-publish FILE|F=<file_path> ACTION|A=<ENC|DEC|EDIT> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
VERSION | V |
Version of the collection (required) |
NAMESPACE | N |
Namespace of the collection (required) |
COLLECTION | C |
Collection name (required) |
TOKEN | T |
Galaxy token (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker
ansible:lint
Lint Ansible playbooks and roles. Arguments: ARG|A="--force-color --offline -p playbook.yml" [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Lint Ansible playbook and roles.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:lint ARG|A=<arguments_list> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
ARG | A |
Arguments of the ansible-lint (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible-lint or docker
ansible:ping
Run Ansible ping. Arguments: ARG|A="-i inventory all" [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Run Ansible ping.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:ping ARG|A=<arguments_list> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
ARG | A |
Arguments of the command to run (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker
ansible:playbook
Run Ansible playbook. Arguments: ARG|A="-i inventory playbook.yml" [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Run Ansible playbook.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:playbook ARG|A=<arguments_list> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
ARG | A |
Arguments of the playbook to run (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker
ansible:ssh
SSH a host with Ansible inventory configuration. Arguments: FILE|F=inventory HOST|H=my_host (*)
[ANSIBLE] SSH a host from inventory options.
Usage: task ansible:ssh FILE|F=<inventory_path> HOST|H=<nostname>
Arguments | Description |
---|---|
FILE | F |
Path to inventory file (required) |
HOST | H |
Hostname of server defined in inventory (required) |
Requirements:
- ssh
ansible:vault
Operation on a file with Ansible Vault. Arguments: FILE|F=key.pem ACTION|A=ENC|DEC|EDIT [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Operation on a file with Ansible Vault.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:vault FILE|F=<file_path> ACTION|A=<ENC|DEC|EDIT> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
FILE | F |
Path of the file (required) |
ACTION | A |
Action ENC: encrypt, DEC: decrypt, EDIT: edit the file (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker
ansible:vault-variable
Operation on a variable with Ansible Vault. Arguments: VARIABLE|V=my_var SECRET|S=my_secret [IMG|I=jfxs/ansible:latest] [PULL|P=
[ANSIBLE] Operation on a variable with Ansible Vault.
If Ansible command is in the path and IMG/I argument is not set, the local Ansible command is executed,
otherwise an Ansible Docker image is used.
Usage: task ansible:vault-variable VARIABLE|V=<variable_name> SECRET|S=<secret_value> [IMG|I=<Docker_image:tag>] [PULL|P=<n|N>]
Arguments | Description |
---|---|
VARIABLE | V |
The variable name (required) |
SECRET | S |
The secret to encrypt (required) |
IMG | I |
Docker Ansible image to use (optional, by default {{.IMAGE_ANSIBLE}}) |
PULL | P |
Pull docker image (optional, by default yes) |
Requirements:
- ansible or docker