Multiple actions in task

2,345 views
Skip to first unread message

James Carroll

unread,
Apr 7, 2014, 12:22:52 PM4/7/14
to ansible...@googlegroups.com
I have two tasks, one works (sorta) and the other doesn't (at all).

The first:

- name: Install JCE
  when: jce_install == true
  copy: src=US_export_policy.jar dest={{item}}
  with_items:
    - "{{jre_path}}"
    - "{{jdk_path}}"
  copy: src=local_policy.jar dest={{item}}
  with_items:
    - "{{jre_path}}"
    - "{{jdk_path}}"


This task runs, but only the second copy action happens not the first.  Why?

The second task:

- name: Install Ping 
  user: name={{ping_user}}
  file: path={{ping_home}} state=directory
  unarchive: src=Ping.zip dest={{ping_home}}

 
This task flat out kills the playbook/role with "ERROR: multiple actions specified in task Install Ping".  The first one doesn't though. Is it because they are the same task type (copy)? Is the second one 'shadowing' the first?

Everything works fine if I split every thing out and having lots of messages about where script is at any moment in time is good (I suppose).  But I would appreciate a little more insight into the above and how to group related actions into logical tasks.

Thanks,





__________________________________________________________________
The information contained in this email message and any attachment may be privileged, confidential, proprietary or otherwise protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this message and any attachment is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and permanently delete it from your computer and destroy any printout thereof.

Paul Durivage

unread,
Apr 7, 2014, 12:28:12 PM4/7/14
to ansible...@googlegroups.com
Hi James,

The first doesn't fail with the "multiple actions specified" message because you're defining a dictionary (aka a hash, or associative array) and your second declaration overwrites the first.

Split this into two separate tasks.

- name: Install JCE
  when: jce_install == true
  copy: src=US_export_policy.jar dest={{item}}
  with_items:
    - "{{jre_path}}"
    - "{{jdk_path}}"

- name: Install jar
  copy: src=local_policy.jar dest={{item}}
  with_items:
    - "{{jre_path}}"
    - "{{jdk_path}}"

--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6f8ce869-4da8-47d8-ab89-c9fb5d5b1ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages