Git Product home page Git Product logo

Comments (6)

Tohjuler avatar Tohjuler commented on July 22, 2024 1

Maybe i have misunderstood something then, because i have uploaded it as namespace files, but used WorkingDirectory to access them, i believed you needed that to access them.

But here is my workflow with the ansible playbook.
prod_files.zip
just ask if you need anything else :)

from kestra.

Tohjuler avatar Tohjuler commented on July 22, 2024 1

Thanks for the help.

from kestra.

anna-geller avatar anna-geller commented on July 22, 2024

could you provide a reproducer flow that shows the issue when using WorkingDirectory with Ansible?

There are also some alternative options for storing the Ansible files e.g. you can upload those as Namespace Files and this way you don't need to use the WorkingDirectory task

from kestra.

anna-geller avatar anna-geller commented on July 22, 2024

this should work:

image

feel free to close the issue if this works for you 👍

id: Check-Diskspace
namespace: company.myteam
description: "Check if the disk usage is over 80% and if send notfy."

tasks:
  - id: ansible_task
    type: io.kestra.plugin.ansible.cli.AnsibleCLI
    inputFiles:
      inventory.ini: "{{ read('ansible-inventories/Main-Servers.ini') }}"
      playbook.yml: "{{ read('ansible-playbooks/check-diskspace.yml') }}"
      id_rsa: "{{ secret('DEFAULT_KEY') }}"
    namespaceFiles:
      enabled: true
    docker:
      image: cytopia/ansible:latest-tools
      pullPolicy: IF_NOT_PRESENT
      user: "1000"
    commands:
      - ansible-playbook -i inventory.ini --key-file id_rsa --extra-vars "hosts=default" playbook.yml
    env:
      ANSIBLE_HOST_KEY_CHECKING: "False"
      ANSIBLE_REMOTE_USER: "tohjuler"

triggers:
  - id: daily-runner
    type: io.kestra.plugin.core.trigger.Schedule
    cron: 0 1 * * *

errors:
  - id: Ntfy-Error
    type: io.kestra.plugin.core.http.Request
    body: A error happend with the Check-Diskspace workflow.
    method: POST
    uri: <url>

disabled: false
```

from kestra.

anna-geller avatar anna-geller commented on July 22, 2024

btw if you want to avoid taking into account {, you can use the raw tag https://kestra.io/docs/concepts/expression/tag#raw

it's used by Pebble as a template separator

from kestra.

Tohjuler avatar Tohjuler commented on July 22, 2024

Didn't work with the new version, same error as before Unable to find `hosts` used in the expression `- hosts: "{{ hosts }}".
But it worked added the raw tag around the read for the playbook.
playbook.yml: "{% raw %}{{ read('ansible-playbooks/check-diskspace.yml') }}{% endraw %}"

from kestra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.