# ASSIST IN ANSIBLE

**URL:** <https://forum.ansible.com/t/assist-in-ansible/34024>\
**Category:** Ansible Developer\
**Created:** [October 13, 2020, 7:14pm UTC](https://forum.ansible.com/t/assist-in-ansible/34024 "2020-10-13T19:14:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gr00t](https://avatars.discourse-cdn.com/v4/letter/g/65b543/32.png) [@gr00t](https://forum.ansible.com/u/gr00t)\
**Post date:** [October 13, 2020, 7:14pm UTC](https://forum.ansible.com/t/assist-in-ansible/34024/1 "2020-10-13T19:14:44Z")

</div>

Hey Guys,

Need some help … been trying to place multiple tasks in one block with tags but I keep getting an error include task files must contain a list of tasks…

Below is one of my ansible block …

* * *

hosts: local  
tags:

- Local

- Preparation local  
tasks:

- block:

- name: check if directory path “{{store\_files\_path}}” is empty  
shell: test “$(ls “{{store\_files\_path}}/”)”  
register: OldfilesPresent  
changed\_when: false

- name: Delete old files  
when: “OldfilesPresent.rc !=0”  
file:  
state: absent  
path: “{{store\_files\_path}}/”  
register: OldfilesDeleted

- name: Create Directory “{{store\_files\_path}}”  
when: “OldfilesDeleted.rc !=0”  
file:  
state: directory  
path: “{{store\_files\_path}}”

Error is include task files must contain a list of tasks

The offending line appears to be:

* * *

hosts: local  
^ here

Also is there a way that I can post code here nicely, like code snippets. Am new on google groups.

Also does anyone know of a vscode extension that will assist on the indentations format.

I have also gone through the ansible doc user guide and I have tried every but I keep getting errors on the block.

Kind regards,

gr00t.

---

<div class="post-metadata">

**Author:** ![Jason](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jason/32/304_2.png) [@Jason](https://forum.ansible.com/u/Jason)\
**Post date:** [October 13, 2020, 9:03pm UTC](https://forum.ansible.com/t/assist-in-ansible/34024/2 "2020-10-13T21:03:24Z")

</div>

You do not need hosts if this is just an include file. Also, tags should be in the main play. Below is an example:

```auto
- name: Dynamic re-use of database tasks
  include_tasks: db.yml
  tags: db

```

```auto

```

```auto

So you would remove this:

hosts: local
tags:
    - Local
    - Preparation local
tasks:
    - block:

Then move all of your task over to left.

```

---

<div class="post-metadata">

**Author:** ![gr00t](https://avatars.discourse-cdn.com/v4/letter/g/65b543/32.png) [@gr00t](https://forum.ansible.com/u/gr00t)\
**Post date:** [October 14, 2020, 7:40am UTC](https://forum.ansible.com/t/assist-in-ansible/34024/3 "2020-10-14T07:40:03Z")

</div>

Okay, let me give that a try then update you, and should I separate each block tasks into their own include files ??

---

<div class="post-metadata">

**Author:** ![Jason](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jason/32/304_2.png) [@Jason](https://forum.ansible.com/u/Jason)\
**Post date:** [October 15, 2020, 2:29am UTC](https://forum.ansible.com/t/assist-in-ansible/34024/4 "2020-10-15T02:29:54Z")

</div>

Only if they are separate tags.
