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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7b120440-da9b-483a-965f-98cc9ab3f280n%40googlegroups.com.

Reply via email to