reference state id

83 views
Skip to first unread message

Adrian Andreias

unread,
Jan 23, 2013, 7:27:27 AM1/23/13
to salt-...@googlegroups.com
Hello,

Is there a way to reference a salt state node name somehow?

Thanks

Mike Chesnut

unread,
Jan 23, 2013, 10:59:20 AM1/23/13
to salt-...@googlegroups.com

Why not just make projectdir another pillar variable and use it in both spots?

(I don't believe what you've shown is possible, though I'm not positive... pillar seems like an obvious solution, though, regardless.)

--
 
 

Jack Kuan

unread,
Jan 23, 2013, 11:13:04 AM1/23/13
to salt-...@googlegroups.com
if you just want to avoid repetition, you can also use jinja's variable assignment: http://jinja.pocoo.org/docs/templates/#assignments

set a variable for the path and then use {{…}} to reference it anywhere you need in the sls file.
-- 
Jack Kuan


--
 
 


This email and any files transmitted with it are confidential and intended solely for the recipient(s). If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Any views or opinions presented in this email are solely those of the author and might not represent those of theScore, Inc. or any of its affiliates. Warning: Although theScore, Inc. has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

Adrian Andreias

unread,
Jan 24, 2013, 2:57:28 AM1/24/13
to salt-...@googlegroups.com
Hello,

Thanks, I'm aware of both methods (pillars and jinja variables).
I was just looking for a way to make this quicker and thought it makes sense to have a way to reference a state node's name.


Adrian Andreias

unread,
Jan 25, 2013, 4:39:56 AM1/25/13
to salt-...@googlegroups.com
I wonder of & and * yaml feature can be used for this.
Reply all
Reply to author
Forward
0 new messages