ansible wget then exec scripts => get_url equivalent ansible wget then exec scripts => get_url equivalent curl curl

ansible wget then exec scripts => get_url equivalent


This worked for me:

  - name: Download zsh installer    get_url: url=https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh dest=/tmp/zsh-installer.sh  - name: Execute the zsh-installer.sh    shell: /tmp/zsh-installer.sh  - name: Remove the zsh-installer.sh    file: path=/tmp/zsh-installer.sh state=absent


@RaviTezu solution doesn't work because the file/script that you wish to execute must be on the machine where you execute your play/role.

As per the documentation here

The local script at path will be transferred to the remote node and then executed.

So one way to do it is by downloading the file locally and using a task like below:

- name: execute the script.sh  script: /local/path/to/script.sh

Or you can do this:

- name: download setup_5.x file to tmp dir  get_url:    url: https://deb.nodesource.com/setup_5.x    dest: /tmp/    mode: 0755- name: execute setup_5.x script  shell: setup_5.x  args:    chdir: /tmp/

I would go for the first method if you are uploading your own script, the second method is more useful in your case because the script might gets updated in time so you are sure each time you execute it it uses the latest script.


For me, the following statement worked:

 - name: "Execute Script"   shell: curl -sL https://rpm.nodesource.com/setup_6.x | bash -