Question:
1 2 3 |
- name: Go to the folder command: chdir=/opt/tools/temp |
When I run my playbook, I get:
1 2 3 4 |
TASK: [Go to the folder] ***************************** failed: [host] => {"failed": true, "rc": 256} msg: no command given |
Any help is much appreciated.
Answer:
There’s no concept of current directory in Ansible. You can specify current directory for specific task, like you did in your playbook. The only missing part was the actual command to execute. Try this:
1 2 3 |
- name: Go to the folder and execute command command: chdir=/opt/tools/temp ls |