Only if they are separate tags. On Wed, Oct 14, 2020, 2:40 AM gr00t <numimick...@gmail.com> wrote:
> Okay, let me give that a try then update you, and should I separate each > block tasks into their own include files ?? > > On Wednesday, 14 October 2020 at 00:03:41 UTC+3 colli...@gmail.com wrote: > >> You do not need hosts if this is just an include file. Also, tags should >> be in the main play. Below is an example: >> >> >> - name: Dynamic re-use of database tasks >> include_tasks: db.yml >> tags: db >> >> >> So you would remove this: >> >> >> hosts: local >> tags: >> - Local >> - Preparation local >> tasks: >> - block: >> >> >> Then move all of your task over to left. >> >> >> >> On Tue, Oct 13, 2020 at 2:14 PM gr00t <numim...@gmail.com> wrote: >> >>> 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. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Development" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to ansible-deve...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-devel/3678ca95-a42f-4df8-b96f-eeda0583d0bdn%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-devel/3678ca95-a42f-4df8-b96f-eeda0583d0bdn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "Ansible Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-devel/6308263a-a59b-4e21-b18f-639d813dbe2dn%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-devel/6308263a-a59b-4e21-b18f-639d813dbe2dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/CAANJ-QRfA74decQo8Ev%2BGiKmw_NAf%2BhevT_0-GtwJwmTCHqG2g%40mail.gmail.com.