Run ansible in Direktiv
This function provides Ansible in Direktiv. Ansible version 2.13.3 is installed with the following modules:
The default configuration in ansible.cfg can be overwritten with either DirektivFiles or Direktiv variables.
Default ansible.cfg
inventory = hosts
host_key_checking = False
functions:
- id: ansible
image: direktiv.azurecr.io/functions/ansible:1.0
type: knative-workflow
- id: ansible
type: action
action:
function: ansible
input:
files:
- name: playbook.yaml
data: |
---
- name: "Ansible Playbook"
hosts: localhost
connection: local
tasks:
- name: "ls on localhost"
shell: "ls -l"
register: "output"
commands:
- command: ansible-playbook playbook.yaml
- id: ansible
type: action
action:
function: ansible
files:
- key: playbook.yaml
scope: workflow
input:
commands:
- command: ansible-playbook playbook.yaml
- id: ansible
type: action
action:
function: ansible
files:
- key: ansible.cfg
scope: workflow
input:
commands:
- command: ansible-config view
No secrets required
List of executed commands.
[
{
"result": {
"custom_stats": {},
"global_custom_stats": {},
"plays": [
{
"play": {
"duration": {
"end": "2022-08-31T11:55:44.265820Z",
"start": "2022-08-31T11:55:40.276975Z"
},
"id": "1ab65ae3-cbb9-49dc-b739-000000000005",
"name": "Ansible Playbook"
},
"tasks": []
}
]
},
"success": true
},
{
"result": "[defaults]\ninventory = hosts\nhost_key_checking = False",
"success": true
}
]
| Type | Description |
|---|---|
| io.direktiv.command.error | Command execution failed |
| io.direktiv.output.error | Template error for output generation of the service |
| io.direktiv.ri.error | Can not create information object from request |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| ansible | []PostOKBodyAnsibleItems | []*PostOKBodyAnsibleItems |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| result | interface{} | interface{} | ✓ | |||
| success | boolean | bool | ✓ |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| commands | []PostParamsBodyCommandsItems | []*PostParamsBodyCommandsItems | [{"command":"echo Hello"}] | Array of commands. | ||
| files | []DirektivFile | []apps.DirektivFile | File to create before running commands. |
Properties
| Name | Type | Go type | Required | Default | Description | Example |
|---|---|---|---|---|---|---|
| command | string | string | Command to run | |||
| continue | boolean | bool | Stops excecution if command fails, otherwise proceeds with next command | |||
| boolean | bool | true | If set to false the command will not print the full command with arguments to logs. | |||
| silent | boolean | bool | If set to false the command will not print output to logs. |
Content type
Image
Digest
sha256:57869c26e…
Size
436.8 MB
Last updated
almost 4 years ago
docker pull westwind027/ansible