Perl 6 - the future is here, just unevenly distributed

IRC log for #salt, 2013-11-28

| Channels | #salt index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 sebest forrest: i think there is an index_url for virtualenv.managed http://docs.saltstack.com/ref/states/all/salt.states.virtualenv.html
00:00 kryptt <bbl>
00:00 sebest forrest: i did not see it at first as it is only in the prototype of the function but not list in the detailed documentation
00:00 scoates hey carmony
00:00 UtahDave kryptt: is npm on the path?
00:01 scoates I have a horrible hack brewing for github + submodule… :stare:
00:02 UtahDave scoates: :)   so submodules aren't working out of the box?
00:03 scoates UtahDave: sort of related to what Steve__ was talking about earlier… with GitHub you can only use one deploy key per repo…
00:04 troyready joined #salt
00:04 UtahDave ah, ok
00:05 carmony I hate deploy keys on github
00:05 carmony we use "machine users"
00:05 scoates yeah
00:05 scoates github's ssh server is a pretty dirty hack on its own… but… it Works™… mostly.
00:11 Steve__ yep... we use machine users also... works ok
00:13 pniederw is there a way to run a state (only) if some condition holds (like onlyif) OR a watch triggers?
00:15 pniederw use case is to generate B from A, and only regenerate B if A changed or B doesn't exist
00:15 mgw joined #salt
00:16 pdayton joined #salt
00:16 mgw joined #salt
00:16 UtahDave cmd state has - onlyif and - unless
00:18 srage joined #salt
00:20 pniederw @UtahDave: how does this solve the problem? when I combine `onlyIf` (or `unless`) with `watch`, I get AND, but what I need is OR
00:21 Steve__ Anybody here familiar with git_pillar code?
00:21 mgw joined #salt
00:21 pniederw the implementation?
00:21 Steve__ yes
00:21 pniederw not me :-)
00:21 Steve__ trying to debug my problem
00:21 UtahDave Steve__: I'm afraid I'm the only SaltStack dev still in the office today and I haven't dug into that part of the codebase at all
00:22 Steve__ ok
00:22 mafrosis joined #salt
00:22 Steve__ for reference ...
00:22 Steve__ [DEBUG   ] Loaded git_pillar as virtual git HSL: master git://github.com/MerchantAtlas/PillarAWS.git  branch: master  repo_location git://github.com/MerchantAtlas/PillarAWS.git HSL: [<git.Remote "origin">]  branch: master  rp: /var/cache/salt/master/pillar_gitfs/0 [ERROR   ] Failed to load ext_pillar git: 'git fetch' returned exit status 128: fatal: remote error:    Repository not found. Traceback (most recent call last):   File "/u
00:22 mafrosis left #salt
00:22 Steve__ thats the error :)
00:24 pniederw my ext_pillar config looks as follows (in case it helps):
00:24 pniederw ext_pillar:   - git: master git+ssh://git@github.com/organization/repo.git
00:24 pniederw works fine for me
00:25 UtahDave what version of salt, Steve_?
00:25 srage_ joined #salt
00:28 Steve__ 0.17.2
00:29 zandy joined #salt
00:30 mgw joined #salt
00:30 UtahDave would you mind opening an issue on that?
00:32 Steve__ pniederw... tried that same config... fails in same wawy
00:32 pniederw not sure then. I'm also on 0.17.2
00:33 Steve__ r u using 'machine users' ?
00:33 dwyerj joined #salt
00:33 pniederw started working for me as soon as I realized that I have to use `git+ssh://` instead of `git://` (which I believe isn't shown in the docs)
00:33 pniederw yes
00:34 Steve__ interesting... I deleted the cache and it started working
00:34 pniederw oh yeah. I already submitted an issue for that.
00:34 Steve__ thanks
00:34 Steve__ ok :)
00:35 Steve__ What has your experience been so far with salt?
00:35 Steve__ Its kind of like a super swiss army knife... a bit hard to figure out exactly which blades to use
00:36 Steve__ :)
00:36 Steve__ lots of potential
00:37 Steve__ UtahDave ... I won't submit an issue for now as apparently its a known issue
00:37 pniederw the first few weeks were extremely tough, much harder than expected. I tripped over one bug after another while I was still learning, so I was never sure if it was my mistake or not. but now I seem to be past the worst, and things seems to be working for now.
00:37 Steve__ probably want to update the docs on this config
00:37 UtahDave cool, thanks
00:38 Steve__ pniederw ... feel a bit the same
00:38 Steve__ We are a python shop ... so its a nice fit (vs chef / puppet)
00:39 Steve__ We use fabric a lot also
00:39 Steve__ going to try to use salt-cloud at some point soon.
00:39 pniederw the fact that I'm a dev minus the ops and don't have real-world python experience didn't help, but I'm starting to pick it up
00:39 scoates is there an easy way for me to write to a minion's log file from within a module?
00:40 scoates or to the master's log, actually
00:40 srage joined #salt
00:42 pniederw I decided to go for virtualization based on kvm and libvirt. looked into salt-virt but couldn't find a use for it (no states, module.run has no onlyif), so I went all out with cmd.run for managing my vms. works for now.
00:44 dwyerj can you have multiple replaces in file.replace()
00:45 Steve__ We are on AWS
00:46 pdayton joined #salt
00:47 pdayton joined #salt
00:49 pniederw tried that too, but couldn't get the performance we needed, and didn't seem to be cost-effective for us. all we need is raw CPU and IO speed (build farm), and that's much cheaper to get with root servers.
00:49 dwyerj http://pastebin.com/er5tFXeD
00:49 dwyerj why doesnt that work
00:49 dwyerj it makes no changes
00:49 dwyerj if i have 1 replace, it works.
00:49 dwyerj i have tried adding the count, still nothing
00:49 Steve__ Wondering if salt formula's are a good idea
00:50 packeteer Steve__: how so? standardised 'recipes' are a good idea imo
00:50 Steve__ I mean vs rolling our own
00:51 Steve__ trying to config a nginx/apache/django/mongo stack
00:51 Steve__ the designs behind each in the library seem a bit different
00:51 packeteer different authors ?
00:52 Steve__ Would be nice if SaltStack supplied a nice library for all the standard stuff
00:52 Steve__ particularly dango
00:52 packeteer personally i like 1 way to achieve the same result
00:52 fxhp There isn't a single proper way to deploy a django application
00:53 packeteer but that tends to limit flexability
00:53 NotreDev joined #salt
00:53 JulianGindi joined #salt
00:53 Steve__ yes different authors
00:53 fxhp All deployments are going to be different based on the relesae needs
00:54 Steve__ I guess the main thing is that it were clean and fast to get up and running on nginx/apache/django it would drive adoption of this
00:55 srage_ joined #salt
00:55 Steve__ I worked with chef a bit and found it took a lot time to get basic stuff done
00:55 packeteer ^^^
00:56 srage__ joined #salt
00:57 packeteer chef is prob ok if you're a ruby god
00:58 packeteer but i'm certainly not
01:00 pipps_ joined #salt
01:03 redondos joined #salt
01:04 JasonSwindle joined #salt
01:04 Steve__ me either
01:04 Steve__ we are heavy python users so its a nice fit
01:07 Gifflen_ joined #salt
01:12 zandy joined #salt
01:12 pdayton joined #salt
01:17 mgw joined #salt
01:17 xmltok joined #salt
01:17 scoates this allows me to check out submodules… but it's not pretty. https://github.com/fictivekin/salt/commit/4ab592f29d48a75cc11fc6c4ac21d030f6e6c5dc <-- anyone care to take a look?
01:21 srage joined #salt
01:27 Gifflen joined #salt
01:29 Nexpro1 joined #salt
01:31 NotreDev joined #salt
01:34 nmistry joined #salt
01:39 Linz joined #salt
01:57 redondos joined #salt
01:58 xmltok joined #salt
02:06 nmistry joined #salt
02:10 cnelsonsic joined #salt
02:14 Furao joined #salt
02:21 diegows joined #salt
02:22 xmltok joined #salt
02:29 xl1 joined #salt
02:29 pipps_ joined #salt
02:33 favadi joined #salt
02:33 dangerousbeans joined #salt
02:39 techdragon joined #salt
02:40 techdragon Got some strange behaviour that has me pretty ... to be polite, up the creek without a paddle.
02:40 techdragon file.manage seems broken.
02:44 techdragon i found this bug - https://github.com/saltstack/salt/issues/8797 - but it doesn't match what I see. I have a fairly simple state to template an nginx config. Which doesn't do anything. Salt keeps reporting the file is in the correct state, I've run salt-call -l all to try and get more info, and i don't get more info, salt seems somehow blind/deaf to the fact this file is Definitely incorrect.
02:44 techdragon through multiple updates to the file.
02:46 diegows joined #salt
02:50 cocoy joined #salt
02:53 Sheco joined #salt
02:55 xmltok joined #salt
02:55 ravibhure joined #salt
02:57 redondos joined #salt
02:58 techdragon Just found a root cause for my issue, the minion cache is out of date... no idea how though. :-/
03:00 ajw0100 joined #salt
03:03 NotreDev joined #salt
03:05 techdragon Has anyone else had issues with caches getting out of date?
03:05 terminalmage joined #salt
03:08 kryptt joined #salt
03:08 Gifflen joined #salt
03:08 kryptt joined #salt
03:17 sgviking joined #salt
03:19 mafrosis joined #salt
03:20 mafrosis lo salters
03:23 vkurup joined #salt
03:25 dh joined #salt
03:28 lineman60 joined #salt
03:29 NV hrm, any suggestions on a minion that is losing connectivity?
03:29 NV restarting the minion fixes it
03:30 NV if i restart the master, i notice the tcp connection reconnects (different port etc), but test.ping still fails
03:30 NV so isn't a dead tcp connection or anything
03:31 NV RHEL6's, PyZMQ: 2.2.0.1 ZMQ: 3.2.3 Salt: 0.17.2
03:31 NV master is the same except ZMQ: 3.2.4
03:32 NV i also have some windows minions that disconnect too
03:32 NV (windows 0.17.2 installer)
03:32 khaije1 left #salt
03:34 srage_ joined #salt
03:35 vkurup joined #salt
03:35 redondos joined #salt
03:45 littleidea joined #salt
03:50 jsm joined #salt
03:54 vkurup joined #salt
03:55 redondos joined #salt
03:59 jsm joined #salt
03:59 pipps_ joined #salt
04:06 dvogt joined #salt
04:07 nmistry joined #salt
04:18 ckao joined #salt
04:22 sebest joined #salt
04:22 dangerousbeans joined #salt
04:23 anuvrat joined #salt
04:27 xl1 joined #salt
04:30 lemao joined #salt
04:31 quickdry21 joined #salt
04:32 quickdry21 joined #salt
04:33 quickdry21 joined #salt
04:45 redondos joined #salt
04:48 junedm joined #salt
04:57 bemehow joined #salt
05:06 EWDurbin joined #salt
05:09 stefanmonkey joined #salt
05:13 cedwards joined #salt
05:19 kermit joined #salt
05:21 forrest ok who has a minute for some git help?
05:25 zach sure
05:25 zach I'm bored
05:26 forrest zach, alright, so I did this : https://github.com/gravyboat/salt/commits/develop
05:26 forrest where I somehow boned up merge 5e45f11
05:26 forrest that should have been my own commit, with a message I prepped, but I somehow attached it to that previous one
05:26 zach so you want to roll back?
05:26 zach http://stackoverflow.com/questions/4114095/revert-to-previous-git-commit
05:26 forrest if that will fix it, last time I tried it keeps trying to unstage the changes from 315b8
05:27 forrest yea I looked at that
05:27 forrest the problem is if I do that, I get the other file that techhat actually pushed on 315b8
05:27 forrest which I don't want to change in any way shape or form
05:27 forrest for some reason 5e45 also has techhat's changes
05:27 zach weird
05:28 forrest yea
05:28 zach I guess maybe I should learn more about git before I offer up help ;-)
05:28 forrest lol
05:28 forrest yea I already hit up google
05:28 forrest and there doesn't seem to be a good way to just say 'yea how about you go screw yourself with this mixed commit' :(
05:28 zach IT Staff -- they have a position due to knowing how the googles work
05:28 forrest lol
05:28 forrest Yep
05:28 forrest I tried rebase, I tried branching it off and then fixing it and merging it back
05:29 zach this is why I don't care for development work
05:29 zach no configuration management or change logs needed!
05:29 zach free for all
05:30 zach did you see: http://www.git-scm.com/book/en/Git-Basics-Undoing-Things
05:30 robinsmidsrod joined #salt
05:31 forrest yes I looked at that too
05:33 forrest It would have been easy to check the file out and fix it that way, if the other commit somehow hadn't gotten in there
05:33 forrest I don't get how it happened either, I didn't do anything unusual
05:42 sandGorgon joined #salt
05:49 sandGorgon joined #salt
05:50 forrest man I just fucked it up even more zach
05:59 forrest ok fixed it zach, had to nuke my change from orbit to rever the history back to what was 'good'
05:59 junedm joined #salt
06:00 Destro joined #salt
06:01 forrest damn you terminalmage, your pull request already fixed this...
06:02 terminalmage haha
06:02 terminalmage what
06:02 forrest your typo in managed.sls
06:02 forrest softare
06:02 terminalmage ahh
06:02 terminalmage yeah
06:03 forrest went ahead and fixed it, and then realized your other pull fixed it *facepalm*
06:03 terminalmage hehe, I've been there
06:05 forrest well, now that I've wasted an hour fixing my stupid repo, I'm outta here.
06:05 rmt joined #salt
06:07 lendar joined #salt
06:08 junedm1 joined #salt
06:09 junedm2 joined #salt
06:10 dangerousbeans joined #salt
06:25 anindita joined #salt
06:25 middleman_ joined #salt
06:32 zach forrest: Crazy man
06:34 Nazzy joined #salt
06:42 Nazzy basepi, assuming you're awake, I replied to #8862 with more info :)
06:47 suna joined #salt
06:53 matanya joined #salt
07:10 stefanmonkey I find a problem when i run the function cmd.run like ' bla bla bla -name: sh /path/to/test.sh' , the test.sh run cd /path and tar the xx.tar.gz and configure something. Then false. I Run "whereis cd", then print nothing.
07:11 stefanmonkey did the saltstack change it on minion?
07:11 dork joined #salt
07:12 stefanmonkey whereis my cd  ?  It is not in my $PATH
07:14 Nazzy stefanmonkey, cd isn't a program
07:15 Nazzy #  `---> where cd
07:15 Nazzy cd: shell built-in command
07:18 stefanmonkey Oh ,  tks, I think I ask a stupid question. :p
07:20 stefanmonkey I have another question,   when i type "declare" , It print a lot of thing like '_xx() {xxxxxx}',  is it saltstack does?
07:36 Nazzy stefanmonkey, declare seems to be a more detailed version of env
07:41 dangerousbeans joined #salt
07:41 dangerousbeans left #salt
07:41 anitak joined #salt
07:45 anindita left #salt
07:55 pniederw joined #salt
07:56 pniederw is there way to define a state sls template and include it with different values in different contexts?
07:56 juasiepo joined #salt
07:59 Nazzy pniederw, extend ?
08:02 balboah joined #salt
08:04 giantlock_ joined #salt
08:04 pniederw extend doesn't do it for this use case (neither does pillar). I need different values to be bound to jinja variables used by the sls, depending on where I include it. thinking about it, this is similar to having my own state function.
08:04 slav0nic joined #salt
08:05 pniederw ...that gets called with different values in different contexts
08:08 pniederw something like file.managed.context, just for
08:08 mikkn What kind of different contexts? :) You have http://docs.saltstack.com/ref/states/vars.html available to you at least...
08:08 pniederw sls files
08:09 pniederw the context (i.e. variable bindings) needs to be controlled by the sls that contains the include
08:10 mikkn I'm new to salt in general, but the way I've understood it is that you should in that case set either a grain or a pillar from the including template and read it in the included template...
08:10 malinoff pniederw, Can you pastebin an example, how do you see such thing?
08:11 mikkn So fra just the {{ env }} has been enough for me. :)
08:11 Nazzy pniederw, you could do that with pillar, since you have access to the pillar content from jinja
08:13 pniederw doesn't feel right to pass parameters via global vars (pillar), not sure if it's reliable (one state run could have multiple includes with different parameters)
08:14 pniederw probably I just need to write my own state function, wondered if there was a simpler way to achieve a similar effect
08:17 pniederw ah, pillar include does support a `context` attribute, that's what I had in the back of my mind. now it's just a question of whether this also works for state files.
08:18 harobed_ joined #salt
08:19 mike251 joined #salt
08:19 harobed_ joined #salt
08:23 carlos joined #salt
08:28 zach joined #salt
08:33 pniederw argh, doesn't seem to be supported
08:35 anitak joined #salt
08:37 lendar joined #salt
08:39 holmb Is there conflicting heads on github at the moment?
08:39 holmb I am getting a merge commit when merging from upstream/develop.
08:39 holmb s,commit,conflict,
08:41 gasbakid joined #salt
08:42 linjan joined #salt
08:45 Jahkeup joined #salt
08:46 basepi joined #salt
08:47 Nazzy holmb, that usually indicates a problem in your local branch
08:50 Iwirada joined #salt
08:57 pniederw mikkn: doesn't seem to be possible to set pillar values from a state file
08:58 sebest joined #salt
08:59 ConceitedCode joined #salt
09:06 anitak joined #salt
09:07 xenoxaos left #salt
09:08 rawzone Nooooo yet again my saltmaster have died. Again... Hope the FreeBSD ports guys get the py-zmq port upgradede soon
09:10 lemao joined #salt
09:13 ollins joined #salt
09:16 scott_w joined #salt
09:17 mikkn pniederw: I'm also trying to grasp how exactly things fit together, but since they use the same file format and everything I guess you could write a pillar that would assign the appropriate values you can read from instead?
09:18 mikkn http://docs.saltstack.com/topics/pillar/index.html
09:21 pniederw I don't see how that solves my problem. I need to define the data used by the included state file at the point of inclusion.
09:21 pniederw (I already make extensive use of pillar for other purposes.)
09:23 mikkn pniederw: I can't really wrap my head around what you're actually trying to achieve, I'm afraid. I understand what you're technically asking for, but I'm not sure you can do it "cleanly". You could have a state that writes grains, at least (to /etc/salt/grains, for instance), but those will then be static for the minion until you restart the minion if I understand correctly.
09:25 mikkn pniederw: I thought you were able to write pillars, but thinking about it more it makes less sense if you were able to. The state files as far as I understand are supposed to be agnostic-ish templates which you can control the state in using pillars, grains, environments and such.
09:26 N-Mi_ joined #salt
09:27 mikkn pniederw: But it sort of feels like the blind leading the blind with me trying to help you. :D
09:28 pniederw neither grains nor pillar are the solution. I simply want reusable/parameterizable state files. something similar is already supported for pillar files (include with `defaults:` attribute). filed https://github.com/saltstack/salt/issues/8878. meanwhile I'm writing my own state function instead.
09:29 gasbakid joined #salt
09:30 mike251 :)))
09:31 Nazzy pniederw, sounds like what you really want is pydsl and a function, but I've been having problems doing exactly what you're after
09:36 pniederw don't see how pydsl helps here. the problem I need to solve is passing parameters. with my own state function I can of course do this.
09:36 pniederw I mean, I can pass parameters *to* my own state function
09:36 mikkn pniederw: Have you looked at stateconf http://docs.saltstack.com/ref/renderers/all/salt.renderers.stateconf.html#module-salt.renderers.stateconf
09:37 mikkn Saw a neat example here: https://groups.google.com/forum/#!topic/salt-users/wKvrHLdOXT4 when looking for something else.
09:39 mikkn pniederw: It's the fourth message from the top.
09:41 zooz joined #salt
09:44 pniederw thanks for the link. they are asking for the exactly same thing as I do. the fourth message provides a workable albeit somewhat clunky solution.
09:45 pniederw e.g. I don't want to use a different renderer in the *including* file
09:46 Nazzy pniederw, I used pydsl to make a python class that I can set attributes on and then call a function that does all the state work
09:46 pniederw how is that different/better than writing a state module in the first place?
09:49 Nazzy hmmm, you got me there actually
09:50 Nazzy the only reason I didn't make the code a full blown module was the handiness of salt distributing state files, but it probably distributes full state modules too
09:51 scott_w joined #salt
09:51 pniederw I've been told you just need to drop the modules into _modules/ under a file root
09:51 Nazzy the handy thing about pydsl is it giving you things like pillars and the state type in __builtins__, but that's likely not that much of a saving
09:52 mike251 hey guys... stupid question... i can not find in documentation where i can apply states in top.sls depending on the pillar data... can you give me a hint if you know what i mea?
09:54 malinoff mike251, {% if pillar['data'] == 'my_cool_data' %} # do smth {% endif %}
09:54 mike251 malinoff: ... not in the state itself, in the top.sls.... to apply states based on pillar data... it was something with match ...
09:55 mike251 malinoff:  like base:  '*' : ... states for all minions...
09:55 littleidea joined #salt
09:55 mike251 i want to have 'web' ... match the pillar['role']
09:56 JasonG_TA joined #salt
09:57 malinoff mike251, http://docs.saltstack.com/ref/states/top.html#other-ways-of-targeting-minions
09:57 pniederw 'role:web': - match: pillar
09:57 mike251 pniederw: THAT's the one :) thanks buddy!!!
09:58 junedm joined #salt
09:58 pniederw glad I'm on the answering end for once
09:58 mike251 haha :) pniederw i know what you mean.... i am a newbie myself... but sometimes i managed to answer ... and it felt GOOD
09:58 pniederw funny thing is, I'm also matching on `role:` :-)
09:59 pniederw so this answer came fairly naturally to me
10:00 pniederw the one problem I found with this approach is that you can't assign multiple roles to a node
10:00 junedm1 joined #salt
10:01 mike251 pniederw: .... that what i was about to do!!!
10:01 zach joined #salt
10:01 mike251 to add 2 roles for that minion
10:02 pniederw I don't think you can write a pillar match expression that matches on just one role then
10:02 pniederw if you find one, let me know
10:02 malinoff 'P@roles:webnode and P@roles:dbnode':
10:02 pniederw I mean, if you find a way
10:02 malinoff - match: compound
10:03 malinoff Matches on 2 roles
10:03 mike251 malinoff: you are the man :)
10:03 malinoff btw
10:03 pniederw how can one pillar attribute have two values?
10:03 mike251 config_files:
10:03 mike251 - ntp
10:03 mike251 - dns
10:03 mike251 this is one of my pillars
10:04 malinoff Easily. pillar['roles'] = ['webnode', 'dbnode']
10:04 malinoff mike251, I use salt for 5 months :)
10:04 mike251 malinoff: where did you use that : pillar['roles'] = ['webnode', 'dbnode']  ? in a pillar? can you use this coding?
10:04 pniederw not sure we talk about the same thing
10:05 mike251 malinoff: i use salt for 2 weeks
10:05 mike251 we are confusing ourselves.
10:05 mike251 let me create a pastebin
10:05 malinoff mike251, Nowhere. I just pointer that pillar is just a python dict that can have any value
10:05 malinoff pointed*
10:05 mike251 AHA.. so in the pillar... you use the normal    key:   - val1   -val2   ?
10:06 JasonG_TA joined #salt
10:06 mike251 malinoff: i thought there is another way of doing this ... another way of structuring data ...
10:06 pniederw I get that. question is, can you match on the list of roles containing a particular value in state top.sls?
10:06 malinoff In pillar/data.sls
10:06 malinoff mypillar:
10:07 malinoff - one
10:07 malinoff - two
10:07 anitak joined #salt
10:07 malinoff then set up the top file
10:07 malinoff and run salt '*' saltutil.refresh_pillar
10:07 malinoff pniederw, Yes. http://docs.saltstack.com/ref/states/top.html#other-ways-of-targeting-minions
10:08 malinoff ah
10:08 malinoff in state
10:09 pniederw malinoff: I don't see the answer there. can you give the expression that matches if `mypillar` *contains* `one`?
10:09 malinoff Dunno. My states are simple enough. I don't need any complex information right in a state, I prefer to use grains and pillars
10:09 mike251 http://pastebin.com/RXKEhSVY
10:10 mike251 can i have in my pillar a new level?
10:10 mike251 not only key: values ... .but key:subKey:values?
10:11 pniederw malinoff: this isn't about complex information in states
10:11 mikkn Is it possible or advisable for the pillars and states to share repository if you use gitfs? o.o
10:11 malinoff mike251, http://pastebin.com/59UXEwRP
10:11 mike251 malinoff:  awesome... thanks buddy
10:12 malinoff pniederw, 'P@roles:webnode' is "Minion has 'roles' pillar, and pillar['roles'] contains 'webnode'"
10:13 malinoff pniederw, the easiest way is to try and understand
10:14 pniederw if that works, that's great news. so far I've only understood it as pillar['roles'] == 'webnode', which is how it works when the pillar is defined as `roles: webnode`.
10:15 malinoff pniederw, Salt is clever enough to transform 'P@roles:webnode' to "'webnode' in pillar['roles']" on demand
10:16 mike251 malinoff:  http://pastebin.com/31MTh16b   based on your suggestion the compound match at the bottom... should work?
10:16 pniederw mikkn: the current problem with sharing pillars and states in same git repo is that pillar_git, unlike git_fs, always includes the root of the repo. I solved this by having symlinks in the git repo.
10:17 pniederw so I can keep pillar in a separate subdirectory and just need to delete the symlinks once the problem is solved
10:17 malinoff mike251, Probably :) Never used nested dictionaries in targeting. But you can try
10:17 mike251 i tried with only 1 level... and is not matching...
10:18 mike251 'P@software_initial:ntp':
10:18 mike251 i will test a bit...
10:18 pniederw malinoff: that's great news. why didn't you tell me that a few days earlier? where did you learn about this feature?
10:19 zach___ joined #salt
10:19 mike251 ah malinoff you made a small error :
10:19 malinoff pniederw, Uhm.... I just tried :) On grains, not pillars, but they are almost the same
10:19 mike251 P in a compound match .. matches for GRAINS not pillars
10:19 mike251 http://docs.saltstack.com/topics/targeting/compound.html?highlight=match
10:19 mike251 I matches for pillars :)
10:19 malinoff mike251, Right :)
10:20 mike251 malinoff:  anyway - you gave me a great idea :) i forgot about compound matching
10:20 pniederw I don't even need a compound match, I just need the `contains` semantics, which according to malinoff, I'll get for free when I stuff a list into the pillar variable.
10:20 mike251 yeah pniederw
10:21 mike251 pniederw:  for that you do not need compound ... just 'pillarKey:value':  - match: pillar
10:21 mike251 so far it's been a good morning... a lot of ideas in my head now :D
10:23 mike251 now... another Q... based on this state matching ... compound ... can i create a state that includes other states ONLY if  a pillar data contains something?
10:24 mike251 would this work: if pillar['data']=='value' ...then include a state.sls?
10:25 pniederw malinoff, since you seem to know your stuff, can I write a plain python function that can be called from a jinja template, and if so, how can the function get access to pillar?
10:25 malinoff mike251, yes :)
10:27 mike251 great :)
10:27 malinoff pniederw, You can achieve this with #!py renderer. http://docs.saltstack.com/ref/renderers/all/salt.renderers.py.html
10:27 mikkn pniederw: But do you symlink the entire folder structure for your pillars into the root then?
10:29 pniederw yes, I symlink everything directly under pillar/ into the root. currently that's just a few files and dirs for me. other solution is to use a separate git repo for pillar, but that didn't make sense for me. surely this will get fixed.
10:31 pniederw malinoff: you mean I can call my python function from a state file that uses the py renderer? where do I put that function?
10:32 kiorky basepi: any chance you there ?
10:33 kiorky we have a tricky use case for reload_modules
10:33 regilero joined #salt
10:33 malinoff pniederw, anywhere you want, just be sure it is accessible via sys.path
10:33 kiorky basepi: wait, we will do a proper bugreport, and you must be sleeping...
10:35 pniederw ok. I don't really know python. sys.path isn't a good option for me. would prefer to put it somewhere below a salt file root (which is git repo in my case).
10:35 dangerousbeans joined #salt
10:36 pniederw and I'd need to find a way to call it from a jinja template.
10:37 pniederw but thanks, your explanations have been extremely valuable. you should write a book on salt. :-)
10:37 william_20111 joined #salt
10:39 malinoff pniederw, you can write your function right in this state file that will be rendered by py renderer
10:40 torrancew joined #salt
10:40 pniederw my goal is to write a helper function that computes a value out of pillar and can be used from jinja expression in any state file. the bigger goal is to avoid redundancy in pillar.
10:42 kiorky regilero: basepi: (https://github.com/saltstack/salt/issues/8881)
10:42 pniederw concretely, in pillar I say that node1 has role web. now I want to do a reverse lookup, i.e. find the node with role web. currently I define this redundantly in pillar.
10:43 pniederw (the pillar that matches nodes with roles is available to all minions in my case)
10:43 pniederw s/matches/associates
10:45 pniederw currently, when I add a role to a node, I also have to add the node to the role. that's the pillar redundancy I want to eliminate.
10:47 pniederw I could code up the lookup right in the jinja templates, but that's just another form of redundancy. hence I'd like to factor out the code into a python function. over and out. :-)
10:49 malinoff pniederw, well, you can try to write your own module with that helper function, sync it via minions and use {{ salt['yourmodule.helperfunc'](args, kwargs) }} in state files
10:51 pniederw sounds good. can I solve the syncing just by dropping the module into the "right" directory below a file root? have been told that `modules_` works for state modules.
10:51 pniederw actually it's `_modules`
10:52 pniederw maybe the same works here. will give it a try. thanks! invaluable learning today.
10:54 malinoff pniederw, you should use salt \* saltutil.sync_modules to actually sync them
10:54 pniederw auto-loading no good? http://docs.saltstack.com/ref/file_server/dynamic-modules.html
10:55 MrTango joined #salt
10:56 pniederw that page makes me think I should use _states for state modules, and _modules for execution modules
10:57 malinoff pniederw, dunno about _states :) But you should definitely use _modules for execution modules, right
11:01 junedm1 left #salt
11:03 pniederw state modules indeed go into `_state` (according to http://docs.saltstack.com/ref/states/writing.html)
11:03 pniederw I mean `_states`
11:05 malinoff pniederw, alright :)
11:07 anitak joined #salt
11:12 ollins joined #salt
11:13 ss1 joined #salt
11:13 juasiepo joined #salt
11:13 mortis # python check_by_salt.py -H gannicus -p "/usr/lib/nagios/plugins/check_load -w 2,2,2 -c 5,5,5"
11:13 mortis OK - load average: 0.02, 0.02, 0.05|load1=0.020;2.000;5.000;0; load5=0.020;2.000;5.000;0; load15=0.050;2.000;5.000;0;
11:13 mortis yes sir, i like it
11:20 che-arne joined #salt
11:29 donatello joined #salt
11:42 zandy joined #salt
11:46 wilywonka joined #salt
11:58 jeddi joined #salt
12:01 baffle Hmm, anyone have a good way to modify how "file: - user:" behaves? I'd like to do something like "if user X exists, set owner to that. If not, set it to root". Inline python? :)
12:01 wilywonka joined #salt
12:03 lendar joined #salt
12:05 scott_w joined #salt
12:08 anitak joined #salt
12:10 scott_w joined #salt
12:11 sunand joined #salt
12:12 __number5__ baffle: jinja will be enough
12:12 scott_w joined #salt
12:13 sunand Hello, To make salt-ssh run. installing salt-master will be enough?
12:15 Iwirada joined #salt
12:16 baffle __number5__: Oh, how?
12:16 baffle __number5__: I.e. I need to check if a user exists on the machine it is running on..
12:19 scott_w joined #salt
12:22 baffle \o/
12:22 baffle {% if salt['cmd.run']("getent passwd glance") %}
12:22 baffle {% set user = "glance" %}
12:22 baffle {% else %}
12:22 baffle {% set user = "root" %}
12:22 baffle {% endif %}
12:23 techdragon joined #salt
12:23 sunand_ joined #salt
12:25 sunand_ I tried to install salt master u sing the bootstrap script. even after installation  salt-ssh says command not found
12:26 __number5__ baffle:  yep you got it :)
12:26 techdragon Anyone got some idea what I've done wrong with this for loop in a state config? https://gist.github.com/techdragon/7691032
12:26 __number5__ could also use http://docs.saltstack.com/ref/modules/all/salt.modules.useradd.html#salt.modules.useradd.list_users to check other than cmd.run
12:27 __number5__ e.g. if 'usera' in salt['useradd.list_users']
12:28 dangerousbeans left #salt
12:30 kyusan joined #salt
12:32 baffle That seems prettier.
12:34 baffle TypeError: argument of type 'StrictUndefined' is not iterable
12:37 techdragon any ideas? ... its confusing me greatly. ( https://gist.github.com/techdragon/7691032 )
12:42 jenner joined #salt
12:42 jenner heya
12:43 elfixit joined #salt
12:45 Sheco joined #salt
12:50 techdragon Tried another refactor. still not working, scratching my head as to what is wrong :-( https://gist.github.com/techdragon/7691032
12:54 Balu_ joined #salt
12:55 yidhra joined #salt
13:05 zooz joined #salt
13:08 anitak joined #salt
13:09 techdragon Im trying to follow the pattern from here, http://docs.saltstack.com/topics/tutorials/pillar.html#more-complex-data yet its not working :-( https://gist.github.com/techdragon/7691032
13:09 techdragon Is that example still valid ?
13:12 scott_w joined #salt
13:21 jankowiak joined #salt
13:25 scott_w joined #salt
13:25 lendar joined #salt
13:33 lendar joined #salt
13:43 ollins joined #salt
13:45 dangerousbeans joined #salt
13:49 linjan joined #salt
13:56 cym3try joined #salt
13:59 ravibhure joined #salt
14:04 Nazzy don't suppose if anyone knows if there is a way to define custom output modules?
14:04 NV Nazzy: there is
14:04 mike251 output modules ... ? i am curious on this one..
14:04 jslatts joined #salt
14:05 Nazzy NV, cool, can you remember how?  I tried putting an _output folder in the file_root but no joy
14:06 Nazzy mike251, I want to fiddle with http://docs.saltstack.com/ref/output/all/salt.output.highstate.html ... cause I'm weird like that :p
14:07 mike251 Nazzy: i am looking into that as well ... i want to parse the output data ... with PHP
14:07 NV Nazzy: http://docs.saltstack.com/ref/returners/ - not useful for interactive output, but useful if you want to redirect the output somewhere else programatically
14:08 NV programmatically**
14:08 mike251 Nazzy: i saw the returners yesterday... so i know i can send the data directly to mysql - which is fine by me...
14:08 mike251 Nazzy: for example the test.ping... i can send it to mysql (i haven't had the time to test it yet though)
14:09 NV else just use json_out or yaml_out or something and re-format the output using another tool
14:09 NV should be easy enough to parse :)
14:09 mike251 NV do you have an example?
14:09 anitak joined #salt
14:09 mike251 the data from the output is Yaml?
14:09 Nazzy NV, mike251: yea, I know of returners, I was hoping to get under the skin of outputters specifically though
14:10 NV mhmm, might be worth an issue request :P
14:10 mike251 Nazzy:  yeah ... i am looking into that as well
14:10 Nazzy the formatting of highstate terse makes my alignment compulsions twitch :p
14:16 mike251 where do you have the  option to change the output?
14:16 mike251 directly from the cli ?
14:17 Nazzy for highstate you can change it from full to terse, mixed or (the undocumented) changes options in your master config
14:17 Nazzy state_output: changes
14:17 mike251 ah ok ... but FULL is fine by me.  Nazzy the output is YAML, right?
14:18 zandy joined #salt
14:18 Nazzy mike251, of highstate? don't think so... there is a yaml outputter though
14:18 mike251 Nazzy: yaml outputer? pff... there are a lot to learn ..
14:19 Nazzy mike251, http://docs.saltstack.com/ref/output/all/index.html :)
14:20 mike251 Nazzy:  thanks a lot buddy !!! i was looking for that
14:20 Nazzy mike251, np :)
14:21 mike251 Nazzy: i am an ass now... where do i save that yaml output state?!
14:21 mike251 Nazzy:  i am looking at the master config... but i can not find that output line... only the terse/mixed thing
14:23 Nazzy mike251, I'm not sure if there's a config option to set that, since some modules pick what they want, but you should be able to do `salt --out=yaml`
14:24 mike251 is weird.. in DOC it should be specified... so a stupid ass like myself to understand and not ask around stupid Q :)
14:24 pniederw joined #salt
14:24 pniederw what's the right way to call a state function from another one?
14:25 mike251 include pniederw ..?
14:25 mike251 if you include the state.. it will be run ...
14:25 foxx joined #salt
14:25 Nazzy pniederw, require?
14:26 pniederw I'm not talking about an SLS, but a state function in my custom state module implemented in python
14:26 pniederw I understand how to call execution functions, but not sure about state functions
14:28 pniederw maybe it's __state__['state.single'](...), dunno
14:28 pniederw I mean __salt__
14:32 Nazzy ah ... hmmm ... from pydsl I'd do include("state.foo").bar()
14:33 Nazzy hmmm, no, that's sls state not state function still
14:33 Nazzy state().single.somefunction() ?
14:38 pniederw where did you get this from?
14:39 quickdry21_ joined #salt
14:40 Nazzy well if I want to do file.managed from pydsl I'd do state().file.managed()
14:41 Nazzy I'd imagine there's a similar mechanism hiding in one of the builtins supplier to a custom state module
14:42 akitada joined #salt
14:49 Linz joined #salt
14:52 juasiepo joined #salt
14:53 dccc joined #salt
14:55 diegows joined #salt
14:58 bastion1704_ does anyone saw this error before : http://pastebin.com/4pZ0mLRA the error is from the master when minion talks to it
15:00 ggoZ joined #salt
15:04 kamal_ <3 saltstack
15:05 mike251 guys... i understand what highstate does... but what is overstate??
15:09 anitak joined #salt
15:09 Nazzy ah hah! sussed it.  set extension_modules in master config, make output folder under that, copy highstate.py in to that output folder, win :)
15:11 mikkn How do you trigger an update in gitfs? It seems very slow (not doing it at all) in updating the refs/ folder for me. :/
15:11 hhatfield joined #salt
15:12 smccarthy joined #salt
15:13 pnl joined #salt
15:15 mikkn ahh, the refs/ is only updated when a highstate is triggered
15:15 mike251 :)
15:22 pniederw I think overstate allows to coordinate work across machines
15:23 mgw joined #salt
15:25 mike251 pniederw: thanks buddy... i am using highstate... and i just saw in doc over.state...
15:25 mike251 which confused me :D
15:26 jean-phi1ippe joined #salt
15:26 jean-phi1ippe hello
15:27 jean-phi1ippe I'm trying to have that in a managed file (using jijna template): {{ salt['pillar.get']('zabbix:agentname', {{ grains['id'] }}) }}
15:27 jean-phi1ippe apparently it doesn't work
15:28 mike251 jean-phi1ippe: can you use pastebin.com? is a lot easier for us to see
15:28 jean-phi1ippe ok
15:28 jean-phi1ippe there is not quite much to see in fact :)
15:29 jean-phi1ippe http://pastebin.com/ZKBFuCiV
15:30 jean-phi1ippe I guess the nested {{ doesn't work, but is there a way to define a grain as a default value of a pillar.get()?
15:31 mike251 jean-phi1ippe:  can you just ... hmm use  {% set myGrain = {{ grains['id'] }}%}  ?
15:31 mike251 jean-phi1ippe: but that will... still need to ... use the nested {}{}{{}{
15:31 pniederw you can, but you don't have to
15:31 pniederw shouldn't need the nested {{ }}
15:32 xmltok joined #salt
15:32 pniederw could also assign the whole expression with set, I suppose
15:32 jean-phi1ippe what do you mean pniederw? just directly use grains?
15:32 giantlock_ joined #salt
15:32 jean-phi1ippe ok will try both
15:32 jean-phi1ippe thanks for the info
15:33 pniederw I thought so. not sure exactly what the rules around {{ }}, but you can definitely set the whole thing first, and then access it as plain variable from {{ }}
15:33 mike251 jean-phi1ippe:  let us how it goes
15:36 rojem joined #salt
15:41 jrgifford joined #salt
15:44 mike251 jean-phi1ippe:  IT WORKS
15:44 mike251 jean-phi1ippe:  {%   set  a = salt['pillar.get']('rolese',  grains['id'] ) %}   then you can access it afterwards with {{ a }}
15:45 mike251 inside a {%%} statement you do not need to use the {{}} because it is already parsed as jinja!
15:47 mike251 but now ... my Question is : salt['pillar.get']('roles',  grains['id'] ) returns:  ['db'] /// i want it to return db   ... how can i do that  ?
15:47 jean-phi1ippe the easiest solution works: simply removing the {{}} around works
15:47 mike251 yes jean-phi1ippe :)
15:47 jean-phi1ippe If I didn't reply earlier is because my salt['pillar.get'] doesn't work yet :p
15:48 mike251 my test worked... jean-phi1ippe  ... but it returns ['db']  ... instead of db
15:49 jean-phi1ippe I don't have the same results as you mike251 ;)
15:50 mike251 hmm
15:53 mike251 the value i get is ['db'] instead of db .. .using : {{  salt['pillar.get']('roles',  'default') }}
15:53 mike251 anyone... any idea?
15:55 slav0nic joined #salt
15:58 th3reverend joined #salt
15:58 th3reverend left #salt
15:59 y0j joined #salt
16:03 [diecast] joined #salt
16:03 Nazzy woo, two pull reqs sent :)
16:04 mike251 Nazzy: do you have 1 sec?
16:04 vejdmn joined #salt
16:05 Nazzy mike251, about 10 sec before I need to go ... sup?
16:06 mike251 can one use a jinja FOR inside top.sls pillar? for example...
16:06 mike251 inserting into the BASE: all files from a folder... files == pillar files
16:06 mike251 something like for all files in folder... add them to this top.sls :D
16:07 Nazzy as far as I can remember, top.sls is jinja templated
16:07 Nazzy try it and see is the best option
16:07 ze- it is. I do use for in it
16:07 ze- I base it on grains and available states names.
16:07 mgw joined #salt
16:07 mike251 ze-: how do you get the files? that is my Q :)
16:07 mike251 hmmmm good one ze- :)
16:07 Nazzy and now *gone*
16:08 mike251 Nazzy:  take care
16:08 ze- {% for role in grains.get('roles', []) %}
16:08 ze- {% if ('role.' + role) in states %}
16:08 ze- - role.{{ role }}
16:08 ze- i have a directory role, with subdir for each valid roles.
16:08 mike251 thanks ze-
16:08 mike251 yeah i see that role.%
16:09 ze- states being a list (or dict?) of available states to include
16:09 ze- (auto from salt, not specific on my system :)
16:09 mike251 so states is actually ... a salt variable? ze- ?
16:09 ze- oh... wait. no.
16:10 ze- {% set states = salt['cp.list_states'](env) %}
16:10 ze- I have that first to get the list :)
16:10 mike251 :))
16:10 mike251 cool
16:10 ze- sorry, forgot to include it.
16:10 mike251 no worries
16:10 ze- also...
16:10 ze- {% if ('host.' + grains['host']) in states %}
16:10 ze- - host.{{ grains['host'] }}
16:10 ze- :)
16:10 anitak joined #salt
16:11 scott_w joined #salt
16:12 mike251 ze-: thanks for the tips !
16:12 mike251 i forgot that i can access all the salt '*' cp.list_states
16:14 bastion1704_ joined #salt
16:16 buttercup joined #salt
16:16 buttercup hi...
16:17 littleidea joined #salt
16:17 Guest1505 can anyone tell me what's the preffered way to install something complex like ossec?
16:17 Guest1505 http://www.nineproductions.com/saltstack-ossec-state-using-reactor/ would this and using reactor be a good way?
16:17 jsm joined #salt
16:17 Guest1505 never used reactor before....
16:18 mike251 sorry ... never used reactor myself...
16:21 Dinde joined #salt
16:25 anuvrat joined #salt
16:25 anitak joined #salt
16:26 rojem joined #salt
16:28 Guest1505 gotta look into it... seems like a rarely used feature
16:32 sandGorgon joined #salt
16:34 jean-phi1ippe exit
16:34 mike251 :)
16:34 jean-phi1ippe woops
16:34 mike251 bye
16:34 jean-phi1ippe cya!
16:34 danielcg_ joined #salt
16:35 danielcg_ left #salt
16:40 bastion2202 joined #salt
16:40 pipps joined #salt
16:53 foxx joined #salt
17:03 zandy joined #salt
17:12 vejdmn joined #salt
17:16 Ryan_Lane joined #salt
17:21 bastion1704 joined #salt
17:21 sandGorgon joined #salt
17:24 bastion1704_ joined #salt
17:24 pipps joined #salt
17:24 bastion1704_ joined #salt
17:27 bastion2202 joined #salt
17:29 nmistry joined #salt
17:35 oz_akan_ joined #salt
17:41 anitak joined #salt
17:45 mgw joined #salt
17:45 zandy joined #salt
17:50 bastion1704_ joined #salt
17:55 anitak joined #salt
18:10 mgw joined #salt
18:13 zandy joined #salt
18:16 sandGorgon joined #salt
18:24 cron0 joined #salt
18:30 anitak joined #salt
18:33 jankowiak joined #salt
18:36 foxx[cleeming] joined #salt
18:36 foxx[cleeming] joined #salt
18:36 matanya joined #salt
18:46 zandy joined #salt
18:50 littleidea joined #salt
18:53 diegows joined #salt
18:53 lemoi joined #salt
18:53 bemehow joined #salt
18:55 oz_akan_ joined #salt
18:56 lemoi left #salt
19:01 dangerousbeans joined #salt
19:01 dangerousbeans left #salt
19:01 lemoi joined #salt
19:04 pdayton joined #salt
19:13 ccase joined #salt
19:17 ajw0100 joined #salt
19:20 bastion2202 joined #salt
19:31 anitak joined #salt
19:38 jazz joined #salt
19:39 Nazca__ joined #salt
19:46 zandy joined #salt
19:57 regilero left #salt
20:08 zandy joined #salt
20:12 zooz joined #salt
20:26 littleidea joined #salt
20:31 anitak joined #salt
20:36 yidhra joined #salt
20:37 bemehow joined #salt
20:49 dangerousbeans joined #salt
20:50 bemehow joined #salt
20:57 khaije|io joined #salt
20:58 khaije|io Happy T-Day (for those to whom it applies)
20:59 dangerousbeans left #salt
21:02 pass_by_value joined #salt
21:07 cewood joined #salt
21:08 frosty996 khaije|io: right back at ya!
21:14 bemehow joined #salt
21:16 bemehow joined #salt
21:18 frosty996 left #salt
21:32 anitak joined #salt
21:34 pass_by_value joined #salt
21:34 cym3try joined #salt
21:34 jeddi joined #salt
21:45 littleidea joined #salt
21:45 Nazca joined #salt
21:54 mgw joined #salt
21:58 pass_by_value joined #salt
22:10 pass_by_value joined #salt
22:10 mgw joined #salt
22:11 matanya joined #salt
22:12 anuvrat joined #salt
22:19 dwyerj joined #salt
22:23 giantlock_ joined #salt
22:29 bemehow joined #salt
22:30 bemehow_ joined #salt
22:32 anitak joined #salt
22:34 bemehow joined #salt
22:39 [diecast] joined #salt
22:39 rojem joined #salt
22:41 zandy joined #salt
22:44 fllr joined #salt
22:45 dwyerj joined #salt
22:45 fllr Hey guys. I'm trying to run file.recurse on a directory. It worked fine the first time, but the second time around it's not detecting the new files I added to the directory, and it's not sending it to the minions. What gives?
23:10 redondos joined #salt
23:17 zandy joined #salt
23:19 xerxas joined #salt
23:23 [diecast] joined #salt
23:28 harobed_ joined #salt
23:28 harobed_ joined #salt
23:31 oz_akan_ joined #salt
23:33 anitak joined #salt
23:39 sebest joined #salt
23:46 zandy joined #salt
23:54 littleidea joined #salt
23:57 littleidea joined #salt

| Channels | #salt index | Today | | Search | Google Search | Plain-Text | summary