0

I would like to copy few files on remote host , I used copy module as following but it copy all files under 'app' variable (dir) to 'backup_conf' variable (dir). please advice here.

- name: backup configuration files
  copy:
   src: '{{ app }}'
   dest: '{{ backup_conf }}'
   remote_src: true
  with_items:
   - /bin/setenv.sh
   - /conf/server.xml
1
  • 3
    You are not referencing the items. According your example there should be something like src: "{{ item }}" and dest: "{{ backup_conf }}/{{ item }}". Commented May 30, 2021 at 16:43

1 Answer 1

1

Thank you, I fixed my issue:

- name: backup configuration files
  copy:
   src: "{{ item }}"
   dest: "{{ backup_conf }}"
   remote_src: true
  with_items:
   - /bin/setenv.sh
   - /conf/server.xml
Sign up to request clarification or add additional context in comments.

1 Comment

Use loop. Simple with_items is deprecated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.