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.