Failed to run curl command in Ansible task

Viewed 6936

I have blow ansible task yml file to install nodejs on an ubuntu system.

---
- name: setup nodejs
  script: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

- name: install nodejs
  sudo: yes
  apt:
    pkg: nodejs
    state: latest

- name: install npm
  sudo: yes
  apt:
    pkg: npm
    state: latest

- name: install yarn
  sudo: yes
  apt:
    pkg: yarn
    state: latest

I get below error when run ansible-playbook:

fatal: [xxxx.ap-southeast-2.compute.amazonaws.com]: FAILED! => {"changed": false, "failed": true, "msg": "Unable to find 'curl' in expected paths."}

The curl is available on the path in the remote server why it still complain about it?

3 Answers
Related