N
N
Nikolai Savelyev2019-07-03 13:31:16
linux
Nikolai Savelyev, 2019-07-03 13:31:16

Is it possible to specify tags in a playbook instead of using the tags argument?

A long time ago I wrote my role ansible. Recently it was necessary to perform only part of the settings for this role. Specified tags in the right places, executed the playbook with --tags=some_tag.
And today I forgot to specify this argument! Accordingly, everything was done, instead of what was needed.
Is it possible to write a role call in the playbook immediately with the necessary tags?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lynn "Coffee Man", 2019-07-03
@Lynn

It is forbidden.
But you can add a `never` tag and then the tasks will not be executed if there is no explicitly requested tag.
https://docs.ansible.com/ansible/latest/user_guide...
However, I would write a makefile/script and run it

E
evgeh4ik, 2019-07-03
@evgeh4ik

All tasks are completed in the order in which they are listed in the playbook.
If you don't want to specify the tag each time, then you can try to automate using bash, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question