List all tags


#1

Is there an easy/efficient way to list all the tags rather than the list of
tags for a given node(s)? I suppose I could list all the tags for all nodes and
build a unique list of those.

Apologies for this naive question because I am new to Chef and Ruby but I
failed to find an answer via on-line search of Chef documentation and the
mailing list archive. Thanks.


#2

‘knife search node “tags:*” -a tags’ or equivalent in a recipe (etc).
Search for all nodes with any tags and print the tags attribute.

Cheers,

AJ

On 12 November 2012 16:21, sam.lor@asic.gov.au wrote:

Is there an easy/efficient way to list all the tags rather than the list of
tags for a given node(s)? I suppose I could list all the tags for all
nodes and
build a unique list of those.

Apologies for this naive question because I am new to Chef and Ruby but I
failed to find an answer via on-line search of Chef documentation and the
mailing list archive. Thanks.


#3

Great, thanks AJ.

I do not know (yet) how to get/use it inside Chef/shef but given the
output format, the following commands give me the list of all tags with
nothing more and nothing less.

knife search node tags:* -a tags | sed ‘1d;/^$/d’ | egrep -v
"^id:|^tags:" | sort | uniq | tr -d ’ ’

From:
AJ Christensen aj@junglist.gen.nz
To:
chef@lists.opscode.com
Date:
12/11/2012 04:25 PM
Subject:
[chef] Re: List all tags


This email message has been processed by MIMEsweeper


‘knife search node “tags:*” -a tags’ or equivalent in a recipe (etc).
Search for all nodes with any tags and print the tags attribute.

Cheers,

AJ

On 12 November 2012 16:21, sam.lor@asic.gov.au wrote:
Is there an easy/efficient way to list all the tags rather than the list
of
tags for a given node(s)? I suppose I could list all the tags for all
nodes and
build a unique list of those.

Apologies for this naive question because I am new to Chef and Ruby but I
failed to find an answer via on-line search of Chef documentation and the
mailing list archive. Thanks.

Please consider the environment before printing this document

NOTICE
This e-mail and any attachments are intended for the addressee(s) only and may be confidential. They may contain legally privileged or copyright material. You should not read, copy, use or disclose them without authorisation. If you are not the intended recipient please contact the sender as soon as possible by return e-mail and then please delete both messages. This notice should not be removed.