OK. I'll just break out the tasks into separate files.
Thanks for the reply,

On Tuesday, June 11, 2019 at 12:55:41 PM UTC-5, Kai Stian Olstad wrote:
>
> On 11.06.2019 19:39, Douglas Thompson wrote: 
> > I'm working on an ansible role and instead of putting all tasks in 
> > tasks/main.yml, I'd like to have separate files and use them sort of 
> like 
> > functions. One of my files has all the possible tasks for file 
> manipulation 
> > in a separate file. The thought would be to use tags to execute one of 
> the 
> > tasks in that file. 
> > 
> > In the example below I've put all the file manipulation tasks in a file 
> > called 'reboot_me_file.yml and would like to call just one task in 
> main.yml 
> > when I need it. For example, 'reboot_me_file.yml' has three tagged tasks 
> > (create a file, stat a file, delete a file) and during the main.yml 
> play, 
> > there will be a task, that includes say the 'create a file' task. I've 
> > looked at the following URL and it sounds like I can call a tagged task 
> in 
> > the 'reboot_me_file.yml', but when I run the playbook, it executes all 
> the 
> > tasks in 'reboot_me_file.yml' 
> > 
> > 
> https://docs.ansible.com/ansible/latest/modules/include_tasks_module.html#include-tasks-module
>  
> > (It says this should be available in ansible 2.7 but not which version 
> of 
> > 2.7) 
>
> It doesn't, it says "will be applied to the tasks within the include." 
>
>
> > Anyone tried anything like this? 
>
> Many have, all have failed, since it doesn't work like that. 
> All tags in a file is always added to the task, at this level it is not a 
> filter. 
>
> To choose which tags to run is done at the command line with -t/--tags 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/88593c97-dd5a-47e6-837f-03bb7cb5ecc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to