Playbook executed fine but output not as expected

0 votes

I have the following yaml file:

- hosts: all
  gather_facts: yes
  connection: local
    - 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

1 answer to this question.

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
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
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