| 
				
					 | 
			9 anos atrás | |
|---|---|---|
| .. | ||
| README.md | 9 anos atrás | |
| __init__.py | 9 anos atrás | |
| ansible_playbook.py | 9 anos atrás | |
Run an Ansible playbook. Ansible is a free-software platform for configuring and managing computers which combines multi-node software deployment, ad hoc task execution, and configuration management.
Playbooks are Ansible’s configuration, deployment, and orchestration language. They can describe a policy you want your remote systems to enforce, or a set of steps in a general IT process.
This neuron can be used to perform complex operation with all modules available from Ansible.
| parameter | required | default | choices | comment | 
|---|---|---|---|---|
| task_file | YES | path to the Playbook file that contain tasks | 
Call the playbook named playbook.yml
  - name: "Ansible-test"
    signals:
      - order: "playbook"
    neurons:
      - ansible_playbook: "playbook.yml"
      - say:
          message: "Tache terminée"    
Content of the playbook. This playbook will use the URI module to interact with a webservice on a remote server.
---
- name: Playbook
  hosts: localhost
  gather_facts: no
  connection: local
  tasks:   
    - name: "Call api"
      uri:
          url: "http://192.168.0.17:8000/app"
          HEADER_Content-Type: "application/json"
          method: POST
          user: admin
          password: secret
          force_basic_auth: yes
          status_code: 201
          body_format: json
          body: >
            {"app_name": "music", "state": "start"}
Ansible contain a lot of modules that can be useful for Kalliope
Shell neuron or script neuron can perform same actions. Ansible is just a way to simplify some execution or enjoy some already made plugin.
Here is the example of synapse you would use to perform a call to a web service without Ansible:
- name: "start-music"
    signals:
      - order: "start music rock"
    neurons:
      - shell:
          cmd: "curl -i --user admin:secret -H \"Content-Type: application/json\" -X POST -d '{\"app_name\":\"music\",\"state\":\"start\"}' http://192.168.0.17:8000/app"