Git Product home page Git Product logo

Comments (3)

Gregoire-Fremaux avatar Gregoire-Fremaux commented on June 28, 2024

Got the same issue and
{% raw %}{{ var_name }}{% endraw %}

is not working

Here is my workflow:

id: infrastructure_automation
namespace: tutorial

tasks:
  - id: setup
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: load_ssh_key
        type: io.kestra.plugin.core.storage.LocalFiles
        inputs:
          inventory.ini: |
            docker2 ansible_host=192.168.1.72 new_hostname=docker2
          playbook.yml: |
            ---
            - name: Update package
              hosts: all
              become: True
              tasks:
                - name: Update apt package index
                  ansible.builtin.apt:
                    update_cache: yes

                - name: Upgrade all apt packages
                  ansible.builtin.apt:
                    upgrade: dist
                - name: Set the hostname
                  hostname:
                    name: "{% raw %}{{new_hostname}}{% endraw %}"

                - name: Ensure /etc/hosts is updated with the new hostname
                  lineinfile:
                    path: /etc/hosts
                    regexp: "^127\.0\.1\.1\s+"
                    line: "127.0.1.1 {% raw %}{{new_hostname}}{% endraw %}"
                    state: present

                - name: Reboot the server
                  shell: sleep 2 && shutdown -r now
                  async: 1
                  poll: 0
                  ignore_errors: true

                - name: Wait for the reboot to complete if there was a change.
                  wait_for_connection:
                    connect_timeout: 20
                    sleep: 5
                    delay: 5
                    timeout: 300
          id_rsa: "{{ secret('SSH_KEY') }}"

      - id: "bash"
        type: "io.kestra.core.tasks.scripts.Bash"
        commands:
          - 'chmod 600 id_rsa'

      - id: ansible_task
        type: io.kestra.plugin.ansible.cli.AnsibleCLI
        docker:
          image: cytopia/ansible:latest-tools
        commands:
          - ansible-playbook -i inventory.ini --key-file id_rsa playbook.yml
        env:
          ANSIBLE_HOST_KEY_CHECKING: "False"
          ANSIBLE_REMOTE_USER: "root"
          ANSIBLE_USER: "root"
          ANSIBLE_PRIVATE_KEY_FILE: id_rsa
          

Environment
Kestra Version: latest
Operating System (Docker):

from kestra.

Gregoire-Fremaux avatar Gregoire-Fremaux commented on June 28, 2024

@loicmathieu

Can you help us this is very blocking

from kestra.

loicmathieu avatar loicmathieu commented on June 28, 2024

So the issue was that we render twice the file content, I fixed it, it will be backported for our next bugfix release on 0.17

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.