Perl 6 - the future is here, just unevenly distributed

IRC log for #salt, 2017-07-07

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

All times shown according to UTC.

Time Nick Message
00:03 whytewolf some of these are great, some of them have me scratching my head. such as http_query. there is already a module.function that does http.query and isn't as limited as that filter. also, not sure when someone is going to use network_size in a jinja template.
00:03 whytewolf although more filters is always a welcome thing
00:24 woodtablet left #salt
00:30 iggy and why they couldn't do a map_format filter is beyond me
00:33 nismo joined #salt
00:35 fritz09 joined #salt
00:39 jeddi joined #salt
00:40 icebal joined #salt
00:41 benbro joined #salt
01:26 c4rl3x joined #salt
01:31 Praematura joined #salt
01:41 benbro1 joined #salt
01:48 ilbot3 joined #salt
01:48 Topic for #salt is now Welcome to #salt! <+> Latest Versions: 2016.3.6, 2016.11.6 <+> Support: https://www.saltstack.com/support/ <+> Logs: http://irclog.perlgeek.de/salt/ <+> Paste: https://gist.github.com/ <+> See also: #salt-devel, #salt-offtopic <+> We are volunteers and may not have immediate answers <+> The call for speakers for SaltConf17 is now open: http://tinyurl.com/SaltConf17
01:52 nismo Hi
01:52 nismo Is it possible to import a schema config into salt to autopopulate a mysql database?
01:58 nixjdm joined #salt
02:17 mikea nismo, you can do a lot of mysql_query.runs https://docs.saltstack.com/en/latest/ref/states/all/salt.states.mysql_query.html
02:33 nismo I was able to find a pretty good example: https://github.com/saltstack-formulas/zabbix-formula/blob/master/zabbix/mysql/schema.sls
02:34 nicksloan joined #salt
02:41 benbro joined #salt
02:44 deuscapturus joined #salt
02:47 evle joined #salt
02:50 mquin joined #salt
02:52 aneeshusa joined #salt
02:52 swa_work joined #salt
03:04 ssplatt joined #salt
03:13 nixjdm joined #salt
03:30 aneeshusa joined #salt
03:38 Praematura joined #salt
03:41 benbro1 joined #salt
03:51 donmichelangelo joined #salt
04:03 ssplatt joined #salt
04:09 nethershaw joined #salt
04:10 beardedeagle joined #salt
04:11 jrklein joined #salt
04:21 aneeshusa joined #salt
04:27 c06 joined #salt
04:33 __number5__ joined #salt
04:34 c06 hi alll
04:35 c06 how to add or insert multiline content with leading space in salt. any suggestions i tried append with content: | but its stripping spaces also i tried list its showing error.
04:35 c06 any suggestions
04:41 benbro joined #salt
04:41 pppingme joined #salt
04:48 nethershaw joined #salt
04:50 aleph- joined #salt
05:21 hemebond c06: The first line determines the left-most-point.
05:24 hemebond however...
05:28 hemebond If you use |2 then any indentation after the first two spaces will be kept.
05:29 hemebond |2 is the default but if not specified it will change automatically based on the first line of content.
05:29 Bock joined #salt
05:32 gareth__ joined #salt
05:38 c06 hemebond: if are from salt team can u check this ne
05:39 c06 hemebond: ty i will check that one
05:41 benbro1 joined #salt
05:41 c06 i will insert the some funciton code with different indention at each line i.e., python codes that time how i can proceed. any idea.?
05:43 c06 hemebond: ** i want to
05:54 felskrone joined #salt
06:03 preludedrew joined #salt
06:05 do3meli joined #salt
06:05 do3meli left #salt
06:12 Inveracity joined #salt
06:25 mr_kyd- joined #salt
06:25 impi joined #salt
06:36 Praematura joined #salt
06:36 felskrone joined #salt
06:38 wybczu joined #salt
06:38 dograt joined #salt
06:39 Annihitek joined #salt
06:39 dankolbrs joined #salt
06:40 Puckel_ joined #salt
06:40 rickflare joined #salt
06:40 coredumb joined #salt
06:40 euidzero joined #salt
06:41 benbro joined #salt
06:42 lastmikoi joined #salt
06:42 coldbrewedbrew_ joined #salt
06:43 Sketch joined #salt
06:43 tehsu joined #salt
06:47 JohnnyRun joined #salt
06:48 colegatron joined #salt
06:57 rojem joined #salt
07:04 c06 i think documentation need to be updated for watch and listen. cant able to find when and which one to use
07:04 aldevar joined #salt
07:05 palsveningson Hi guys
07:05 palsveningson I still have problems with the salt formula.
07:06 AvengerMoJo joined #salt
07:06 Ricardo1000 joined #salt
07:06 palsveningson I am trying to run salt formula, but when I try to state.apply salt.minion I get this traceback:
07:07 palsveningson https://gist.github.com/anonymous/5d5e7b42d18ab2a8f4b61625f21d9ddf
07:07 palsveningson Could someone please help me out
07:09 c06 palsveningson: plz check the output which returns. its expecting string
07:12 xet7 joined #salt
07:14 palsveningson Yeah, but from where?
07:14 palsveningson I have included the formula in my state and provided data in the pillars.
07:15 c06 i am not expert but my suggestion is run in command line and check for desired output from pillar
07:15 c06 pkgrepo ---
07:16 palsveningson run which command?
07:16 palsveningson I mean the pillar information is there
07:21 ronnix joined #salt
07:22 c06 i am not sure but can u check you are appending(+) only strings
07:24 c06 becoz  - osrelease  will be in float
07:25 c06 also if you worked on watch and listen give some suggestions
07:26 beardedeagle joined #salt
07:33 Rumbles joined #salt
07:35 guerby joined #salt
07:39 APLU joined #salt
07:40 hemebond c06: https://docs.saltstack.com/en/latest/ref/states/requisites.html#listen-listen-in
07:40 hemebond That explains the differences between listen and watch.
07:40 hemebond They're mostly the same but all listen states are run at the end of a state run.
07:41 c06 hemebond: when the configuration file changes it will restart the service. order state - watch ; at the end - listen, correct me if i am wrong
07:41 pbandark joined #salt
07:41 hemebond If I understand your sentence correctly, I think you are correct.
07:41 impi joined #salt
07:42 benbro1 joined #salt
07:42 c06 hemebond: ty dude. if you are free means help palsveningson
07:43 hemebond I looked at what palsveningson but I can't figure out what it's doing or where that template came from.
07:44 c06 hemebond: oh ok. ty dude..
07:44 Ricardo1000 joined #salt
07:48 _KaszpiR_ joined #salt
07:48 do3meli joined #salt
07:48 do3meli left #salt
07:58 aleph- joined #salt
08:13 Toledo joined #salt
08:14 Toledo left #salt
08:14 croberts joined #salt
08:28 do3meli joined #salt
08:28 do3meli left #salt
08:42 benbro joined #salt
08:44 Yoda-BZH joined #salt
08:44 Yoda-BZH joined #salt
08:46 ronnix joined #salt
08:52 ronnix joined #salt
08:55 croberts left #salt
09:01 kevc joined #salt
09:06 Naresh joined #salt
09:07 ProT-0-TypE joined #salt
09:35 arount joined #salt
09:36 arount hi there, is there any core team member that could explaine me what is functionnaly expected with 'top_file_merging_strategy' (cf https://docs.saltstack.com/en/latest/ref/configuration/master.html#std:conf_master-top_file_merging_strategy) ? More I read the doc, less I understand
09:39 hemebond arount: I'm not with Saltstack but what do you not understand? Do you understand how Saltstack merges top files by default?
09:39 babilen arount: Most core team members are still sleeping
09:39 cpc_ joined #salt
09:40 arount hemebond: i'm fixing it, but i just don't understand what each value does .. the doc is hard to understand
09:40 arount babilen: ok, thx, I will start to clean file and wait for us
09:41 hemebond arount: Your top.sls files can contain references to multiple environments.
09:41 lorengordon iggy: probably wasn't a request for it, or wasn't in the devs use cases. but, filters are super easy to write and now are super easy to add (use the @jinja_filter decorator).....
09:41 arount hemebond: are you speaking about this https://github.com/saltstack/salt/issues/42165 ?
09:42 benbro1 joined #salt
09:42 babilen arount: You might want to try simply asking the people that are awake right now :)
09:42 arount hemebond: i know how it works, i read the code, i'm updating it, just, the doc say lot of things, but first, it really does not fit with reallity, moreover when I read the doc I just understand 'blablablah, merge, blablah, same'
09:42 arount ..
09:42 babilen What are you trying to achieve?
09:42 hemebond arount: top_file_merging_strategy doesn't affect the order of the merging, only what is merged.
09:43 hemebond Lemme throw up an example top.sls
09:43 arount babilen: https://github.com/saltstack/salt/issues/42165 fix that (order of envs change if you change the env name)
09:44 lorengordon whytewolf: i think they added a few new functions, but mostly picked a handful of existing utils functions (which you can't otherwise call via jinja), and the dev adding them was big into config mgmt for network devices
09:44 arount hmm, guys, I understand how it works, I just seen doc and code does not fit + both config (same/merge) does EXACTLY the same thing
09:44 arount so .. I just want to fix it
09:44 hemebond But...
09:45 arount but, by reading doc, i can't figure what behavior we expect to have
09:45 hemebond Your bug is talking about merge order.
09:45 hemebond Not about merging strategy.
09:45 arount ok, so, if this is a env_order issue, I note, thx.
09:45 arount but, anyway, now I seen the bug, I can not unseen it
09:46 arount and top_file_merging_strategy do not change behavior of `salt.state.get_tops`
09:46 arount i would like to fix it
09:46 hemebond What is "get_tops"?
09:47 arount jesusaur: https://github.com/saltstack/salt/blob/develop/salt/state.py#L2730
09:47 arount oops ^^
09:47 arount hemebond: https://github.com/saltstack/salt/blob/develop/salt/state.py#L2730
09:47 robinsmidsrod joined #salt
09:47 hemebond It doesn't affect the behaviour?
09:47 arount nop
09:48 hemebond It seems to check 'top_file_merging_strategy'
09:48 arount check it, reading code gives you the answer, adding lot of logs + try it gives you proof
09:48 hemebond Can you explain to me, in your own words, what "same" does for 'top_file_merging_strategy'?
09:49 robinsmidsrod joined #salt
09:49 arount erf, could you just read function ?
09:49 arount because .. here is the reality
09:49 hemebond I'm not talking about the function.
09:49 hemebond I'm still unsure what your understanding is of 'top_file_merging_strategy'
09:50 arount I think too, but anyway if two values are available for a config field, both sould not perform the exact same thing no ?
09:50 arount that's why I'm asking what top_file_merging_strategy should do
09:50 arount because when I read this: https://docs.saltstack.com/en/latest/ref/configuration/master.html#std:conf_master-top_file_merging_strategy i don't understand
09:50 arount so, my question is: "What 'same' should do, what 'merge' should do, what 'merge_all' should do ?"
09:51 arount like it, i'm able to implement it
09:51 hemebond Okay
09:51 hemebond https://paste.debian.net/975298/
09:51 arount yep
09:51 hemebond That top.sls is in the 'base' environment file_root.
09:51 arount yep
09:51 hemebond But it contains a reference to both the 'base' and the 'test' environments.
09:52 hemebond It will apply "foo" from the "base" environment and "bar" from the "test" environment.
09:52 hemebond That is what "merge" does.
09:52 hemebond Anyone please jump in if I'm wrong.
09:52 arount but .. i understand that ^^
09:52 hemebond I don't change these settings or the default behaviour so I might be thinking of something else.
09:52 hemebond Okay, so "same" changes that behaviour.
09:53 arount ok, tell me
09:53 hemebond With "same", only "foo" will be applied.
09:53 arount ok, so, first bug, this is not what i seen
09:53 arount (i have to check to be sure, but hmm, i'm pretty sure)
09:53 hemebond Can you paste your top.sls file somewhere?
09:53 arount https://github.com/saltstack/salt/issues/42165
09:54 babilen Isn't this about top files in different environments?
09:54 arount yes
09:54 hemebond That top file only has _one_ reference.
09:54 arount yep
09:54 hemebond So changing to "same" will change nothing.
09:55 lorengordon joined #salt
09:55 arount so, let me try this:
09:55 robinsmidsrod joined #salt
09:55 babilen So, merge merges them (surprise!) which essentially means that you want a single top file for all environments or multiple one with sections for only a single environment
09:55 babilen So if you have "same" salt would no longer merge files (causing duplication), but only looks at one top file (i.e. the one the minion is in)
09:55 arount top_file_merging_strategy only defined 'merge strat' for a single 'top.sls' file ? It does not manage several environments merging strategy ?
09:56 hemebond babilen: I thought "same" only used the environment references that the top.sls was sitting in but still merged them all.
09:58 babilen It looks at the "dev:" bit in dev/top.sls and the "prod:" bit in prod/top.sls
09:58 arount but, I am the only that think it's strange that 'merge' & 'same' doesn really not change `state.get_tops` returned value ?
09:58 hemebond Yip. Does it still apply all the top files?
09:58 babilen So the resulting *global* top.sls has the sections from each respective top file
09:58 hemebond That's what I thought.
09:58 arount (arf, my english, i'm so tired, i will try to make better sentence sry :/)
09:59 babilen I'm not too familiar with get_tops and what to expect of it, sorry
09:59 arount ok
10:00 arount I will wait for pple from core team
10:01 hemebond Reading through the function, it doesn't seem like it _should_ care about merging strategy.
10:02 hemebond I mean, it's just getting the list of top files.
10:02 hemebond arount: What are you expecting get_tops to do?
10:03 zulutango joined #salt
10:03 arount computing top files list
10:03 arount top files *to handle*
10:03 hemebond "Gather the top files"
10:03 hemebond That's all it does ^
10:03 hemebond So merging strategy has nothing to do with this function.
10:04 arount hemebond: well, I will try to explain my way of thinking: I see a config filed name "top_file_merging_strategy", this config should handle several possible values
10:04 arount ok
10:04 hemebond Except when you're using "same" and you have specified an environment to exclusively apply.
10:04 arount so, because I can't understand doc, I do "grep 'top_file_merging_strategy' ./salt/ -R"
10:04 arount and see only one file handle this: ./state.py
10:04 arount so, I open this file, and check what is going on
10:05 arount While doing this I seen only `get_tops` play with this value, ok ?
10:05 arount But, by reading (and playing with) function I seen updating this config field DOES NOT CHANGE ANYTHING
10:05 arount so, two solutions: Bug, or useless config field
10:06 arount .. that is all
10:06 hemebond Okay, but it does change things.
10:06 arount what ?
10:06 arount i only add a warning line in logs ^^
10:06 arount it*
10:06 hemebond What are you expecting to see?
10:06 arount something, anything
10:06 arount i'm trying to understand
10:06 hemebond Your top file will show no difference with "merge" or "same".
10:07 hemebond merge https://github.com/saltstack/salt/blob/develop/salt/state.py#L2872 , same https://github.com/saltstack/salt/blob/develop/salt/state.py#L2923
10:07 hemebond Different functions/behaviours.
10:08 arount hoo i like it, let me check
10:09 hemebond https://paste.debian.net/hidden/9fee701a/
10:10 hemebond In that example, with "merge" you will end up with a, b, c and d.
10:10 hemebond With "same" you should end up with a and d only.
10:10 Praematura joined #salt
10:11 arount arf, sry guys I have to leave for ~1h, thx hemebond to succeed to handle me when I'm rumbling about a thing I don't understand
10:11 arount see ya
10:11 hemebond cya
10:14 babilen Still not sure what arount was trying to do
10:17 benbro1 left #salt
10:26 hojgaard joined #salt
10:42 c06 joined #salt
10:50 rahav joined #salt
10:58 fredvd joined #salt
11:02 Ricardo1000 joined #salt
11:14 hemebond Just try to understand merging strategy I think.
11:31 cpc__ joined #salt
11:48 cpc_ joined #salt
11:49 c06 hemebond: you have any experience in calling ruby code in salt or will it works {% set data = ruby_scripts(params) %}
11:57 evle1 joined #salt
12:00 hemebond c06: I hate Ruby and I have no idea if it's possible to call Ruby from Jinja :-)
12:00 hemebond You might be able to use an execution module to run a Ruby script.
12:01 c06 hemebond: hahaha
12:01 hemebond I've never called scripts from Jinja but I've seen people do it.
12:01 babilen One huge reason for salt and not puppet!
12:01 hemebond ^ yes
12:01 c06 i thought to go with cmd.run but its returning some output values
12:06 babilen c06: My general approach for minion specific/local information is to write a custom grain to make it available in SLS files
12:06 babilen Tend to shy away from too much local state, but custom grains are great for "introspection"
12:06 babilen cmd.run might work with some data munging though?
12:07 babilen (not that jinja is great at that)
12:08 major joined #salt
12:09 c06 babilen: i am not retrieving minion related information i have to call some external ruby scripts to do some functionality and it will return values based on that i will configure my minion
12:09 c06 so i got stuck over here
12:17 hemebond Nasty. You're getting into the realm of scripted installs now.
12:17 yuhlw joined #salt
12:18 thinkt4nk joined #salt
12:19 capnhex joined #salt
12:19 Guest30736 joined #salt
12:20 arif-ali joined #salt
12:20 c06 hemebond: oops
12:22 hemebond (that was a soft "nasty", more of an "ew")
12:22 hemebond Saltstack is about enforcing state on a machine/system.
12:22 hemebond So rather than so this then this if this or this.
12:22 hemebond It's more "make sure it looks like this"
12:23 c06 heheheh i am in cloudnine
12:23 c06 nothing understood
12:28 c06 ok all thanks for the day and help
12:28 c06 moving out have a nice say.. :)
12:31 capnhex Hi
12:31 capnhex I've got a set of windows servers I'm managing with salt along with a large number of linux devices. However whenever I try and apply the state.highstate to both devices,one of them works as expected wheras the other returns 'No states found for this minion'
12:31 capnhex - The top.sls for both devices is the same, and both should be running the same 2 tasks
12:31 capnhex Has anyone seen this before and if so what is the usual reason for this sort of message?
12:32 saintpablos joined #salt
12:35 swills joined #salt
12:35 Nei joined #salt
12:37 ssplatt joined #salt
12:39 nicksloan joined #salt
12:57 drawsmcgraw joined #salt
13:12 Rumbles joined #salt
13:14 Nei left #salt
13:14 Tucky joined #salt
13:23 cgiroua joined #salt
13:25 sjorge joined #salt
13:37 capnhex joined #salt
13:38 racooper joined #salt
13:40 sjorge joined #salt
13:43 _KaszpiR_ joined #salt
13:49 _JZ_ joined #salt
13:52 deuscapturus joined #salt
14:07 nicksloan joined #salt
14:17 nicksloan joined #salt
14:27 sjorge joined #salt
14:29 nicksloan joined #salt
14:29 drawsmcgraw joined #salt
14:32 drawsmcgraw left #salt
14:33 eichiro joined #salt
14:34 deuscapturus joined #salt
14:40 Brew joined #salt
14:42 PatrolDoom joined #salt
14:44 capnhex joined #salt
14:49 capnhex1 joined #salt
14:51 dyasny joined #salt
14:53 sjorge joined #salt
14:54 JohnnyRun joined #salt
15:00 sarcasticadmin joined #salt
15:03 GMAzrael_ joined #salt
15:06 GMAzrael joined #salt
15:11 nicksloan joined #salt
15:15 GMAzrael joined #salt
15:15 GMAzrael joined #salt
15:25 woodtablet joined #salt
15:25 Rumbles argh, someone has renamed a host on my salt, but the grain['fqdn'] hasn't changed
15:25 Rumbles I tried saultutil.refresh_grains but it doesn't change
15:26 Rumbles can anyone advise how to get it to match the hostname/minion_id ?
15:27 astronouth7303 Rumbles: how did they rename the machine? Linux has a few different places the hostname is stored, with different semantics
15:27 Rumbles think he changed the /etc/hostname file and restarted the hostname service
15:27 astronouth7303 so the kernel's hostname does match the one on the filesystem
15:28 Rumbles afaik yes
15:29 jdipierro joined #salt
15:29 censorshipwreck joined #salt
15:31 nicksloan joined #salt
15:31 whytewolf the minion_id also changed? so they rekeyed the minion?
15:32 astronouth7303 can i pass arguments to orchestrate? Or is there something similar that i can pass arguments to?
15:32 whytewolf astronouth7303: pillar.
15:32 Rumbles yes the minon_id changed and it was re-keyed
15:32 astronouth7303 whytewolf: you end up with a chicken/egg problem
15:33 astronouth7303 i've set it up so that CI can only call orchestration scripts, but i'd then need a way for it to set pillar information
15:33 whytewolf um, no
15:34 whytewolf salt-run state.orch orch-state pillar={'item':'test'}
15:34 astronouth7303 oh ok
15:34 whytewolf [not 100% sure that is right for the pillar argument, but that is the idea behind it]
15:35 g^k_1^w^m_s^u joined #salt
15:36 g^k_1^w^m_s^u left #salt
15:36 aldevar left #salt
15:36 astronouth7303 and it's on the master, so there's no other pillar data mixing with it.
15:36 astronouth7303 ok, i think i get it.
15:37 whytewolf exactly
15:37 astronouth7303 also, welcome back whytewolf. Did you have a good day off irc?
15:37 whytewolf day off? I was vomiting. but thank you. how did you know i had the day off?
15:38 astronouth7303 you didn't answer any questions and were completely scarce
15:38 whytewolf ahh, good reason to know i was gone :P
15:38 astronouth7303 it was weird, and the number of questions answered dropped dramatically
15:39 astronouth7303 i had to resort to filing github issues
15:39 astronouth7303 :P
15:39 whytewolf lol
15:39 astronouth7303 (it was only one question that was answered with a more helpful version of "read the docs more carefully")
15:41 g^k_1^w^m_s^u joined #salt
15:41 astronouth7303 but the defaults of archive.extracted does make me shake my head a bit
15:42 sjorge joined #salt
15:42 whytewolf I've never used it so can't really relate.
15:42 astronouth7303 oh, btw, whytewolf, since you mentioned it before: salt:// counts as remote, and to get archive.extracted to be useful, you have to have hashes and you have to set `source_hash_update`
15:43 astronouth7303 and afaict, you can't just tell saltfs "just take care of it"
15:43 Praematura joined #salt
15:43 whytewolf that stinks. i know saltfs does work that way for file.*
15:44 whytewolf so you don't need the source_hash stuff
15:44 astronouth7303 that would be nice...
15:45 sp0097 joined #salt
15:46 sp0097 joined #salt
15:51 ChubYann joined #salt
15:51 astronouth7303 hm. how do i get orchestrate to run a command on the master?
15:55 whytewolf a runner?
15:55 whytewolf or do you have a minion on the master?
15:55 astronouth7303 no
15:55 whytewolf [you should, but that is niehter here or there]
15:55 astronouth7303 i just need to `sha1sum` the contents of `/srv/salt`
15:56 astronouth7303 it just seems like a good way to accidentally brick yourself?
15:56 whytewolf oh ... then you defintly need a minion on the master. a runner isn't going to do that.
15:56 astronouth7303 oh! There is a runner for that
15:56 astronouth7303 salt.cmd
15:57 astronouth7303 as opposed to the executor cmd.run -_-
15:57 whytewolf ugh. salt.cmd should be shot in the head
15:57 astronouth7303 oh, i see
15:57 whytewolf you are in for some fun. getting the multiple levels of getting that to work
15:57 astronouth7303 salt.cmd cmd.run sha1sum
15:58 jdipierro Will that work without a minion? It invokes an execution module which runs.. on a minion.
15:59 whytewolf jdipierro: actually it runs the exacution module in the master context
16:00 jdipierro .. woah.. mind = blown
16:00 whytewolf IF it exists on the master ....
16:01 whytewolf but imaging trying to come to turms with orchestration -> salt.cmd -> cmd.run
16:01 astronouth7303 thankfully, i think salt.runner and salt.cmd both just pass *pargs and **kwargs
16:02 * whytewolf waits.
16:04 fatal_exception joined #salt
16:04 fatal_exception joined #salt
16:04 whytewolf anyway asfor salting the master. it is common practice.
16:06 fatal_exception joined #salt
16:06 jdipierro I don't think I've ever heard of that causing any issues.
16:07 astronouth7303 interesting, `TypeError: cmd() takes at least 1 argument (0 given)` https://www.irccloud.com/pastebin/uAyimWCi/
16:07 fatal_exception joined #salt
16:07 whytewolf astronouth7303: welcome to salt.cmd
16:07 jdipierro I can't imagine a way for it to unless you've got /srv/salt under git.managed state
16:08 astronouth7303 jdipierro: for the record, i'm using gitfs for most of my saltfs, but i'm adding a file_root because i need to transfer some build artifacts to minions
16:08 tiwula joined #salt
16:08 whytewolf jdipierro: i have heard rumor that the suse salt-master thing they sell doesn't like a minion on the master and will nuke. /srv/salt if a minion is installed. but that is suse.
16:09 whytewolf but i have salted all of my masters since i first began
16:09 cyteen joined #salt
16:09 whytewolf and never had issue
16:09 whytewolf it just opens a world of possabilities.
16:11 astronouth7303 i guess i'll just do the hashing on the CI side...
16:12 onlyanegg joined #salt
16:20 _1_w_m__s_u__g_k joined #salt
16:29 eichiro joined #salt
16:38 cyteen joined #salt
16:54 MTecknology the master is the first thing I ever stuck a minion on
16:54 Trauma joined #salt
16:55 JohnnyRun joined #salt
16:56 astronouth7303 i think the real reason is that the master is on one of our traditionally managed physical hosts, and I don't trust myself yet to retroactively add a salt minion to it without breaking the master, gitlab, or gitlab ci
16:57 nicksloan joined #salt
16:57 jdipierro joined #salt
16:58 MTecknology astronouth7303: When rolling out salt, I always recommend 1) build a replacement box using salt 2) destroy it 3) make sure salt re-creates it correctly 4) replace the old
16:58 astronouth7303 i may do that at some point, but seeing as this is an actual box in an actual rack, it's not that simple
16:59 astronouth7303 and while it's not serving customers, it is critical to development
16:59 MTecknology You don't have virtualization available?
16:59 MTecknology virtualization allows you to test things...
16:59 astronouth7303 we do. i'm using salt to manage _that_
16:59 astronouth7303 but this host isn't on that.
16:59 MTecknology I'm not sure how that matters
17:00 astronouth7303 we have a mix of vm hosts and traditional servers
17:00 astronouth7303 we were previously managing everything manually.
17:00 astronouth7303 i'm using salt to manage this new project i'm deploying against the vm fabric
17:01 MTecknology I still don't get how that matters to what I said, but now I've entirely lost interest. I'm gonna go shave and brush my tooths.
17:01 astronouth7303 what's the nodename grain?
17:02 lordcirth_work astronouth7303, you mean minion id? 'id'
17:02 astronouth7303 no
17:02 astronouth7303 grains['nodename']
17:02 astronouth7303 it looks similar to host, but isn't changed with host
17:06 whytewolf nodename is uname -n
17:06 whytewolf [part of the kernel information]
17:06 astronouth7303 no, it's not
17:06 astronouth7303 or, it's extremely cached
17:06 whytewolf https://github.com/saltstack/salt/blob/862b2b37cf97fc3b4228bcf8f96d7ed3865bc59a/salt/grains/core.py#L1265-L1266
17:06 whytewolf yes, it is
17:07 _JZ_ joined #salt
17:08 astronouth7303 https://www.irccloud.com/pastebin/E2YxFzTI/
17:09 whytewolf have you refreshed grains?
17:09 astronouth7303 i'm pretty sure. the host grain is right?
17:10 whytewolf cause what i posted was how that field is filled in. which is the nodename field of uname.
17:10 astronouth7303 and saltutil.sync_all (on the minion) would do that, wouldn't it?
17:11 whytewolf it should yes.
17:12 astronouth7303 i know i've run that a load of times, and i started using your update orch
17:13 astronouth7303 and that minion has been running a while
17:13 jdipierro Perhaps try restarting the minion too? I recall having issues getting grains to refresh in the past
17:13 astronouth7303 i'm not using it, i just noticed it and trying to understand what's going
17:13 astronouth7303 i guess it's aggressively cached
17:14 whytewolf it is possable that platform.uname is still returning the old data.
17:14 gmoro_ joined #salt
17:15 * astronouth7303 reboots the minion
17:17 whytewolf if that isn't working run this python -c 'import platform; print platform.uname()' and see what the info returned for node is [node is the second item in the tuple]
17:17 pocketprotector- joined #salt
17:17 astronouth7303 yeah, rebooting fixed it
17:17 astronouth7303 i guess the minion caches it and doesn't expire?
17:17 astronouth7303 which is probably fine for everything else in the struct
17:18 whytewolf it might not have been the minion caching it. like i said it is possable that platform was returning the old info.
17:18 whytewolf platform is a part of python not salt.
17:20 astronouth7303 oh yeah. which caches it without expiring.
17:20 major_ joined #salt
17:20 astronouth7303 https://github.com/python/cpython/blob/3.6/Lib/platform.py#L905
17:21 astronouth7303 one mystery solved.
17:21 MTecknology woo! No moar deprecation notices!
17:21 whytewolf yay!
17:22 whytewolf until the next release when EVERYTHING is deprecated. [just kidding]
17:22 MTecknology I should be back to one logcheck email per night (the one where openvpn reconnects 2-7x/day because it's running across a verizon mifi device)
17:24 astronouth7303 and i think as soon as i figure out https://github.com/saltstack/salt/issues/42145 i'll be in automation heaven
17:26 nixjdm joined #salt
17:28 jmiven joined #salt
17:31 sjorge joined #salt
17:32 preludedrew joined #salt
17:33 lordcirth_work astronouth7303, a gist would probably have been better than a file upload
17:36 lordcirth_work That's a strange issue though
17:37 astronouth7303 i'm pretty sure any instance where the minion ends up in a place that contradicts the state is a bug
17:38 lordcirth_work astronouth7303, yes of course; the question is where the bug is
17:38 lordcirth_work astronouth7303, can you try using a newer minion?
17:39 astronouth7303 how do i get salt-cloud to use a newer minion?
17:39 astronouth7303 the instances are created by salt-cloud being called on the master; i'm not sure why they end up on different versions
17:39 whytewolf newer? it isn't already using latest stable?
17:40 astronouth7303 do the minion and master versions not always match?
17:40 whytewolf astronouth7303: salt-cloud by default uses https://docs.saltstack.com/en/latest/topics/tutorials/salt_bootstrap.html to deploy salt.
17:41 whytewolf which installest latest version by default
17:41 lordcirth_work His master is 2016.11.5 and minion 2016.11.2.  It should be ok but it should be tried
17:42 JohnnyRun joined #salt
17:42 * astronouth7303 spins up a minion just to check
17:44 astronouth7303 yup, brand new minion, made through the cloud wheel, comes up with salt 2016.11.2
17:47 whytewolf oh wait you have that funky image so might have disbaled the salt bootstrap script. does your "image" have 2011.16.2 on it?
17:47 astronouth7303 i didn't include salt on it
17:47 astronouth7303 it's being bootstrapped by salt-cloud, which was installed with apt on the master
17:48 whytewolf okay. then maybe update the bootstrap script
17:48 whytewolf or check if you locked the version in your settings
17:49 nicksloan joined #salt
17:50 astronouth7303 i haven't pinned a version or set a bootstrap script in /etc/salt/cloud
17:51 whytewolf then update your bootstrap script
17:51 astronouth7303 my debian package salt-cloud is at 2016.11.5+ds-1
17:51 whytewolf ...
17:51 whytewolf not what i said
17:51 whytewolf the bootstrap script is indapendently updateable
17:52 whytewolf typically with salt-cloud -U
17:52 astronouth7303 ...
17:53 whytewolf sorry lowercase u not upper case
17:53 astronouth7303 yeah, i noticed that
17:54 astronouth7303 i'm just silently facepalming because nothing even implied that the bootstrap script wasn't part of the distribution packages or that you need to update it manually in an entirely separate process
17:54 bit_lySLH2uSZHed joined #salt
17:55 whytewolf it comes with the distrodution packages. but it is a version that comes at the time of release
17:55 astronouth7303 i just asked apt-file. it's not part of the .deb
17:56 whytewolf and yes. oh right. forgot it downloads it the first time it is run
17:56 whytewolf https://docs.saltstack.com/en/latest/topics/cloud/deploy.html#updating-salt-bootstrap
17:56 bit_lySLH2uSZHed left #salt
17:56 whytewolf and yes it is documented
17:59 JohnnRun joined #salt
18:00 whytewolf it is also possable that this isn't the update scripts fault. if your image had already installed a saltstack repo the bootstrap script will just use it i don't think it updates it
18:00 whytewolf if you pinned to a minor release
18:00 astronouth7303 i tried to keep it as close to vanilla debian as possible. I don't believe I added any salt stuff to it.
18:02 whytewolf if you check your debian repos can you find the one used for salt?
18:04 ssplatt joined #salt
18:04 * astronouth7303 spins up a machine manually
18:04 whytewolf well i meant on one that ends up getting 2016.11.2
18:04 whytewolf see if it is pinned
18:06 astronouth7303 yeah, i'm in a machine before salt-bootstrap touches it.
18:07 astronouth7303 I did _not_ add saltstack's repos to it, but debian stretch does include salt-minion, at 2016.11.2+ds-1
18:07 whytewolf really? ugh.
18:08 whytewolf looks like we are going to have a repeat of an issue that came up in ubuntu
18:08 astronouth7303 to be fair, that's the official instructions: https://docs.saltstack.com/en/latest/topics/installation/debian.html
18:08 astronouth7303 (just not updated for the release of stretch as stable)
18:09 whytewolf oh missed that you said stretch
18:10 astronouth7303 stretch was promoted to stable on june 17
18:10 whytewolf looks like stretch is supported in repo.saltstack.com now. i would recomend switching asap before more seperation occourse
18:10 whytewolf https://repo.saltstack.com/#debian
18:11 dyasny joined #salt
18:12 whytewolf i don't know if the bootstrap script supports stretch yet though :(
18:12 whytewolf this always happens, bootstrap always laggs behind the repo
18:13 astronouth7303 seems to? that's what i based my image on
18:13 astronouth7303 (oh, i miss aws...)
18:13 whytewolf oh, latest bootstrap does say it supports debian 9
18:13 whytewolf so updating should fix it
18:14 whytewolf Debian GNU/Linux 7/8/9
18:14 onlyanegg joined #salt
18:14 whytewolf from https://github.com/saltstack/salt-bootstrap
18:15 cliluw joined #salt
18:17 nicksloan joined #salt
18:17 astronouth7303 (TODO: Write a packer script to generate this image)
18:30 bit_lySLH2uSZHed joined #salt
18:31 rookie joined #salt
18:32 metarookie joined #salt
18:34 astronouth7303 ok, yeah, that got it updated
18:34 bit_lySLH2uSZHed joined #salt
18:35 bit_lySLH2uSZHed left #salt
18:37 astronouth7303 and same results with regards to network.system
18:38 druonysuse joined #salt
18:42 nixjdm joined #salt
18:43 PatrolDoom joined #salt
18:46 bit_lySLH2uSZHed joined #salt
18:53 tapoxi this is valid jinja, right? {% if 'prod' or 'demo' in grains['role'] %}
18:53 pbandark1 joined #salt
18:55 whytewolf valid. kind of. but it probley doesn't do what you think it does
18:55 nicksloan joined #salt
18:56 whytewolf another way to say that would be if (true) or ('demo' in grains['role']))
18:56 jdipierro HIghly recommend using this to test out jinja: https://github.com/qn7o/jinja2-live-parser
18:57 whytewolf eh, that won't include salt jinja additions.
18:58 tapoxi whytewolf: if (true)? what would the true be?
18:58 whytewolf I just use https://github.com/whytewolf/salt-debug
18:58 jdipierro tapoxi "prod" evaluates to true in your expression. Jinja uses python's logic testing.
18:58 whytewolf tapoxi: basicly prod. which is a string that is not a Nonetype
18:59 tapoxi whytewolf: hahaha, I've actually seen your debug tool while googling around for this, but unfortunately I have to run in prod and you have a nice fat warning :)
19:00 whytewolf that warning is just a cover my ass kind of thing.
19:00 tapoxi when I run salt-call -l debug I see it renders the block underneath
19:01 tapoxi but it shouldn't evaluate to true because it doesn't have 'prod' or 'demo' in its role grain
19:01 whytewolf tapoxi: but that isn't what your jinja is saying
19:01 jdipierro The first part of your test doesn't check if "prod" is in the grain
19:01 jdipierro It checks if "prod" is true. which it is
19:02 astronouth7303 `('prod') or ('demo' in grains['role'])`
19:02 whytewolf your asking is the string prod set. or is demo in grains['roles']
19:02 tapoxi ahh so if prod in grains['role'] or if demo in grains['role']
19:02 jdipierro you got it
19:02 bit_lySLH2uSZHed joined #salt
19:02 tapoxi I was wondering why it wouldn't just throw an exception at that, thanks!
19:03 bit_lySLH2uSZHed left #salt
19:03 whytewolf yeah the jinja was totaly functional and valid. it just didn't do what you think
19:04 onlyanegg you could flip it around tho - {% if grains.role in ['prod', 'demo'] %}
19:04 onlyanegg i think
19:04 jdipierro grains['role'] is most likely a list
19:04 astronouth7303 onlyanegg: it's python? You can't list in list
19:05 whytewolf depends on if grains.rol... everyone else already covered it
19:05 astronouth7303 (jinja occasionally breaks from python in ways that always surprise me)
19:05 whytewolf howwever. there is a handy filter coming in the next major release for this
19:05 sjorge joined #salt
19:06 whytewolf or i thought there was
19:07 tapoxi so I need two ifs, or does the if apply to both statements?
19:07 whytewolf https://docs.saltstack.com/en/develop/topics/jinja/index.html#check-whitelist-blacklist
19:08 tapoxi e.g. if 'prod' in grains['role'] or 'demo' in grains['role'] vs if 'prod' in grains['role'] or if 'demo' in grains['role']
19:08 jdipierro If it's in the same {% ... %} block you only need the 1
19:08 tapoxi got it
19:08 tapoxi ty
19:08 whytewolf tapoxi: {% if (statement 1) or (statment 2) %}
19:09 onlyanegg jdipierro, astronouth7303, right - grains['role'] sounds like it's a list - my mistake
19:11 iggy lorengordon: are they easy to add? I mean a decorator is one thing... distributing said files is another problem completely
19:12 lorengordon heh, easy to add to saltstack/salt, yes
19:12 Renich joined #salt
19:13 lorengordon if _utils modules can be distributed via the dynamic module feature, then that works also
19:13 lorengordon looks like it should work... https://docs.saltstack.com/en/latest/ref/file_server/dynamic-modules.html
19:14 lorengordon (while i did add the decorator, i didn't test it with dynamic utils modules, so don't beat me up just yet if that doesn't work)
19:15 lorengordon and the decorator is still in develop...
19:20 fatal_exception joined #salt
19:20 sjorge joined #salt
19:22 bit_lySLH2uSZHed joined #salt
19:26 jdipierro joined #salt
19:32 oida joined #salt
19:34 iggy I'll try it
19:34 noraatepernos joined #salt
19:42 nixjdm joined #salt
19:47 onlyanegg joined #salt
19:50 sjorge joined #salt
19:55 Brew joined #salt
20:01 nicksloan joined #salt
20:07 jdipierro joined #salt
20:07 sjorge joined #salt
20:09 nicksloan joined #salt
20:15 fatal_exception joined #salt
20:16 woodtablet hello
20:17 woodtablet so thanks to eugene, i know that there is a pillar option called ignore_missing, but i see it does not exist for state
20:19 woodtablet hmm.. talking to myself i might be able to figure it out.. hangon, having a rubber duck debug effect here
20:23 sjorge joined #salt
20:26 chupetito joined #salt
20:27 woodtablet so i am trying to include state files for minions if the file exists, but doesnt seem to be working as expected, can someone point me in the right direction ? i thought i followed the docs correctly for files.files_exisit
20:27 woodtablet https://gist.github.com/gwaters/561e18f5579ce7cf8522f3a4110c3dec
20:27 lorengordon joined #salt
20:27 whytewolf file.file_exists is for if the file exists on the minion
20:29 astronouth7303 are you trying to f-string in that if statement? does jinja do that?
20:29 MajObviousman I think what I'm about to suggest is a bad idea, but it's a starting point for a discussion at least
20:29 MajObviousman I have to provision into a build VLAN (call it 44)
20:29 woodtablet whytewolf - ooohhh
20:29 deuscapturus joined #salt
20:30 woodtablet whytewolf - how would i do this on the master ??
20:30 whytewolf astronouth7303: no, he is useing a salt module that returns true/false depending on a files existence
20:30 astronouth7303 'hosts/{minion_id}.sls'
20:30 MajObviousman if I set a template VM to use DHCP, how will salt-cloud know what IP to reach?
20:30 astronouth7303 i don't think that'll do what you hope it does
20:30 whytewolf well the hole thing won't do anything
20:31 whytewolf woodtablet: you don't.
20:31 whytewolf top file iss rendered on the minion
20:32 astronouth7303 MajObviousman: I think salt-cloud asks the VM provider? That bit just works for me.
20:32 woodtablet whytewolf: and so are all the included state files i am assuming ?
20:32 MajObviousman hmm
20:32 whytewolf woodtablet: yes
20:32 * MajObviousman gives it a try
20:32 whytewolf woodtablet: everything dealing with states is rendered minion side.
20:33 whytewolf pillar is rendered master side
20:33 woodtablet whytewolf: ahh ok, thank you so much
20:33 whytewolf you coul if there are not to many files you want to do this for see if the file exists in cp.list_master
20:33 astronouth7303 MajObviousman: I'm not familiar with how VLANs are normally deployed or handled, though
20:33 MajObviousman yeah that's a separate struggle I'm still working through
20:34 whytewolf something like if 'files' in salt['cp.list_master']()
20:34 MajObviousman right now, I have a custom salt-deploy script that sets the correct IP and shuts the new VM down. A human comes along and changes the NIC to the proper VLAN, then boots it up
20:35 MajObviousman salt-minion starts at boot and picks up the startup_states to do provisioning
20:35 woodtablet whytewolf: i have maybe like 40-50 files in total for salt, is 100's too many ?
20:35 fatal_exception joined #salt
20:36 whytewolf woodtablet: i meant to do this kind of search on. between single minions.
20:36 whytewolf each call to cp.list_master is going to query the master for a new list of files
20:36 woodtablet woodtablet: ah gotcha
20:36 woodtablet i mean
20:37 woodtablet whytewolf: ah gotcha
20:42 nixjdm joined #salt
20:43 woodtablet whytewolf: like this ? it works, but i am a bit worried about the master performance
20:43 woodtablet whytewolf: https://gist.github.com/gwaters/561e18f5579ce7cf8522f3a4110c3dec
20:44 MajObviousman well F me, it just worked
20:44 MajObviousman like a hose
20:44 whytewolf huh, didn't know you could use {0} and .format in jinja
20:45 whytewolf woodtablet: that might actually be better cause then you can just compare against states if you want to check another file with out fetching a new version
20:46 Guest73 joined #salt
20:47 woodtablet whytewolf: ya, i might do more customizations other than just this one state change in the future for hosts
20:47 woodtablet whytewolf: thanks so much for getting me on track
20:48 MajObviousman astronouth7303: so I've no idea _WHY_ it works, but I won't look a gift horse in the mouht
20:48 woodtablet ls
20:48 woodtablet sorry wrong window
20:48 whytewolf . .. / omg secret_file.txt
20:49 woodtablet clickbait!
20:51 cyteen joined #salt
20:52 sjorge joined #salt
20:53 tobiasBora joined #salt
20:56 syrianinneed joined #salt
20:56 AndChat358400 joined #salt
21:11 kerrick joined #salt
21:14 kerrick I have this Salt rule: https://bpaste.net/show/3efbf4a736f7. It's a cmd.run with a Bash extended test as the "unless"
21:14 kerrick When I evaluate the test condition (I run [[ my_condition ]] && echo true || echo false on the host) it evaluates to true
21:14 kerrick however, the command is still getting run
21:15 kerrick I checked that salt-call grains.get shell returns local: /bin/bash
21:15 kerrick What would cause this?
21:15 kerrick Do bash extended test expressions not work as "unless" clauses
21:16 beardedeagle joined #salt
21:16 whytewolf no, they don't. it deosn't really run bash
21:17 kerrick Hmm, how does it work then?
21:17 kerrick does it do some sort of shell lexing on its own and then run execve?
21:18 kerrick How do "unless" clauses like `echo 'foo' > /tmp/.test && rm -f /tmp/.test` work?
21:18 kerrick Hmm, so salt.modules.cmdmod.retcode defaults to using /bin/sh
21:19 whytewolf yes
21:20 kerrick And cmd.run hardcodes the call to cmdmod.retcode without overriding shell: https://github.com/saltstack/salt/blob/develop/salt/states/cmd.py#L365
21:20 PerilousApricot joined #salt
21:20 kerrick why does it do this? :(
21:21 kerrick you would assume the same shell is used for "unless" as for the command itself
21:21 whytewolf ask the guy that wrote it
21:22 whytewolf wait, it does pass the rest of cmds kawargs to cmd.retcode
21:22 whytewolf thats what  **cmd_kwargs does
21:22 kerrick oh, you're right
21:22 kerrick hmm
21:23 kerrick oh, but I'm not passing shell here
21:23 kerrick I'm having it default to grains['shell']
21:23 kerrick cmd.run defaults to grains['shell'], retcode defaults to /bin/sh
21:23 kerrick sigh
21:23 kerrick but I can pass shell: /bin/bash to force it for both
21:24 whytewolf yes. or you could pass grains['shell'] to cmd.run and it should over ride cmd.retcode with the same shell as cmd.run
21:24 whytewolf and not have to worry about which is which
21:29 MajObviousman I wonder if this is a terrible idea: have the salt-deploy script change the VLAN of the VM through an API call
21:31 MajObviousman probably a lot better to just salt-run state.orchestrate the salt-cloud invocation followed by a state that calls into the vCenter API
21:31 jesusaur joined #salt
21:32 whytewolf I would think the vmware salt-cloud networking would have something about vlans. it si a pretty common thing for vmware. [not so much other clouds were it is auto handled]
21:33 MajObviousman it does, yes
21:33 MajObviousman but my challenge is that I have salt-cloud assemble the VM in the build VLAN, and after it's built it gets moved into the VLAN where it actually belongs
21:34 MajObviousman some of my environment is behind the wall, and the salt master can't ssh into it
21:34 MajObviousman not without a lot of red tape and interrogation
21:37 ChubYann joined #salt
21:37 whytewolf ahhh red tape
21:38 khaije1 joined #salt
21:38 nethershaw joined #salt
21:39 khaije1 is there a way to target a minion so as to say, do this on one of this collection of minions?
21:39 whytewolf you mean like using batch
21:40 khaije1 I think batch does a few at a time, but will ultimately do them all right/
21:40 whytewolf yeah
21:41 whytewolf i remeber there was a feature if not a request for a feature that would randomly selecting a server in a list of servers
21:41 whytewolf my brain is mush today though
21:42 khaije1 I should explain I'm thinking about how to orchestrate APIs using salt, and it might be nice to spead the load over a set of minions, but I would only want one to actually do the work.
21:42 nixjdm joined #salt
21:42 khaije1 Hah, a mushy brain is a healthy brain (I have mushy brain too, long week)
21:42 whytewolf yeah. that was what i thought about after that. right now i typically orchestrat the single part to a selected server.
21:43 whytewolf instead of a random server
21:43 khaije1 Yeah, probably easier with the match module and some jinja
21:44 khaije1 Which leads to my favorite problem with Salt: it makes everything too damn easy.
21:44 khaije1 I mean really!
21:45 whytewolf it is a wonderful problem to have
21:46 * khaije1 nods in agreement
21:47 onlyanegg in orchestrate I get a list of servers like this salt['minion.list']()['minions']
21:47 onlyanegg not sure how I would get a random one though...
21:48 khaije1 http://jinja.pocoo.org/docs/2.9/templates/#random
21:48 MajObviousman khaije1: you can use mine functions to report the status of a batch job
21:48 khaije1 MajObviousman: How's that work?
21:49 MajObviousman https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.mine.html#module-salt.modules.mine
21:49 astronouth7303 i'm really happy: I finally got the ember+django application fully deployed
21:50 MajObviousman whatever state file is your job, stick a mine.get at the top. If you find something, skip the rest. If you don't, do the job and at the end send the mine value
21:50 MajObviousman so minions that are batched later will see that the job is already done and skip doing it a second time
21:51 khaije1 Whoa... really?
21:51 MajObviousman https://docs.saltstack.com/en/latest/topics/mine/
21:51 MajObviousman you can do a lot
21:51 whytewolf only thing i would be worried about is a race conidtion
21:51 sjorge joined #salt
21:52 MajObviousman yes, that'd require some handling
21:52 khaije1 Could you explain a bit more of how that works ... does it use https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.mine.html#salt.modules.mine.send then check for the value before processing on future iterations?
21:52 khaije1 I have a feeling I'm not envisioning it correctly...
21:52 MajObviousman the send goes at the end of your job
21:52 khaije1 ok
21:53 MajObviousman imagine you have targetted five minions for the same state to run, but you set it to batch for only one
21:54 MajObviousman so one of those five will start the job. At the top of the state, it does a mine.get for all the minions in the job looking for some marker
21:54 MajObviousman the first minion to run will not find a marker
21:54 MajObviousman since it did not find the marker, it will do the rest of the state
21:54 MajObviousman and at the very end of the state, it will set the marker
21:54 MajObviousman the next minion to run will do a mine.get looking for the marker, find it, and do nothing else
21:55 MajObviousman as whytewolf aluded to, there could be a race condition if the second minion to run the job does its mine.get before the first minion's mine.send has completed
21:55 MajObviousman so you might add say 10 seconds of do nothing before the mine.get
21:56 MajObviousman just to make sure everything is copacetic
21:56 MajObviousman in effect, the salt mine marker forms a semaphore (https://en.wikipedia.org/wiki/Semaphore_%28programming%29)
21:57 MajObviousman so let's say you have a passel of minions that can all do the job, and you need it done say 10 times
21:57 khaije1 Yeah I got ya now, so these would be seperate stanzas in the same state with some form of requisite relationship between them?
21:57 MajObviousman right
21:58 khaije1 Probably even better to set a timed lock at the start of accepting the work.
21:58 MajObviousman there's some inelegance in "it does a mine.get for all the minions in the job" that I haven't figured out
22:00 khaije1 Rather than have it work as a binary semaphore, with a timed lock it could be set at the beginning and even if the job failed it'd have a record of the attempt and the job could run on a different subsequently batched minion.
22:00 MajObviousman hmm, is there any way to get the data from an event that triggers a job?
22:00 Guest73 joined #salt
22:00 MajObviousman khaije1: good thinking
22:00 khaije1 With a reactor lol
22:00 khaije1 not sure you were already looking to go down that route hahaha
22:01 khaije1 Reactors are _potentially_ the answer to everything
22:01 PerilousApricot joined #salt
22:01 MajObviousman well the reactor's running on the master
22:01 MajObviousman when I salt 'target' state.sls <something>, it gets decomposed into an event that's sent to target
22:01 kerrick joined #salt
22:02 khaije1 Ah, right hmmm
22:02 MajObviousman the target goes and fetches <something> and executes it. Within <something>, is there a way to get the data from the event that triggered <something> to run?
22:02 MajObviousman because if so, you could just pick the target and glob type out of that event, then use it as the input to your mine.get
22:03 MajObviousman you'd never have to hard set what target to use in your mine.get call
22:03 MajObviousman that's getting a bit meta, I think, but it could be super useful
22:04 aldevar joined #salt
22:05 khaije1 What would be lost between the event bus and the state's execution environment?
22:06 MajObviousman https://docs.saltstack.com/en/latest/topics/development/dunder_dictionaries.html I don't see it mentioned in here
22:06 * MajObviousman will have to play around with it a bit
22:06 MajObviousman khaije1: I don't understand your question
22:07 khaije1 I kinda was thinking about __context__ as you were describing this. Isn't that what you'd want?
22:07 MajObviousman it's close
22:08 * MajObviousman writes a state to enumerate what's in __context__
22:08 MajObviousman let's see what's in there
22:08 PatrolDoom joined #salt
22:14 MajObviousman I forgot how to write state modules, hah
22:16 khaije1 I do that every few days :)
22:29 foundatron joined #salt
22:30 whileone joined #salt
22:30 kerrick joined #salt
22:39 cpc__ joined #salt
22:42 nixjdm joined #salt
22:46 whileone joined #salt
22:47 rpb joined #salt
22:48 cpc_ joined #salt
22:51 c4rl3x joined #salt
22:59 cpc_ joined #salt
22:59 NightMonkey joined #salt
23:00 jbailey joined #salt
23:03 tobiasBora joined #salt
23:18 Guest73 joined #salt
23:29 rpb joined #salt
23:34 oeuftete joined #salt
23:44 kerrick joined #salt

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