O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

OSMC 2022 | IGNITE: Event Driven Ansible by Sebastian Gumprich

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio

Confira estes a seguir

1 de 20 Anúncio
Anúncio

Mais Conteúdo rRelacionado

Mais recentes (20)

Anúncio

OSMC 2022 | IGNITE: Event Driven Ansible by Sebastian Gumprich

  1. 1. Automatic Healing with Ansible ...Or with Event Driven Ansible!
  2. 2. About Me Sebastian Gumprich T-Systems MMS GmbH Lots of time
  3. 3. What is Event Driven Ansible? > a new way to enhance and expand automation. It improves IT speed and agility, while enabling consistency and resilience. IFTT for sysadmins
  4. 4. How does it work? Playbooks + Rulebook =
  5. 5. Sources Webhooks Alertmanager URLs Files more to come
  6. 6. Rules What should happen when?
  7. 7. Conditions Alerts from Alertmanager Unreachable Website Newly created files Message in Webhook
  8. 8. Actions run_playbook run_module set_fact
  9. 9. Rulebook --- - name: Listen for events on a webhook hosts: all ## Define our source for events sources: - ansible.eda.webhook: host: 0.0.0.0 port: 5000 ## Define the conditions we are looking for rules: - name: Say Hello condition: event.payload.message == "Ansible is super cool" ## Define the action we should take should the condition be met action: run_playbook: name: say-what.yml
  10. 10. Why? Ansible is push-based Event Driven Ansible is event-based
  11. 11. Helps to automatically fix and troubleshoot problems
  12. 12. Installation apt-get --assume-yes install build-essential maven openjdk-17-jdk python3-dev python3-pip export JDK_HOME=/usr/lib/jvm/java-17-openjdk-amd64 export JAVA_HOME=$JDK_HOME export PIP_NO_BINARY=jpy export PATH=$PATH:~/.local/bin pip3 install -U Jinja2 pip3 install ansible ansible-rulebook ansible-runner wheel
  13. 13. Add a Playbook and Inventory playbook: - hosts: localhost connection: local tasks: - debug: msg: "Thank you, my friend!" inventory localhost
  14. 14. Running it > ansible-rulebook --rulebook webhook-rule.yml -i inventory.yml --verbose INFO:ansible_rulebook.app:Starting sources INFO:ansible_rulebook.app:Starting rules INFO:ansible_rulebook.engine:run_ruleset ... INFO:ansible_rulebook.engine:load source INFO:ansible_rulebook.engine:load source filters INFO:ansible_rulebook.engine:Calling main in ansible.eda.webhook INFO:ansible_rulebook.engine:Waiting for event from Listen for events on a webhook
  15. 15. Using it What I do > curl -d "{"message": "Ansible is super cool"}" http://127.0.0.1:5000/endpoint What Event Driven Ansible does INFO:ansible_rulebook.engine:action args: {'name': 'say-what.yml'} INFO:ansible_rulebook.builtin:running Ansible playbook: say-what.yml INFO:ansible_rulebook.builtin:ruleset: Listen for events on a webhook, rule: Say Hello INFO:ansible_rulebook.builtin:Calling Ansible runner PLAY [say thanks] ************************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [debug] ******************************************************************* ok: [localhost] => { "msg": "say what" }
  16. 16. Dynamic loading of Playbooks (but not rulebooks)
  17. 17. Event Driven Ansible Server Like AWX/Tower/whatever it's called now
  18. 18. Event Driven Ansible Server #2 Web-UI REST-API
  19. 19. Is it production-ready? In Early Development Core functionality is there
  20. 20. Thanks! Let's chat!

×