Fixed the indentation to with_items block but still it does not work.

*Try 1*

- name: Synchronize files 
  synchronize: src="{{ item.source }}" dest="{{ item.dest }}" recursive=yes 
links=yes times=yes rsync_opts="--devices"
  with_items:
     - { source: project/conf/file.conf, dest: '/etc/asdf/nginx.conf }
     - { source: project/conf/somefolder/, dest: '/etc/asdf/somefolder/ }
     - { source: /conf/asdf/anotherfolder/', dest: 
'/etc/asfd/anotherfolder/ }
 
---> 
  
TASK [mumbojumbo : Synchronize files] 
***********************************************
failed: [xxx.xxx.xxx.xxx] => (item={u'dest': u'/etc/asdf/nginx.conf\xa0', 
u'source': u'project/conf/file.conf'}) => {"failed": true, "item": {"dest": 
"/etc/asdf/nginx.conf ", "source": "project/conf/file.conf"}, 
"module_stderr": "sudo: a password is required\n", "module_stdout": "", 
"msg": "MODULE FAILURE", "parsed": false}
failed: [xxx.xxx.xxx.xxx] => (item={u'dest': u'/etc/asdf/somefolder/\xa0', 
u'source': u'project/conf/somefolder/'}) => {"failed": true, "item": 
{"dest": "/etc/asdf/somefolder/ ", "source": "project/conf/somefolder/"}, 
"module_stderr": "sudo: a password is required\n", "module_stdout": "", 
"msg": "MODULE FAILURE", "parsed": false}
failed: [xxx.xxx.xxx.xxx] => (item={u'dest': 
u'/etc/asfd/anotherfolder/\xa0', u'source': u'/conf/asdf/anotherfolder/'}) 
=> {"failed": true, "item": {"dest": "/etc/asfd/anotherfolder/ ", "source": 
"/conf/asdf/anotherfolder/"}, "module_stderr": "sudo: a password is 
required\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

*Try 2*

- name: Synchronize files 
  synchronize:
    src: "{{ item.source }}"
    dest: "{{ item.dest }}"
    recursive: yes
    links: yes
    times: yes
    rsync_opts: "--devices"
    with_items:
       - { source: project/conf/file.conf, dest: /etc/asdf/nginx.conf }
       - { source: project/conf/somefolder/, dest: /etc/asdf/somefolder/ }
       - { source: /conf/asdf/anotherfolder/, dest: 
/etc/asfd/anotherfolder/ }
  
TASK [mumbojumbo : Synchronize files] 
***********************************************
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"failed": true, "msg": "ERROR! 'item' 
is undefined"}

*Try 3*

- name: Synchronize files 
  synchronize:
    src: "{{ item.source }}"
    dest: "{{ item.dest }}"
    recursive: yes
    links: yes
    times: yes
    rsync_opts: "--devices"
    with_items:
       - { source: 'project/conf/file.conf', dest: '/etc/asdf/nginx.conf' }
       - { source: 'project/conf/somefolder/', dest: 
'/etc/asdf/somefolder/' }
       - { source: '/conf/asdf/anotherfolder/', dest: 
'/etc/asfd/anotherfolder/' }

ERROR! Syntax Error while loading YAML.


The error appears to have been in 
'/home/osboxes/analytics/tstdeployment/roles/orfer/tasks/main.yml': line 
36, column 86, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    with_items:
      - { source: 'project/conf/file.conf', dest: '/etc/asdf/nginx.conf' }
                                                                        ^ 
here
This one looks easy to fix.  It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote.  For instance:

    when: "ok" in result.stdout

Could be written as:

   when: '"ok" in result.stdout'

Or equivalently:

   when: "'ok' in result.stdout"

*Try 4*
   
- name: Synchronize files 
  synchronize:
    src: "{{ item.source }}"
    dest: "{{ item.dest }}"
    recursive: yes
    links: yes
    times: yes
    rsync_opts: "--devices"
    with_items:
       - { source: "project/conf/file.conf", dest: "/etc/asdf/nginx.conf" }
       - { source: "project/conf/somefolder/", dest: 
"/etc/asdf/somefolder/" }
       - { source: "/conf/asdf/anotherfolder/", dest: 
"/etc/asfd/anotherfolder/" }
  
ERROR! Syntax Error while loading YAML.


The error appears to have been in 
'/home/osboxes/analytics/tstdeployment/roles/orfer/tasks/main.yml': line 
36, column 86, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    with_items:
      - { source: 'project/conf/file.conf', dest: '/etc/asdf/nginx.conf' }
                                                                        ^ 
here
This one looks easy to fix.  It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote.  For instance:

    when: "ok" in result.stdout

Could be written as:

   when: '"ok" in result.stdout'

Or equivalently:

   when: "'ok' in result.stdout"

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/457e7a63-4358-4e56-9992-b588727af666%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to