Hi,

Is there a way to apply a tag to all of the import_tasks statements
in a role's tasks/main.yml file without stating it on every
import_tasks line?

That is, given a directory structure a bit like this:

.
├── roles
│   ├── some_server
│   │   └── tasks
│   │       ├── configure_this.yml
│   │       ├── create_that.yml
│   │       ├── main.yml
│   │       └── other_config.yml
│   ├── other_role
.   .
.
└── site.yml

site.yml:

- hosts: all
  roles:
    - {
        role: some_server,
        tags: some_server,
      }
    - {
        role: other_role,
        tags: other_role,
      }
# etc..

And roles/some_server/tasks/main.yml:

- import_tasks: configure_this.yml
- import_tasks: create_that.yml
- import_tasks: other_config.yml

If I tried to conditionally apply only tag "some_server" then it
does process roles/some_server/tasks/main.yml but not any of the
imports within it.

If I add a tag attribute to each of those imports, i.e.:

- import_tasks: configure_this.yml tags=some_server
- import_tasks: create_that.yml tags=some_server
- import_tasks: other_config.yml tags=some_server

then that works as the tasks within each of those imported files do
inherit the tag. It seems ugly and repetitious though.

Is there a nice way to say that "every following import_tasks should
have these tags"?

Thanks,
Andy

-- 
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/20181129052153.GZ4569%40bitfolk.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to