Sign inSign up

westwind027/ansible

By westwind027

•Updated almost 4 years ago

Image
0

619

westwind027/ansible repository overview

⁠ansible 1.0

Run ansible in Direktiv



⁠About ansible

This function provides Ansible in Direktiv. Ansible version 2.13.3 is installed with the following modules:

  • amazon.aws
  • google.cloud
  • azure.azcollection

The default configuration in ansible.cfg can be overwritten with either DirektivFiles or Direktiv variables.

Default ansible.cfg

inventory = hosts
host_key_checking = False
⁠Example(s)
⁠Function Configuration
functions:
- id: ansible
  image: direktiv.azurecr.io/functions/ansible:1.0
  type: knative-workflow
⁠Playbook with DirektivFiles
- 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
⁠Playbook with variables
- id: ansible
  type: action
  action:
    function: ansible
    files: 
    - key: playbook.yaml
      scope: workflow
    input:
      commands:
      - command: ansible-playbook playbook.yaml
⁠Custom ansible.cfg
- id: ansible
  type: action
  action:
    function: ansible
    files: 
    - key: ansible.cfg
      scope: workflow
    input:
      commands:
      - command: ansible-config view
⁠Secrets

No secrets required

⁠Request
⁠Request Attributes

PostParamsBody⁠

⁠Response

List of executed commands.

⁠Reponse Types

PostOKBody⁠

⁠Example Reponses
[
  {
    "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
  }
]
⁠Errors
TypeDescription
io.direktiv.command.errorCommand execution failed
io.direktiv.output.errorTemplate error for output generation of the service
io.direktiv.ri.errorCan not create information object from request
⁠Types
⁠ postOKBody

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
ansible[]PostOKBodyAnsibleItems⁠[]*PostOKBodyAnsibleItems
⁠ postOKBodyAnsibleItems

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
resultinterface{}⁠interface{}✓
successbooleanbool✓
⁠ postParamsBody

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
commands[]PostParamsBodyCommandsItems⁠[]*PostParamsBodyCommandsItems[{"command":"echo Hello"}]Array of commands.
files[]DirektivFile⁠[]apps.DirektivFileFile to create before running commands.
⁠ postParamsBodyCommandsItems

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
commandstringstringCommand to run
continuebooleanboolStops excecution if command fails, otherwise proceeds with next command
printbooleanbooltrueIf set to false the command will not print the full command with arguments to logs.
silentbooleanboolIf set to false the command will not print output to logs.

Tag summary

Content type

Image

Digest

sha256:57869c26e…

Size

436.8 MB

Last updated

almost 4 years ago

docker pull westwind027/ansible