Playbook executed fine but output not as expected

0 votes

I have the following yaml file:

---
- hosts: all
  gather_facts: yes
  connection: local
  tasks:
    - name: Check the date on the server.
      action: command touch /opt/b
    - name: cat the Content
      action: command cat /opt/b

It gets executed without any errors but it's supposed to create a file but it hasn't.

Feb 7 in Ansible by Nisha
12 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hey @Nisha, you've mentioned this line on your playbook:

connection: local

It means this is getting executed in your local system and hence the file created must be in your local system.

Remove that line and try again. 

answered Feb 7 by Pragya

Related Questions In Ansible

0 votes
1 answer

ignore_errors : true does not work as expected

Hey @Ali,  You can use the flag ignore_errors ...READ MORE

answered Jan 8 in Ansible by Lisa
44 views
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Ansible playbook with jenkins not working

When you execute the playbook under Jenkins, ...READ MORE

answered Jan 17 in Ansible by Sameer
77 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.