Without any real data it's impossible to tell.
Can you at a minimum post the error message?

Sent from Gmail Mobile


On Sun, Aug 18, 2024 at 13:14 Yogita Patil <[email protected]> wrote:

> Hi All,
>
> I am simply unable to execute a shell script on the remote host - this is
> my code (all other tasks run correctly except the execute task)
>
> - name: Power consumption test
>   hosts: all
>   tasks:
>
>      - name: Transfer the script
>        ansible.builtin.copy:
>          src: power_consumption.sh
>          dest: /usr/src/power_consumption.sh
>          mode: '0777'
>
>      - name: Execute the script
> #       command: ./usr/src/power_consumption.sh
>        command: "{{ item }}"
>        args:
>          chdir: "/usr/src/"
>        with_items:
>         - "./power_consumption.sh"
>        ignore_errors: true
>
>      - name: Remove shell script from remote server
>        file:
>          path: /usr/src/power_consumption.sh
>          state: absent
>
>      - name: Copy shell script output from remote server
>        fetch:
>          src: /usr/src/{{ ansible_fqdn }}.txt
>          dest: /usr/src
>          mode: '0777'
>          with_fileglob:
>           _ "*.txt"
>
>
> I have also tried with the shell: , script: sh ways of executing the
> script and none of them work, can someone tell me what I am doing wrong?
> TIA.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7b120440-da9b-483a-965f-98cc9ab3f280n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7b120440-da9b-483a-965f-98cc9ab3f280n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZ_hvBiMiKOfBD3SzitJ1p0Q2znd_%2B%2BLb4%2BHVFSxm0EKw%40mail.gmail.com.

Reply via email to