Perl 6 - the future is here, just unevenly distributed

IRC log for #salt, 2016-09-17

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

All times shown according to UTC.

Time Nick Message
00:05 jimklo joined #salt
00:06 justanotheruser joined #salt
00:07 kusen joined #salt
00:08 justan0theruser joined #salt
00:11 tristianc joined #salt
00:17 justanotheruser joined #salt
00:22 flowstate joined #salt
00:22 justanotheruser joined #salt
00:28 kusen joined #salt
00:32 flowstate joined #salt
00:44 justanotheruser joined #salt
00:52 jimklo_ joined #salt
01:00 ninjada joined #salt
01:04 edrocks joined #salt
01:04 Salander27 joined #salt
01:05 quasiben joined #salt
01:09 Edgan I am trying to run a cassandra module from within a sls. What am I doing wrong? https://paste.fedoraproject.org/429177/40745631/
01:10 kusen joined #salt
01:12 ageorgop joined #salt
01:22 Edgan It was a missing python driver for cassandra
01:22 augg joined #salt
01:23 sandro__ joined #salt
01:30 augg if anyone would want to put their input to this that would be cool — my team wants to use a central way manage users and authenticate via ssh, etc. we've (i've) been stuck with trying to make LDAP work for a century now, and i'm wondering if migrating to salt would be a better alternative for what we need
01:30 augg i feel that LDAP is much too clunky for the goals that we have
01:35 ninjada joined #salt
01:37 catpiggest joined #salt
01:39 jimklo joined #salt
01:46 Nahual joined #salt
01:52 kusen joined #salt
02:00 quasiben joined #salt
02:09 mpanetta_ joined #salt
02:10 blu__ joined #salt
02:13 kusen joined #salt
02:14 subsignal joined #salt
02:16 cyborg-one joined #salt
02:16 pipps joined #salt
02:29 augg joined #salt
02:37 onlyanegg joined #salt
02:41 ninjada joined #salt
02:44 mikecmpbll joined #salt
02:49 kusen joined #salt
02:51 ninjada joined #salt
02:52 mpanetta joined #salt
02:57 bastiand1 joined #salt
03:02 edrocks joined #salt
03:03 flowstate joined #salt
03:15 ninjada joined #salt
03:21 flowstate joined #salt
03:24 justan0theruser joined #salt
03:27 subsignal joined #salt
03:31 armguy joined #salt
03:47 Brew joined #salt
04:12 whitenoise_ joined #salt
04:12 nethershaw joined #salt
04:16 ageorgop joined #salt
04:16 jimklo joined #salt
04:17 ninjada joined #salt
04:20 Nahual joined #salt
04:21 flowstate joined #salt
04:30 subsignal joined #salt
04:48 Sammichmaker joined #salt
05:18 jxm_ joined #salt
05:22 flowstate joined #salt
05:29 Brew joined #salt
05:33 subsignal joined #salt
05:37 Brew joined #salt
05:40 jimklo joined #salt
05:45 jimklo joined #salt
05:56 jimklo joined #salt
05:59 Brew joined #salt
06:15 subsignal joined #salt
06:21 flowstate joined #salt
06:26 pipps joined #salt
06:37 eseyman joined #salt
06:44 pipps joined #salt
06:50 zer0def joined #salt
06:58 Brew joined #salt
07:00 ninjada joined #salt
07:04 edrocks joined #salt
07:06 lorengordon joined #salt
07:09 Brew joined #salt
07:11 hasues joined #salt
07:11 hasues left #salt
07:15 mavhq joined #salt
07:21 flowstate joined #salt
07:22 Brew1 joined #salt
07:26 pipps joined #salt
07:27 XenophonF joined #salt
07:43 mpanetta_ joined #salt
07:49 chkm8 joined #salt
07:52 mpanetta joined #salt
07:55 felskrone joined #salt
07:56 Trauma joined #salt
08:04 barmaley joined #salt
08:10 toastedpenguin joined #salt
08:10 CeBe joined #salt
08:10 ivanjaros joined #salt
08:14 guerby joined #salt
08:21 flowstate joined #salt
08:28 stooj joined #salt
08:59 mikecmpbll joined #salt
09:00 Brew joined #salt
09:09 DarkKnightCZ joined #salt
09:20 flowstate joined #salt
09:21 shiriru joined #salt
09:25 lovecraftian joined #salt
10:14 mikecmpbll joined #salt
10:21 ninjada joined #salt
10:21 flowstate joined #salt
10:37 hoonetorg joined #salt
10:51 ivanjaros3916 joined #salt
10:52 kusen joined #salt
10:59 ghostgogo joined #salt
11:00 ghostgogo ?
11:01 ghostgogo left #salt
11:01 hoonetorg joined #salt
11:03 ghostssee joined #salt
11:07 edrocks joined #salt
11:20 flowstate joined #salt
11:21 ninjada joined #salt
11:22 hoonetorg joined #salt
11:29 PerilousApricot joined #salt
11:51 ch0k3r joined #salt
11:51 ch0k3r hey
11:52 ch0k3r I'm having a hard time to have something working with salt & pillars
11:52 ch0k3r anyone can help me?
11:54 ch0k3r hello?
11:56 babilen Just ask an actual question
11:56 babilen We have no idea if we can help you or not
11:56 ch0k3r oh
11:56 ch0k3r sure
11:57 babilen Just imagine the shame someone would be forced to endure if he or she says "yes" and you would then ask a question that person can't answer
11:57 babilen Horrible!
11:57 ch0k3r indeed
11:58 ch0k3r ok, so I'm basically trying to use an external pillar so it can retrieve a json file and adding it to the pillars namespace
11:58 Electron^- joined #salt
11:59 ch0k3r it simply makes a get request retrieves a json list and imports it to the pillars namespace
11:59 ch0k3r I was thinking in using some external pillars
11:59 ch0k3r like the salt.pillar.cmd_json
12:00 ch0k3r any idea how this could be accomplished?
12:00 ch0k3r I confess I'm not very familiarized with salt
12:00 ch0k3r trying to learn something on my way trough
12:05 babilen I guess you would put whatever configuration is needed for that external pillar into your master config and reload the service
12:05 ch0k3r ok
12:05 ch0k3r how can I do  that?
12:05 ch0k3r I'm totally lost on this
12:06 ch0k3r all the built-in external pillars are already deployed in the master right?
12:10 babilen You would edit your master configuration (/etc/salt/master) and put the appropriate information in there
12:10 babilen Then restart the service
12:10 inad922 joined #salt
12:11 ch0k3r uhm
12:11 ch0k3r but I think I might already have the built-in pillar for that
12:12 ch0k3r I would like ot make this as simple as possible
12:20 flowstate joined #salt
12:22 jimklo joined #salt
12:25 mattp_ http://docs.ansible.com/ansible/playbooks_conditionals.html#register-variables
12:25 mattp_ how the hell do you do this in salt?
12:33 catpig joined #salt
12:35 haam3r joined #salt
12:37 babilen mattp_: You don't
12:37 babilen (iow: you do it differently)
12:44 mattp_ babilen: please enlighten me
12:44 mattp_ you write a custom state module that you invoke?
12:46 babilen It reallly depends on what the problem is
12:47 babilen From what i've seen only/unless replaces a lot of register usecases in saltstack
12:47 babilen What is it that you need it for?
12:58 ozux joined #salt
12:59 ashokrajar joined #salt
13:02 babilen mattp_: ?
13:05 mattp_ babilen: In the process of dealing with a lot of legacy orchestration workflows from another system
13:05 mattp_ one example ill give is this, a script produces output to a flatfile on a minion
13:05 mattp_ i then need to act on the data of this file in the master
13:07 babilen 'act' how?
13:08 mattp_ ie, say "a\n\b\c" is wrriten to /tmp/scriptout
13:08 mattp_ where a,b,c are files on minion2. then rm a; rm b; rm c
13:09 babilen So one minions produces a list of files that have to be deleted on another minion?
13:10 mattp_ thats a contrived example, but yes
13:10 mattp_ like, minion does something that locally generates data
13:10 mattp_ how do you retreive, interpret, and act on it from the master to another minion
13:10 mattp_ quite literally what register seems to provide :)
13:10 babilen You could write a custom grain and publish it via the mine
13:12 mattp_ babilen: if you did that, you publish to the mine
13:12 babilen Or use https://docs.saltstack.com/en/develop/ref/peer.html and call that command on another minion
13:12 mattp_ do you then need to mine.refresh from the other minion?
13:12 babilen The mine would have to be refreshed, yes
13:13 babilen You'd orchestrate that
13:13 mattp_ thats what I ended up cobbling together
13:13 babilen https://docs.saltstack.com/en/latest/topics/orchestrate/orchestrate_runner.html#orchestrate-runner
13:13 babilen Ah, so you already solved that?
13:13 mattp_ seems hacky though. was hoping there would be a better way
13:14 mattp_ babilen: even outside of that. when youve got a multistate run
13:14 mattp_ how do you act based on the previous states output?
13:14 babilen Not really .. the problem with things like these is that they don't really adhere to salt's declarative state system in that you describe the state completely
13:14 babilen It's also rather 'single minion' centric
13:15 babilen You don't act based on previous state input .. that's thinking imperatively, you describe what you want to achieve
13:15 babilen *output
13:16 mattp_ I think what you just said is fundamentally the problem
13:17 babilen It's not "if A then B" but "B"
13:18 babilen Not "if java version 8 is installed, grab config file java_8.cfg" but "Install java 8, make sure it's being used and use java_8.cfg"
13:18 babilen (for example)
13:21 mattp_ babilen: with the orch.runner is where i run into this problem more
13:21 flowstate joined #salt
13:21 mattp_ perhaps im trying to use salt for workflows which as you say are not adhering to salts state system
13:22 ninjada joined #salt
13:23 babilen That might be the case .. salt somewhat expects you to hand it a complete specification of what you want to achieve and not rules on how to react to arbitrary state you find
13:24 jimklo joined #salt
13:24 babilen You say "The content of this file is ...." and not "If line 5 contains foo then add bar on line 29" (which breaks if foo is on line 6 also)
13:24 babilen I mean that is possible to express in salt, but I think you get the idea
13:24 babilen The problem with this is that it sometimes undermines the "ten identical minions of which one is the randomly elected leader"
13:35 mattp_ babilen: thanks
13:45 Lionel_Debroux joined #salt
13:51 ch0k3r back
13:51 ch0k3r thx babilen
13:51 ch0k3r but there's still one thing that doesn't compute
13:51 ch0k3r all the external pillars aren't already built-in into the master?
13:51 babilen They are, but you still have to enable and configure them
13:52 ch0k3r uhm
13:52 ch0k3r ok
13:52 ch0k3r so as a matter of example
13:52 ch0k3r https://docs.saltstack.com/en/2015.8/ref/pillar/all/index.html
13:52 ch0k3r if I would like to use any of these pillars
13:52 ch0k3r for instance the cmd_json
13:53 ch0k3r I have to enable and configure them?
13:53 babilen Yes
13:53 ch0k3r the way I perceive them is that they are triggered out of the box
13:54 ch0k3r that you can simply run them
13:54 ch0k3r can you point me to any doc on how can I set these external built-in pillars?
13:55 babilen https://docs.saltstack.com/en/latest/topics/development/external_pillars.html
13:57 babilen ch0k3r: It doesn't necessarily make sense to "simply run them". The git external pillar would, for example, have to know how to access your git repositories (and so on)
13:57 babilen I mean that has to be configured somewhere
13:58 ch0k3r babilen: thx
13:58 ch0k3r so tell me another thing
13:59 ch0k3r what's the difference between the pillars and modules then?
13:59 cyborg-one joined #salt
14:03 babilen Pillars are modules that return minion specific dictionaries of data ... execution modules are used for running commands on the minion
14:04 sagerdearia joined #salt
14:07 dendazen joined #salt
14:10 ch0k3r ah
14:10 ch0k3r ok
14:13 ch0k3r so i have the external pillar added to the master config
14:13 ch0k3r how can I call it ?
14:13 ch0k3r e.g. -> ext_pillar:   - cmd_json: 'echo {\"arg\":\"value\"}'
14:14 babilen You don't call it, it will be used when you update the pillar
14:14 ch0k3r uhm
14:15 babilen Just refresh the pillar on one of your minions and you'll be good to go
14:15 ch0k3 joined #salt
14:15 ch0k3 uhm
14:15 ch0k3 so how can i retrieve its data then?
14:16 babilen Do you have a minion?
14:16 ch0k3 yes
14:16 ch0k3 I have two actually
14:16 babilen Have you updated its pillar since you added the external pillar?
14:16 babilen *refreshed
14:17 ch0k3 yes
14:17 ch0k3 salt '*' saltutil.refresh_pillar
14:18 ninjada joined #salt
14:18 babilen A "salt '*' pillar.items" should retrieve the content of the pillar for that minion
14:18 ch0k3 in fact I do see them
14:18 ch0k3 but I do not know how to apply and retrieve the data
14:18 ivanjaros joined #salt
14:18 Morrolan joined #salt
14:19 babilen ch0k3: Where do you want to do that?
14:19 babilen And what do you want to do with it?
14:19 ch0k3 ok
14:19 ch0k3 let me give you an example
14:20 ch0k3 if I do have this in the external_pillar section
14:20 ch0k3 ext_pillar:   - test:       url: http://www.google.com
14:20 flowstate joined #salt
14:20 ch0k3 how can I execute the url in order to retrieve the response from google?
14:20 ch0k3 and save it in a pillar?
14:20 babilen What?
14:20 babilen Is there a "test" external pillar?
14:20 ch0k3 I made this myself
14:21 babilen You made what?
14:21 babilen You implemented an external pillar?
14:21 ch0k3 what I want is to create an external pillar that calls google and adds the response to the pillar namespace
14:22 ch0k3 or alternatively use an built-in pillar that does this
14:22 babilen Okay, just implement it
14:22 ch0k3 that's what I'm trying to do
14:22 babilen Okay, where do you run into problems?
14:23 babilen And also: What form do you want the response to have?
14:23 ch0k3 json
14:23 ch0k3 I want to retrieve the json response from a url
14:23 babilen As in: You want to return the HTML you retrieved in a JSON dictionary?
14:23 ch0k3 no
14:24 babilen Since when does google.com return json?
14:24 ch0k3 the response is already parsed  in json
14:24 babilen http://www.google.com
14:24 ch0k3 that was just an experiment
14:24 babilen Please .. be *specific*
14:24 ch0k3 to see if I'm able to retrieve, as a test, the response from google.com
14:24 babilen You don't have to use actual URLs, but if you want to call a REST API then say so
14:24 jimklo joined #salt
14:25 ch0k3 yes
14:25 ch0k3 that's what I want
14:25 ch0k3 sorry
14:25 ch0k3 I want to make a get request against a page that gives me a list in json
14:25 babilen You could use https://docs.saltstack.com/en/latest/topics/tutorials/http.html
14:26 ch0k3 oh nice
14:26 ch0k3 that helps :D
14:26 ch0k3 thx
14:26 babilen You should be able to call the execution module http.query function in a normal pillar already
14:26 babilen salt['http.query'](.....)
14:26 ch0k3 no need to create my own pillar?
14:27 babilen Depends if you want to do any data munging, but I don't think so
14:27 ch0k3 I want a little
14:27 ch0k3 the json response is basically a list of rpms
14:27 ch0k3 that I want to later install on the minionss
14:27 sagerdearia joined #salt
14:28 ch0k3 so to sum up
14:28 babilen Why didn't you ask about this specific thing in the beginning?
14:28 ch0k3 I want to make a GET request, that the reponse returns a json list of rpms that I want to install on the minions
14:28 ch0k3 I didn't want to bother you that mych
14:29 ch0k3 ..much
14:29 babilen Well .. but the approach really depends on what you want to achieve
14:29 ch0k3 but that's what I'm trying to accomplish here
14:29 babilen I'd start with a normal pillar and the salt['http.query'](...) call
14:30 ch0k3 I want to create an external pillar that fetches the json list and then create the salt state that executes and install the rpms listed on that json list
14:31 babilen Okay, do it in an external pillar then, but I think you'd get away with a normal pillar or one that uses #py renderer
14:31 babilen Either way ... the http.query function should allow you to easily make the API call
14:31 babilen There are a bazillion approaches
14:32 ch0k3 yeah, I can imagine. My problem is that is the first time that I'm actually playing with this
14:33 amcorreia joined #salt
14:33 ch0k3 so I'm a bit lost
14:34 ch0k3 and sorry for the lack of clarification
14:34 ch0k3 next time I'll be direct to the point
14:36 babilen I would suggest: Don't toy with external pillars right now. Implement a pillar written with the #py renderer (just put that in the first line) and implement the run() function in there. That function should return a dictionary.
14:36 babilen You can use the http.query stuff in there also (refer to the article I linked for examples)
14:37 babilen Later you can easily "port" that to an external pillar
14:38 ch0k3 ok
14:39 ch0k3 but how can I confirm that its working properly ?
14:39 ch0k3 i.e. how can i call the pillar after is implemented?
14:39 ch0k3 salt \* state.sls external_pillar.PILLA_NAME ?
14:41 babilen No, you just update the pillar for a minion
14:42 babilen saltutil.refresh_pillar calls all pillars and combines their responses into a single dictionary
14:46 justanotheruser joined #salt
14:48 pipps joined #salt
14:48 subsignal joined #salt
14:53 jimklo joined #salt
15:01 sp0097 joined #salt
15:10 edrocks joined #salt
15:12 mvensky joined #salt
15:12 sagerdearia joined #salt
15:15 mvensky joined #salt
15:17 pipps joined #salt
15:19 krymzon joined #salt
15:20 ninjada joined #salt
15:20 mvensky joined #salt
15:21 whitenoise joined #salt
15:28 sandro_ joined #salt
15:30 mikecmpb_ joined #salt
15:36 sagerdearia joined #salt
15:39 pipps joined #salt
15:44 giany hi, I have a master server that has multiple minions, one of these minions is the master itself..I was wondering how can I run a sls/orchastrate or even a command on the master minion that uses a different other minion information (e.g something from grain).
15:47 mavhq joined #salt
15:50 JPT giany: Check the documentation concerning jinja templates. You can integrate jinja templates into your states and use grains and pillar data (and probably more) to dynamically build up states from those templates
15:50 ch0k3 hi again
15:50 kusen joined #salt
15:50 ch0k3 does anyone knows how i can access external pillar data?
15:51 ch0k3 and how one can use this in a state?
15:53 JPT ch0k3: According to the documentation [1], you can create an external pillar module (which is basically python code creating a dictionary or something like that), that then gets merged into the pillar data by the salt master.
15:53 JPT [1] https://docs.saltstack.com/en/latest/topics/development/external_pillars.html
15:54 jimklo joined #salt
15:54 ch0k3 I checked already that doc
15:54 ch0k3 but this is all so confusing still
15:55 ch0k3 I have a external pillar with this conf - http_yaml: url: http://task:5000/rpm
15:55 ch0k3 how can I access the external pillar data?
15:55 ch0k3 how can I access the dict?
15:55 ch0k3 i.e the response from the url?
15:55 babilen ch0k3: You access it like any other pillar data .. there is just a single pillar that combines all of it
15:56 babilen salt['pillar.get']('foo:bar')
15:56 ch0k3 combines it where?
15:56 babilen (for example)
15:56 babilen The master
15:56 ch0k3 I must retrieve this from the master?
15:57 JPT Can you try to describe your goal?
15:57 * babilen chuckles
15:57 ch0k3 I was trying to run this from the minion
15:57 ch0k3 salt-call '*' pillar.get external_pillar
15:57 sagerdearia joined #salt
15:57 babilen literally external_pillar ?
15:58 ch0k3 yep
15:58 JPT There won't be an "external_pillar" key in your pillar unless the data from your url defines one.
15:58 babilen Could you run salt '*' pillar.items and check that please?
15:58 ch0k3 babilen: that works but lists all the pillars
15:59 babilen ch0k3: Could you paste the bit that pertains to the data you want (or all of it) to one of http://refheap.com, http://paste.debian.net, https://gist.github.com, http://sprunge.us, … ?
15:59 ch0k3 I just want to fetch the result from the http_yaml
15:59 ch0k3 babilen: sure
16:02 ch0k3 https://gist.github.com/anonymous/4e549395702fea5c80dba2aa5927a712
16:02 ch0k3 there you go
16:03 ch0k3 i pasted you the response
16:03 ch0k3 and what I would expect to see as a dict when I configure the external pillar
16:03 ch0k3 I literally lost 4 hours now into this
16:03 ch0k3 with no significant progess so far
16:04 ch0k3 then I want to grab that list (output from the curl command) and run a state that install those rpms
16:04 babilen Which command is that the output of?
16:05 ch0k3 I'm running that inside the master where I also run the minions
16:05 ch0k3 that is part of the output of the salt \* pillar.items
16:06 ch0k3 so the external_pillars are synced
16:06 babilen Okay ... Could you paste your pillar code?
16:06 ch0k3 but Im not able to access the data from the pillar
16:06 babilen And using "ext_pillar' as pillar key is rather unconventional, but meh
16:08 ch0k3 salt.utils.http.query('http://example.com')
16:08 ch0k3 ..ops
16:08 babilen It looks as if you forgot to actually make the http query
16:08 ch0k3 import salt.utils.http  a = salt.utils.http.query('http://task:5000/rpm')     return a
16:08 babilen Well, that won't do
16:09 ch0k3 no?
16:09 ch0k3 I put that into my pillar master folder
16:09 babilen What's your pillar master folder?
16:09 ch0k3 added to the top.sls file
16:09 babilen No no no
16:09 ch0k3 and create the init.sls with that code
16:09 ch0k3 damn
16:09 ch0k3 I'm totally lost on this
16:09 sp0097 left #salt
16:10 ch0k3 and the documentation doesn't facilitate
16:10 babilen External pillars are *external* they are completely separate from the "normal" / "standard" pillars in /srv/pillars
16:10 ch0k3 :/
16:10 babilen Why do you still want to write an external pillar?
16:10 ch0k3 ok
16:10 babilen Are you trying to understand them better?
16:10 ch0k3 it needs to be done through a external_pillar
16:10 ch0k3 yes
16:10 babilen Why?
16:11 ch0k3 it was requested me to do this in this way - i.e. using external pillars
16:11 babilen Okay so this is, forgive me, an external requirement?
16:11 ch0k3 it was part of a task that was assigned to me
16:11 ch0k3 iap
16:12 babilen okay
16:12 babilen Did you take a look at the way some of the other external pillars are implemented?
16:13 ch0k3 yup
16:13 ch0k3 they basically differ from the rest in the way they have an ext_pillar() function
16:13 ch0k3 that was my understanding
16:13 babilen But you didn't implement the __virtual__ nor the ext_pillar function .. why?
16:13 ch0k3 no
16:13 ch0k3 I have no idea what to do
16:14 babilen yes, that is the function that is being called .. and you would then add that as an additional pillar module to _pillars
16:14 ch0k3 to be honest I never played with salt
16:14 babilen (in file_roots)
16:14 ch0k3 this is the first time
16:14 babilen That's okay
16:14 ch0k3 and is so complicated
16:14 ch0k3 puppet is much more easier
16:14 babilen It's a bit of a tough thing to do when you just start out
16:14 ch0k3 yup
16:14 ch0k3 but this thing is for an interview
16:14 ch0k3 it was presented to me as a task
16:15 babilen Well .. you were assigned something that is like three levels deep in salt land. You wouldn't come across this in your daily work and *definitely* not during your first week
16:15 babilen It's okay .. it's cool.
16:15 JPT umm... perhaps your http yaml output is missing a dict with a "dict" key? This is the code that fetches your data and returns it: https://github.com/saltstack/salt/blob/develop/salt/pillar/http_yaml.py
16:15 babilen Huh ... I thought that ch0k3 is trying to write his own external pillar rather than using a built in one?
16:15 ch0k3 and despite the fact that I know nothing about salt I'm finding this a bit difficult
16:16 babilen Still surprising that it comes up with that http_yaml keys in the pillar output though
16:16 ch0k3 Create a custom External Pillar in SaltStack that does a HTTP request  and fetches the JSON file and adds the list to the Pillars namespace.
16:16 babilen ch0k3: Could you paste your master configuration (without commented stuff) ?
16:16 ch0k3 Create a Salt State that installs the RPM's list in the JSON file
16:16 ch0k3 that is the requirement
16:16 babilen Okay
16:17 ch0k3 it needs to be an custom external pillar
16:17 babilen Well .. somehow that http_yaml stuff sneaked into your config ...
16:17 ch0k3 babilen: i inserted that into the master config
16:17 ch0k3 it was me to blame
16:18 ch0k3 I was hoping to get somehow this working but calling the external pillar
16:19 babilen But to begin writing an external pillar you have to start with something like: http://paste.debian.net/826168/
16:20 babilen Read https://docs.saltstack.com/en/latest/topics/development/external_pillars.html#the-module -- it explains this
16:20 ch0k3 https://gist.github.com/anonymous/0cfa9bcc071ace616ba8a7c7b79b5041
16:20 ch0k3 this is my master conf
16:21 babilen And you would then get the URL out of __opts__
16:24 babilen To use your module you would place it into the locations discussed in https://docs.saltstack.com/en/latest/topics/development/external_pillars.html#location
16:26 ch0k3 I'm lost
16:26 ch0k3 so let me try to understand
16:26 ch0k3 I have to build my own external pillar
16:26 ch0k3 and then place into a specific location?
16:27 babilen (you don't have to but that's your assignment, so yes)
16:27 ch0k3 I can also try to replicate an existing one that does this
16:27 ch0k3 as long as its a custom
16:28 babilen Your assignment is to write a Python module (based on the description I linked earlier) that performs REST API calls. The URL of which is being passed in as options (cf. __opts__) and the result of that call should be returned in suitable format from the ext_pillar function
16:29 babilen That modules is being placed in the _pillar directory in file_roots (e.g. /srv/salt/_pillar) and has to be configured in the master configuration file.
16:29 babilen It is then being run for each minion matched by '*' in salt '*' saltutil.refresh_pillar
16:30 babilen The data returned is merged with the rest of the other pillars and handed over to the minion where you can access it with pillar.get / pillar.items
16:30 ageorgop joined #salt
16:30 babilen You can perform those http queries with http.query as discussed in the article I linked earlier
16:31 ch0k3 so, a better approach would be something like this - https://github.com/saltstack/salt/blob/develop/salt/pillar/http_json.py ?
16:31 ch0k3 i believe that does what they want
16:31 sagerdearia joined #salt
16:31 babilen Yeah, you can copy that or use it as inspiration
16:32 PerilousApricot joined #salt
16:32 babilen And you should point out that you would have used that right away
16:33 babilen (as it already does what you want)
16:33 kusen joined #salt
16:33 babilen I guess .. you should use some sensible keys in the dictionary you return that makes it obvious that you are returning package lists
16:33 babilen {'base_packages': ....} or whatever
16:33 babilen Who knows what they are after semantically, but make it obvious/clear
16:34 ch0k3 uhm
16:34 ch0k3 I think I'm starting to understant it know
16:34 ch0k3 ..understand
16:34 ch0k3 ok
16:35 ch0k3 I'm going to confine to my cave again and see if I'm able to get something done
16:35 ch0k3 babilen: many thanks for the explanation
16:35 babilen You are welcome .. good luck
16:35 ch0k3 you helped me a lot
16:35 ch0k3 let's see if I can do something
16:38 ivanjaros joined #salt
16:50 Salander27 joined #salt
16:54 jimklo joined #salt
17:06 amcorreia joined #salt
17:13 armonge joined #salt
17:15 kusen joined #salt
17:15 ozux joined #salt
17:26 krymzon joined #salt
17:29 sagerdearia joined #salt
17:35 routh joined #salt
17:38 routh Hi folks, I have what I hope is a quick question. I'm adding a .repo state to a formula to include official repos. I'd like the package state in the .server state to detect if the .repo state was included in the pillar and conditionally require it. How would I check for the state being included?
17:39 sagerdearia joined #salt
17:40 routh Maybe I should rephrase a bit: ~adding a repo.sls   ~package state in the server.sls to detect if the repo.sls was included
17:46 sagerdearia joined #salt
17:53 sagerdearia joined #salt
17:53 GreatSnoopy joined #salt
17:54 flowstate joined #salt
17:55 jimklo joined #salt
17:57 kusen joined #salt
17:57 sagerdearia joined #salt
18:05 jxm_ joined #salt
18:05 babilen routh: Why would you want to detect it? If you include it is *is* included
18:09 babilen In a way I'd include it and just have it do the right thing™ based on whatever pillar data you pass in
18:09 babilen (even if that's nothing)
18:18 kusen joined #salt
18:18 sagerdearia joined #salt
18:19 pipps joined #salt
18:19 flowstate joined #salt
18:22 sagerdearia joined #salt
18:30 krymzon joined #salt
18:32 blu__ hi guys. I'm trying to pass a SQL Query as context in file.managed and cant get around render errors doing that: http://paste.debian.net/hidden/92792c7c/
18:33 blu__ why does it even care for formatting at that point? i thought if I say query: |   it doesnt care about whats below until the next indentation for the state argument list matches
18:37 blu__ hmpf. not even with | indent | yaml_encode. tough.
18:39 flowstate joined #salt
18:39 kshlm joined #salt
18:41 blu__ hm. cant get this to work - wtf?
18:50 ageorgop joined #salt
18:51 Xenophon1 joined #salt
18:55 swa_work joined #salt
18:56 jimklo joined #salt
18:57 edrocks joined #salt
19:00 kusen joined #salt
19:02 Salander27 joined #salt
19:03 ch0k3 ok
19:03 ch0k3 so I managed to have this loaded
19:03 ch0k3 in fact now I do see the get request in the httpd log
19:03 ch0k3 but
19:03 ch0k3 the pillar throws an exception that I have no idea how to handle
19:04 ch0k3 task       | 172.17.0.3 - - [17/Sep/2016 19:02:25] "GET /rpm HTTP/1.1" 200 - master     | [DEBUG   ] Response Status Code: 200 master     | [ERROR   ] Error in function _pillar: master     | Traceback (most recent call last): master     |   File "/usr/lib/python2.7/site-packages/salt/master.py", line 1463, in run_func master     |     ret = getattr(self, func)(load) master     |   File "/usr/lib/python2.7/site-packages/salt/master.py",
19:04 ch0k3 i believe I have to convert this from string to dict ?
19:05 ch0k3 minion2    | [ERROR   ] Got a bad pillar from master, type str, expecting dict:
19:06 netcho joined #salt
19:11 KingJ joined #salt
19:11 ZachLanich joined #salt
19:14 armonge joined #salt
19:22 kusen joined #salt
19:22 ninjada joined #salt
19:24 lorengordon joined #salt
19:25 KingJ joined #salt
19:29 flowstate joined #salt
19:29 keimlink joined #salt
19:29 Xenophon1 ch0k3: you're doing some kind of http json ext pillar thing, right?
19:30 XenophonF joined #salt
19:33 om2 joined #salt
19:37 om3 joined #salt
19:38 XenophonF ah, the joy of writing recursive functions in jinja...
19:48 om2 joined #salt
19:50 Echtier joined #salt
19:56 om joined #salt
19:56 armonge joined #salt
19:57 jimklo joined #salt
20:00 DarkKnightCZ joined #salt
20:04 kusen joined #salt
20:07 clevodearia joined #salt
20:09 flowstate joined #salt
20:14 ZachLanich joined #salt
20:16 sandro_ joined #salt
20:16 ch0k3 XenophonF: yup
20:16 ch0k3 apparently it seems that I have to convert the json list to dict
20:17 babilen Pillars *are* a single dict
20:18 sandro_ joined #salt
20:20 flowstate joined #salt
20:22 ninjada joined #salt
20:22 ch0k3 uhm
20:22 ch0k3 so how can I convert the json list to dict?
20:24 justan0theruser joined #salt
20:27 justanotheruser joined #salt
20:34 justanotheruser joined #salt
20:46 justan0theruser joined #salt
20:55 swa_work joined #salt
20:58 jimklo joined #salt
21:01 armonge joined #salt
21:06 kusen joined #salt
21:09 netcho joined #salt
21:14 ch0k3 how can a external pillar that gets a json list form an external http source expects a single dict and not a list of dicts?
21:15 ch0k3 in this example - http://pastebin.com/f6LCrpDE
21:15 ch0k3 does anyone knows?
21:21 flowstate joined #salt
21:27 kusen joined #salt
21:28 lorengordon joined #salt
21:48 kusen joined #salt
21:56 armyriad joined #salt
21:58 mpanetta joined #salt
21:58 dendazen joined #salt
21:58 jimklo joined #salt
22:05 netcho joined #salt
22:09 kusen joined #salt
22:13 ageorgop joined #salt
22:14 pipps joined #salt
22:19 flowstate joined #salt
22:23 pipps joined #salt
22:27 netcho joined #salt
22:30 kusen joined #salt
22:39 pipps99 joined #salt
22:46 eichiro joined #salt
22:59 jimklo joined #salt
23:00 edrocks joined #salt
23:06 flowstate joined #salt
23:07 kusen joined #salt
23:08 pipps joined #salt
23:10 whiskeyJack joined #salt
23:15 teryx510 joined #salt
23:18 whiskeyjack joined #salt
23:21 flowstate joined #salt
23:22 felskrone joined #salt
23:29 skeezix-hf joined #salt
23:29 onlyanegg joined #salt
23:42 amcorreia joined #salt
23:45 pipps joined #salt
23:51 skeezix-hf joined #salt
23:55 clevodearia joined #salt

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