# playbook multiple actions per task not working

**URL:** <https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596>\
**Category:** Ansible Project\
**Created:** [June 1, 2012, 1:34pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596 "2012-06-01T13:34:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaex](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damaex](https://forum.ansible.com/u/damaex)\
**Post date:** [June 1, 2012, 1:34pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596/1 "2012-06-01T13:34:15Z")

</div>

Hi,

I am running the dev release of ansible from github.

I am having issues with multiple action’s per task. It seems only one action is working.

The following playbook won’t deploy any files to the target host:

- hosts: graphite  
user: mweber  
tasks:
- name: deploy basic monitoring  
action: copy src=monitoring/cpu.py dest=/home/mweber/cpu.py owner=mweber group=users mode=0740  
action: copy src=monitoring/io.py dest=/home/mweber/io.py owner=mweber group=users mode=0740  
action: copy src=monitoring/guardian.py dest=/home/mweber/guardian.py owner=mweber group=users mode=0740  
action: copy src=monitoring/net.py dest=/home/mweber/net.py owner=mweber group=users mode=0740  
action: copy src=monitoring/sp\_lib.py dest=/home/mweber/sp\_lib.py owner=mweber group=users mode=0740

The following example playbook works:

- hosts: graphite  
user: mweber  
tasks:
- name: deploy basic monitoring  
action: copy src=monitoring/cpu.py dest=/home/mweber/cpu.py owner=mweber group=users mode=0740

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 1, 2012, 1:37pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596/2 "2012-06-01T13:37:31Z")

</div>

There is no such thing as multiple actions per task. A task has an action and a name. One of each.

You just overrode a hash entry.

It looks like this:

tasks:

- name:  
action:
- name:  
action:

---

<div class="post-metadata">

**Author:** ![damaex](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@damaex](https://forum.ansible.com/u/damaex)\
**Post date:** [June 1, 2012, 1:54pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596/3 "2012-06-01T13:54:39Z")

</div>

Thank you for the clarification.

---

<div class="post-metadata">

**Author:** ![Brad\_Olson](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Brad\_Olson](https://forum.ansible.com/u/Brad_Olson)\
**Post date:** [June 1, 2012, 7:09pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596/4 "2012-06-01T19:09:37Z")

</div>

That seems obvious once I consider the YAML code, but I feel into that  
trap of seeing actions as sub-tasks.

Should I note that in the playbook docs?

Could warn about that in the playbook parser, but would take time to  
figure out.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 1, 2012, 7:23pm UTC](https://forum.ansible.com/t/playbook-multiple-actions-per-task-not-working/11596/5 "2012-06-01T19:23:40Z")

</div>

> That seems obvious once I consider the YAML code, but I feel into that  
> trap of seeing actions as sub-tasks.
> 
> Should I note that in the playbook docs?

I don’t think so, because none of the examples show this. If we documented all the things you couldn’t do, the doc would be infinitely long 🙂

> Could warn about that in the playbook parser, but would take time to  
> figure out.

It’s all in the YAML parser, technically YAML should probably warn about that, if anything it’s something to be fixed in PyYAML, if they are even interested.
