FAQ
Hi all,

How do you play just the tasks with set tags in your playbook? From the
command line you would do something like:
ansible-playbook -i staging deploy.yml --tags "do_stop, do_health_check"

I would expect do be able to do the same from the playbook like:
- hosts: somehosts
   roles:
   - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

However this is not working and it plays all the tasks in my role.

Regards,

Brendon

--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Michael DeHaan at Jul 11, 2014 at 10:30 pm
    Pass the "--tags" option to ansible-playbook to run only the tags you want
    to run.



    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing wrote:

    Hi all,

    How do you play just the tasks with set tags in your playbook? From the
    command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop, do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx%3DjPPH4WE1FqVek%2BQUq7idtnMAMpRJDACRXUp6xADVaQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Jul 11, 2014 at 10:31 pm
    What you did above, BTW, is apply the tag "do_stop" and "do_health_check"
    to every task in your role. This isn't what you want, I'm guessing.

    On Fri, Jul 11, 2014 at 6:30 PM, Michael DeHaan wrote:

    Pass the "--tags" option to ansible-playbook to run only the tags you want
    to run.




    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing <
    bstanding@marinsoftware.com> wrote:
    Hi all,

    How do you play just the tasks with set tags in your playbook? From the
    command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop, do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzsygVc_V48LeodxDjYU1LwEY0Hy6f2pYqFNOP6JiVBHw%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brendon Standing at Jul 17, 2014 at 6:31 pm
    Thanks all. I know that I can call tags from the command line and that my
    example will apply new tags in my playbook. But to me a playbook by design
    should be able to run all the tasks that you need to run by calling the
    tags you have set in tasks/*.yml. Instead we are now presented with 2
    options:
    1. Write a wrapper script (oh no)
    2. Further dismantle tasks into separate yml files so that you can call
    these with include in your playbook.

    Surely a playbook by design should be a playbook?

    Many thanks.

    On Friday, July 11, 2014 11:31:20 PM UTC+1, Michael DeHaan wrote:

    What you did above, BTW, is apply the tag "do_stop" and "do_health_check"
    to every task in your role. This isn't what you want, I'm guessing.


    On Fri, Jul 11, 2014 at 6:30 PM, Michael DeHaan <mic...@ansible.com
    <javascript:>> wrote:
    Pass the "--tags" option to ansible-playbook to run only the tags you
    want to run.




    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing <
    bsta...@marinsoftware.com <javascript:>> wrote:
    Hi all,

    How do you play just the tasks with set tags in your playbook? From the
    command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop, do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-proje...@googlegroups.com <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Jul 18, 2014 at 1:39 am
    "Surely a playbook by design should be a playbook?"

    All ducks must quack, except when they are elephants.


    On Thu, Jul 17, 2014 at 2:31 PM, Brendon Standing wrote:

    Thanks all. I know that I can call tags from the command line and that my
    example will apply new tags in my playbook. But to me a playbook by design
    should be able to run all the tasks that you need to run by calling the
    tags you have set in tasks/*.yml. Instead we are now presented with 2
    options:
    1. Write a wrapper script (oh no)
    2. Further dismantle tasks into separate yml files so that you can call
    these with include in your playbook.

    Surely a playbook by design should be a playbook?

    Many thanks.


    On Friday, July 11, 2014 11:31:20 PM UTC+1, Michael DeHaan wrote:

    What you did above, BTW, is apply the tag "do_stop" and "do_health_check"
    to every task in your role. This isn't what you want, I'm guessing.


    On Fri, Jul 11, 2014 at 6:30 PM, Michael DeHaan <mic...@ansible.com>
    wrote:
    Pass the "--tags" option to ansible-playbook to run only the tags you
    want to run.




    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing <
    bsta...@marinsoftware.com> wrote:
    Hi all,

    How do you play just the tasks with set tags in your playbook? From the
    command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop, do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/
    msgid/ansible-project/e064ad14-538d-4c7c-aae7-
    3a7c43fcfac6%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyXzmXwHaHr5PXSFXte%3DhTLXzrP8s165MP5yFiOj90Q7g%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brendon Standing at Jul 18, 2014 at 1:07 pm
    This is why I generally don't join forums. Clearly your experience is
    limited to a small component stack and I should have gone with Chef.
    On Friday, July 18, 2014 2:39:13 AM UTC+1, Michael DeHaan wrote:

    "Surely a playbook by design should be a playbook?"

    All ducks must quack, except when they are elephants.



    On Thu, Jul 17, 2014 at 2:31 PM, Brendon Standing <
    bsta...@marinsoftware.com <javascript:>> wrote:
    Thanks all. I know that I can call tags from the command line and that my
    example will apply new tags in my playbook. But to me a playbook by design
    should be able to run all the tasks that you need to run by calling the
    tags you have set in tasks/*.yml. Instead we are now presented with 2
    options:
    1. Write a wrapper script (oh no)
    2. Further dismantle tasks into separate yml files so that you can call
    these with include in your playbook.

    Surely a playbook by design should be a playbook?

    Many thanks.


    On Friday, July 11, 2014 11:31:20 PM UTC+1, Michael DeHaan wrote:

    What you did above, BTW, is apply the tag "do_stop" and
    "do_health_check" to every task in your role. This isn't what you want,
    I'm guessing.


    On Fri, Jul 11, 2014 at 6:30 PM, Michael DeHaan <mic...@ansible.com>
    wrote:
    Pass the "--tags" option to ansible-playbook to run only the tags you
    want to run.




    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing <
    bsta...@marinsoftware.com> wrote:
    Hi all,

    How do you play just the tasks with set tags in your playbook? From
    the command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop,
    do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/
    msgid/ansible-project/e064ad14-538d-4c7c-aae7-
    3a7c43fcfac6%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-proje...@googlegroups.com <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/badcfbfd-b041-475a-9bad-600c0daaf476%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Jul 18, 2014 at 6:06 pm
    Heh.



    On Fri, Jul 18, 2014 at 9:07 AM, Brendon Standing wrote:

    This is why I generally don't join forums. Clearly your experience is
    limited to a small component stack and I should have gone with Chef.
    On Friday, July 18, 2014 2:39:13 AM UTC+1, Michael DeHaan wrote:

    "Surely a playbook by design should be a playbook?"

    All ducks must quack, except when they are elephants.



    On Thu, Jul 17, 2014 at 2:31 PM, Brendon Standing <
    bsta...@marinsoftware.com> wrote:
    Thanks all. I know that I can call tags from the command line and that
    my example will apply new tags in my playbook. But to me a playbook by
    design should be able to run all the tasks that you need to run by calling
    the tags you have set in tasks/*.yml. Instead we are now presented with 2
    options:
    1. Write a wrapper script (oh no)
    2. Further dismantle tasks into separate yml files so that you can call
    these with include in your playbook.

    Surely a playbook by design should be a playbook?

    Many thanks.


    On Friday, July 11, 2014 11:31:20 PM UTC+1, Michael DeHaan wrote:

    What you did above, BTW, is apply the tag "do_stop" and
    "do_health_check" to every task in your role. This isn't what you want,
    I'm guessing.


    On Fri, Jul 11, 2014 at 6:30 PM, Michael DeHaan <mic...@ansible.com>
    wrote:
    Pass the "--tags" option to ansible-playbook to run only the tags
    you want to run.




    On Fri, Jul 11, 2014 at 10:58 AM, Brendon Standing <
    bsta...@marinsoftware.com> wrote:
    Hi all,

    How do you play just the tasks with set tags in your playbook? From
    the command line you would do something like:
    ansible-playbook -i staging deploy.yml --tags "do_stop,
    do_health_check"

    I would expect do be able to do the same from the playbook like:
    - hosts: somehosts
    roles:
    - { role: connect, tags: [ 'do_stop', 'do_health_check' ] }

    However this is not working and it plays all the tasks in my role.

    Regards,

    Brendon

    --
    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 ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/
    msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%
    40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/e064ad14-538d-4c7c-aae7-3a7c43fcfac6%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/
    msgid/ansible-project/6ea19c9c-e713-413b-91dd-
    1e08b27da966%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/6ea19c9c-e713-413b-91dd-1e08b27da966%40googlegroups.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/badcfbfd-b041-475a-9bad-600c0daaf476%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/badcfbfd-b041-475a-9bad-600c0daaf476%40googlegroups.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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 ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxZDZknairq_oQYdaWHXj9pBEByGyj_M1QgRA%3DM44F%2B6g%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedJul 11, '14 at 6:55p
activeJul 18, '14 at 6:06p
posts7
users2

People

Translate

site design / logo © 2022 Grokbase