FAILED changed false msg src and content are mutually exclusive

0 votes

Hi Guys,

I am trying to copy files from the controller node to the managed node. But it is showing me the below error.

fatal: [192.168.0.180]: FAILED! => {"changed": false, "msg": "src and content are mutually exclusive"}

I am using the below block of code.

- hosts: all
  tasks:
  - package:
      name: httpd
      state: present
  - copy:
      content: "#This playbook is used to replace the content of a file"
      src: home.html
      dest: /var/www/html/home.html
  - service:
      name: httpd
      state: started
  - service:
      name: firewalld
      state: stopped
Aug 2, 2020 in Ansible by akhtar
• 38,180 points
691 views

1 answer to this question.

0 votes

Hi@akhtar,

You can't use content and src argument together. You need to use only one argument at a time. The src argument is used to copy files from the controller node to managed nodes. And the content argument is used to copy the content to managed nodes. So you can change your code as given below.

- hosts: all
  tasks:
  - package:
      name: httpd
      state: present
  - copy:
      content: "#This playbook is used to replace the content of a file"
      dest: /var/www/html/home.html
  - service:
      name: httpd
      state: started
  - service:
      name: firewalld
      state: stopped
answered Aug 2, 2020 by MD
• 95,220 points

Related Questions In Ansible

0 votes
1 answer

FAILED! => {"changed": false, "msg": "Parameter 'description' is required."}

Hi@akhtar, You got this error because you did ...READ MORE

answered Aug 7, 2020 in Ansible by MD
• 95,220 points
250 views
0 votes
1 answer

fatal: [localhost]: FAILED! => {"changed": false, "msg": "boto required for this module"}

Hi@akhtar, As ansible use the python library in ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,220 points
1,106 views
+15 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,450 points
1,138 views
+2 votes
1 answer
0 votes
1 answer

FAILED! => {"changed": false, "msg": "state is mounted but all of the following are missing: fstype"}

Hi@akhtar, You need to pass some more arguments ...READ MORE

answered Sep 16, 2020 in Ansible by MD
• 95,220 points
450 views