Hi List,
We are trying to do this:
name: Oracle | Copy files
action: copy
backup=yes
src=/media/storage/DM/orabestanden/aix/{{item}}
force=yes
dest=/opt/oracle/admin/network/admin/${item}
owner=oracle
group=dbamgr
with_items: orafiles
register: nieuweversiegeplaatst
tags:orabestanden
name: Oracle | Lookup which files there are
action: shell ls /opt/oracle/product/
register: oracle_versions
tags:orabestanden
name: Oracle | Find out where the Admin path is
action: shell find /opt/oracle/product/{{ item }} -type d -name admin | grep -i network
with_items:$oracle_versions.stdout_lines
register: oracle_admin_path
tags:orabestanden
name: Oracle | Remove previous links/files
action: file
state=absent
dest={{ item[0] }}/{{ item[1] }}
with_nested:
$oracle_admin_path.stdout_lines
$orafiles
when_changed: $nieuweversiegeplaatst
tags:orabestanden
- name: Oracle | Create new links
action: file
state=link
src=/opt/oracle/admin/network/admin/{{ item[1] }}
dest={{ item[0] }}/{{ item[1] }}
owner=oracle
group=dba
with_nested:
$oracle_admin_path.stdout_lines
$orafiles
when_changed: $nieuweversiegeplaatst
tags:- orabestanden
But when activated, We see this:
TASK: [Oracle | Find out where the Admin path is] *****************************************
failed: [laixviola] => (item={u’changed’: True, u’end’: u’2013-07-12 13:37:42.035145’, u’stdout’: u’10.2\n11.2’, u’cmd’: u’ls /opt/oracle/product/ ‘, u’rc’: 0, ‘item’: ‘’, u’stderr’: u’‘, u’delta’: u’0:00:00.009996’, ‘invocation’: {‘module_name’: ‘shell’, ‘module_args’: ‘ls /opt/oracle/product/’}, ‘stdout_lines’: [u’10.2’, u’11.2’], u’start’: u’2013-07-12 13:37:42.025149’}.stdout_lines) => {“changed”: true, “cmd”: "find /opt/oracle/product/{u’changed’: True, u’end’: u’2013-07-12 13:37:42.035145’, u’stdout’: u’10.2\n11.2’, u’cmd’: u’ls /opt/oracle/product/ ‘, u’rc’: 0, ‘item’: ‘’, u’stderr’: u’‘, u’delta’: u’0:00:00.009996’, ‘invocation’: {‘module_name’: ‘shell’, ‘module_args’: ‘ls /opt/oracle/product/’}, ‘stdout_lines’: [u’10.2’, u’11.2’], u’start’: u’2013-07-12 13:37:42.025149’}.stdout_lines -type d -name admin | grep -i network ", “delta”: “0:00:00.013772”, “end”: “2013-07-12 13:37:44.072192”, “item”: “{u’changed’: True, u’end’: u’2013-07-12 13:37:42.035145’, u’stdout’: u’10.2\n11.2’, u’cmd’: u’ls /opt/oracle/product/ ‘, u’rc’: 0, ‘item’: ‘’, u’stderr’: u’‘, u’delta’: u’0:00:00.009996’, ‘invocation’: {‘module_name’: ‘shell’, ‘module_args’: ‘ls /opt/oracle/product/’}, ‘stdout_lines’: [u’10.2’, u’11.2’], u’start’: u’2013-07-12 13:37:42.025149’}.stdout_lines”, “rc”: 1, “start”: “2013-07-12 13:37:44.058420”}
stderr: find: bad status-- /opt/oracle/product/{uchanged:
find: bad status-- True,
find: bad status-- uend:
find: bad status-- u2013-07-12 13:37:42.035145,
find: bad status-- ustdout:
find: bad status-- u10.2\n11.2,
find: bad status-- ucmd:
find: bad starting directory
find: bad status-- urc:
find: bad status-- 0,
find: bad status-- item:
find: bad status-- ,
find: bad status-- ustderr:
find: bad status-- u,
find: bad status-- udelta:
find: bad status-- u0:00:00.009996,
find: bad status-- invocation:
find: bad status-- {module_name:
find: bad status-- shell,
find: bad status-- module_args:
find: bad starting directory
find: bad status-- stdout_lines:
find: bad status-- [u10.2,
find: bad status-- u11.2],
find: bad status-- ustart:
find: bad status-- u2013-07-12 13:37:42.025149}.stdout_lines
FATAL: all hosts have already failed – aborting
I’m guessing that I’m not using the variables correcly, So I also tried variations like these:
with_items:
- ${oracle_versions.stdout_lines}
with_items:
- ${oracle_versions}.stdout_lines
with_items:
- {{ oracle_versions.stdout_lines }}
Comes back with:
ERROR: Syntax Error while loading YAML script, /home/mmaas/playbooks/tasks/ora_bestanden_aix.yml
Note: The error may actually appear before this position: line 47, column 8
with_items:
- {{ oracle_versions.stdout_lines }}
S they all came back with errors.
What is the exact way of referering to the variable?
Thanks in advance,
Mark