Question:
Am running ansible play-book but getting below error, -using ansible 2.7.6, ubuntu 16.04.
in playbook am mentioned
1 2 |
( |
I tried without become-yes,ubuntu,sudo that also getting the same issue and ansible saying:
1 2 3 4 5 6 |
The offending line appears to be: - name: build npm ^ here |
1 2 3 4 5 6 7 8 9 10 11 12 |
- hosts: all vars: app_dir: /home/ubuntu/app/backend-app-name tasks: - name: build npm command: "chdir={{ app_dir }} {{ item }}" with_items: - /usr/bin/npm run build become: yes become_user: ubuntu become_method: sudo |
Answer:
Indentation is wrong. Correct syntax is
1 2 3 4 5 6 7 8 9 |
tasks: - name: build npm command: ... with_items: - /usr/bin/npm run build become: yes become_user: ubuntu become_method: sudo |