Multiple actions in task

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.

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}}”