When using `import_tasks`, ansible will read the file, and effectively replace your `import_tasks` with the tasks that are inside it. When we do that, the `when` statement gets added to each individual task within.
As such, you get this warning. Switching to `include_tasks` should avoid this. On Sun, Jun 16, 2019 at 12:15 PM [email protected] < [email protected]> wrote: > my *main.yml* is really simply like this: > > --- > - import_tasks: git.yml > when: GIT_ENABLED | default(false) > - import_tasks: -s3.yml > when: not (GIT_ENABLED | default(false)) > > > On Wednesday, June 12, 2019 at 8:47:28 PM UTC+5, [email protected] wrote: >> >> I have really simple role, in which I have these tasks: >> >> --- >> >> - name: Download the app artifact from s3 bucket >> aws_s3: >> bucket: "my-bucket" >> object: "/my-artifact.tar.gz" >> mode: get >> dest: "my-artifact.tar.gz" >> notify: >> - Restart App >> >> >> - name: Unarchive the tar file >> unarchive: >> src: "my-artifact.tar.gz" >> dest: "/app-dir" >> >> >> >> >> - name: Copy the templates to desired locations >> template: >> src: "my-app.j2" >> dest: "/app-dir/my-app.config" >> notify: >> - Restart App >> >> >> - meta: flush_handlers >> >> >> - Some other tasks >> >> >> Here is my simple handler: >> --- >> - name: Restart App >> systemd: >> name: "my-app" >> state: restarted >> >> >> but at the meta step I am getting this warning: >> >> *[WARNING]: flush_handlers task does not support when conditional* >> >> >> It was working fine until, 2.5.x but getting this warning after upgrading >> to 2.7/2.8, I didn't have any when condition. >> >> any help will be highly appreciated >> > -- > 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/57b12ed9-4a73-42af-8b82-71358f783b82%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/57b12ed9-4a73-42af-8b82-71358f783b82%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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/CAD8N0v_Lan0-K%2BLcg2DgzE-x3CnOTm5R_hurZmYBHWLuS3WYLg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
