Module copy, remote_src "no" not work

7 views
Skip to first unread message

SysAdmin EM

unread,
Sep 2, 2022, 5:38:52 PM9/2/22
to ansible...@googlegroups.com
Hi, i try copy files locally but not work.
This is my playbook:

- name: "Generando archivos de configuracion mq2mq y supervisor"
    copy:

      src: '{{ item.src }}'

      dest: '{{ item.dest }}'

      remote_src: no

    with_items:

    - { src: '{{ skel_mq2mq_path }}/settings-prosrm-XX-prod.py', dest: '{{ skel_mq2mq_path }}/settings-prosrm-{{ carrier }}-prod.py' }

    - { src: '{{ skel_mq2mq_path }}/settings-prosrm-XX-2res-prod.py', dest: '{{ skel_mq2mq_path }}/settings-prosrm-{{ carrier }}-2res-prod.py' }

    - { src: '{{ skel_supervisor_path }}/mq2mq-prosrm-XX-prod.conf', dest: '{{ skel_supervisor_path }}/mq2mq-prosrm-{{ carrier }}-prod.conf' }

    - { src: '{{ skel_supervisor_path }}/mq2mq-prosrm-XX-2res-prod.conf', dest: '{{ skel_supervisor_path }}/mq2mq-prosrm-{{ carrier }}-2res-prod.co

nf' }

group_vars/all.yaml
skel_mq2mq_path: '/etc/ansible/rms_sftp/template_prod/mq2mq_skel'
skel_supervisor_path: '/etc/ansible/rms_sftp/template_prod/supervisor_skel'

The directory exits:

/etc/ansible/rms_sftp/template_prod/supervisor_skel                                                    
total 8
-rw-rw-r-- 1 emanuel emanuel 335 sep  2 16:44 mq2mq-prosrm-XX-2res-prod.conf
-rw-rw-r-- 1 emanuel emanuel 316 sep  2 16:45 mq2mq-prosrm-XX-prod.conf


I see this error:

    "item": {
       "dest": "/etc/ansible/rms_sftp/template_prod/mq2mq_skel/settings-prosrm-XY-2res-prod.py",
       "src": "/etc/ansible/rms_sftp/template_prod/mq2mq_skel/settings-prosrm-XX-2res-prod.py"
   },
   "msg": "Destination directory /etc/ansible/rms_sftp/template_prod/mq2mq_skel does not exist"
}

what i'm doing wrong?

Regards,

Wei-Yen Tan

unread,
Sep 2, 2022, 5:40:58 PM9/2/22
to ansible...@googlegroups.com
Yoy don't have that directory on the destination node. Create that directory with the file module and it will work 

From: ansible...@googlegroups.com <ansible...@googlegroups.com> on behalf of SysAdmin EM <ema...@gmail.com>
Sent: Saturday, September 3, 2022 9:38:11 AM
To: ansible...@googlegroups.com <ansible...@googlegroups.com>
Subject: [ansible-project] Module copy, remote_src "no" not work
 
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAGUDtnno1hNOGKgGJz8KQG6DaE4C7r18MK9_swNTU2qS3OrWKg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages