Perl 6 - the future is here, just unevenly distributed

IRC log for #salt, 2017-12-02

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

All times shown according to UTC.

Time Nick Message
00:00 saltslackbridge joined #salt
00:01 shripadr joined #salt
00:12 sh123124213 joined #salt
00:13 brd what is the best way to get the default interface of a machine for use in a jinja template?
00:13 brd I am using network.ifstartswith currently, but it seems like it could accidentially include lo0
00:17 brd network.interfaces seems like it could be useful, but I don't know how to filter the output
00:17 pipps joined #salt
00:21 shripadr joined #salt
00:25 stickyfingaz joined #salt
00:33 pastorin_ joined #salt
00:34 fracklen joined #salt
00:34 alker joined #salt
00:34 pastorin_ left #salt
00:41 alker1 joined #salt
00:41 shripadr joined #salt
00:43 fracklen joined #salt
00:43 pipps joined #salt
00:45 rem5 joined #salt
00:50 fracklen joined #salt
00:51 sh123124213 joined #salt
00:53 hemebond brd: network.ip_addrs?
00:57 brd hemebond: that gives the IP, I need the interface
00:57 hemebond Oh the interface name?
00:57 hemebond Okay.
00:57 brd yeah :/
01:00 hemebond Well network.interfaces seems appropriate. Returns a dict.
01:01 shripadr joined #salt
01:01 mcqueenorama joined #salt
01:03 brd hemebond: but how can I filter out things like lo0 or interfaces that are down?
01:04 hemebond If you put the result into a variable, you can just loop over it (Jinja) and ignore the loopback or downed interfaces.
01:09 kellyp joined #salt
01:12 mcqueeno1ama joined #salt
01:20 shripadr joined #salt
01:35 g3cko joined #salt
01:36 pipps joined #salt
01:37 brd hemebond: something like this?
01:37 brd {%- set ints = salt.network.interfaces() -%}
01:37 brd {%- for int in ints %}
01:37 brd # {{ int }}
01:37 brd {%- if int.up == True %}
01:38 brd I ask, because it doesn't like int.up
01:38 brd I get: Comment: Unable to manage file: Jinja variable 'str object' has no attribute 'up'
01:38 hemebond int is likely a reserved word or keyword
01:38 hemebond use iface
01:38 brd oo
01:38 brd ok
01:38 hemebond Oh.
01:38 hemebond (you should change it but it might not be the issue)
01:39 brd no chnage
01:39 hemebond Oh, the way you're calling network.interfaces doesn't seem right.
01:40 brd the # {{ int }} works
01:40 hemebond Does it? It has all the info?
01:40 shripadr joined #salt
01:41 brd hemebond: no, just the interface name
01:42 hemebond {% for int in ints.items() %}
01:42 hemebond or
01:42 hemebond {%- for iface_name, iface in ints.items() %}
01:47 brd both of those give: Unable to manage file: Jinja error: 'builtin_function_or_method' object is not iterable
01:47 brd {%- set ints = salt.network.interfaces() -%}
01:47 brd {%- for iface_name, iface in ints.items %}    <======================
01:49 hemebond You're missing ()
01:49 hemebond items() is a method
01:51 brd oh
01:56 noobiedubie joined #salt
01:57 brd hemebond: that works, thank you!
01:57 hemebond 👍
01:57 brd hemebond: I really wish the salt documentation had more info about jinja or a pointer to a guide or something
01:58 hemebond Jinja is not a Saltstack thing.
01:58 hemebond It's its own project that Saltstack happens to use by default.
01:58 hemebond Jinja is just a popular Python templating engine.
01:59 hemebond http://jinja.pocoo.org/
02:00 brd hemebond: yeah, I know, but I am saying this because it is so core to how saltstack works
02:00 shripadr joined #salt
02:00 brd hemebond: and I have looked at that site a few times to try and figure it out
02:00 brd I gotta run to a datacenter, bbl
02:00 hemebond Well what you're doing with it is fairly advanced/complex.
02:01 hemebond For basic loops there is documentation in Salt from memory.
02:01 hemebond cya
02:03 sh123124213 joined #salt
02:08 kellyp joined #salt
02:12 fgimian joined #salt
02:13 nomeeed joined #salt
02:15 SkyRocknRoll joined #salt
02:20 shripadr joined #salt
02:38 sh123124213 joined #salt
02:40 shripadr joined #salt
03:35 ilbot3 joined #salt
03:35 Topic for #salt is now Welcome to #salt! <+> Latest Versions: 2016.11.8, 2017.7.2 <+> Support: https://www.saltstack.com/support/ <+> Logs: http://irclog.perlgeek.de/salt/ <+> Paste: https://gist.github.com/ <+> See also: #salt-devel, #salt-offtopic, and https://saltstackcommunity.herokuapp.com (for slack) <+> We are volunteers and may not have immediate answers
03:39 shripadr joined #salt
03:52 sh123124213 joined #salt
03:52 rem5 joined #salt
03:59 shripadr joined #salt
04:00 mcqueenorama joined #salt
04:06 shripadr joined #salt
04:11 cliluw joined #salt
04:24 sh123124213 joined #salt
04:36 chowmeined joined #salt
05:07 brd hemebond: yeah there is.. I just wish there was.. more intermediate
05:08 mcqueenorama joined #salt
05:13 nkuttler joined #salt
05:23 pipps joined #salt
05:24 pipps joined #salt
05:30 g3cko joined #salt
05:33 sh123124213 joined #salt
05:33 hemebond brd: Fair enough.
05:51 shiranaihito joined #salt
06:01 Rubin joined #salt
06:05 saltslackbridge1 joined #salt
06:08 kellyp joined #salt
06:16 sh123124213 joined #salt
06:19 Rubin joined #salt
06:26 zerocoolback joined #salt
06:36 _snd joined #salt
07:08 lkolstad joined #salt
07:25 nkuttler joined #salt
07:26 kjsaihs joined #salt
07:51 yuhl joined #salt
08:00 pipps joined #salt
08:01 kjsaihs is it possible to call a variable while using a second variable to form its name? For example i am importing a yaml file as hosts and then defining curhost variable at last trying to get the attribute of {{ 'hosts.' + curhost '.vhost' }}
08:02 hemebond kjsaihs: In Jinja you use ~ to concatenate strings.
08:05 mcqueenorama joined #salt
08:06 sh123124213 joined #salt
08:15 kjsaihs hemebond: thank you! i am almost there. {{ 'hosts.' ~ curhost ~ '.vhost' }} prints the correct variable but can i get its attribute?
08:26 mcqueeno1ama joined #salt
08:26 hemebond attribute?
08:26 hemebond Oh, I see what you're trying to do.
08:27 hemebond Use ['blah'] notation to access the property.
08:31 hemebond Or in your case, {{ hosts[corhost].vhost }}
08:31 hemebond *curhost
08:37 kjsaihs hemebond: this is great! Thank You!!!
08:45 Trauma_ joined #salt
08:46 hemebond 👍
08:46 mcqueeno1ama joined #salt
08:56 Trauma__ joined #salt
09:07 mcqueenorama joined #salt
09:17 ymasson joined #salt
09:20 shripadr joined #salt
09:27 mcqueeno1ama joined #salt
09:28 SkyRocknRoll joined #salt
09:48 mcqueeno1ama joined #salt
10:00 pualj joined #salt
10:08 mcqueenorama joined #salt
10:08 kellyp joined #salt
10:14 Trauma_ joined #salt
10:26 rem5 joined #salt
10:44 alker joined #salt
10:47 pualj_ joined #salt
10:50 sh123124213 joined #salt
10:50 pualj joined #salt
10:50 mcqueeno1ama joined #salt
10:59 dograt joined #salt
11:10 mcqueenorama joined #salt
11:11 mikecmpbll joined #salt
11:30 Lionel_Debroux joined #salt
11:31 mcqueeno1ama joined #salt
11:51 mcqueeno1ama joined #salt
12:05 LostSoul joined #salt
12:12 mcqueenorama joined #salt
12:13 fracklen joined #salt
12:14 fracklen joined #salt
12:32 mcqueeno1ama joined #salt
12:35 sh123124213 joined #salt
12:36 Trauma__ joined #salt
12:53 mcqueeno1ama joined #salt
12:54 Trauma__ joined #salt
13:02 Trauma__ joined #salt
13:08 fracklen_ joined #salt
13:10 Trauma__ joined #salt
13:10 kellyp joined #salt
13:13 mcqueenorama joined #salt
13:16 Trauma_ joined #salt
13:16 Trauma__ joined #salt
13:19 Trauma_ joined #salt
13:20 Trauma__ joined #salt
13:23 Trauma_ joined #salt
13:24 Trauma_ joined #salt
13:29 Trauma_ joined #salt
13:34 mcqueeno1ama joined #salt
13:35 Trauma_ joined #salt
13:54 mcqueeno1ama joined #salt
13:54 bvcelari joined #salt
14:15 mcqueenorama joined #salt
14:21 indistylo joined #salt
14:21 fracklen joined #salt
14:32 yuhl joined #salt
14:35 mcqueeno1ama joined #salt
14:42 pualj joined #salt
14:54 fracklen joined #salt
14:55 mcqueeno1ama joined #salt
15:00 pualj_ joined #salt
15:03 promorphus joined #salt
15:05 pualj_ joined #salt
15:10 fracklen joined #salt
15:14 indistylo joined #salt
15:14 cyteen__ joined #salt
15:16 mcqueenorama joined #salt
15:16 promorphus joined #salt
15:20 dmaphy joined #salt
15:24 zerocoolback joined #salt
15:30 Hybrid joined #salt
15:35 promorphus joined #salt
15:36 mcqueeno1ama joined #salt
15:42 cyteen__ joined #salt
15:46 om2 joined #salt
15:47 Hybrid joined #salt
15:48 pualj joined #salt
15:49 cyteen__ joined #salt
15:57 mcqueeno1ama joined #salt
16:02 taylorbyte1 joined #salt
16:03 taylorbyte1 left #salt
16:04 pualj_ joined #salt
16:10 rem5 joined #salt
16:14 zerocoolback joined #salt
16:20 bvcelari joined #salt
16:38 mcqueenorama joined #salt
16:41 yidhra joined #salt
16:44 snc joined #salt
16:57 Trauma_ joined #salt
16:58 mcqueeno1ama joined #salt
16:59 pualj joined #salt
17:16 fracklen joined #salt
17:16 pualj joined #salt
17:19 mcqueenorama joined #salt
17:19 Deliant joined #salt
17:25 pualj_ joined #salt
17:26 shoogz joined #salt
17:27 shoogz joined #salt
17:27 shoogz joined #salt
17:28 shoogz joined #salt
17:28 shoogz joined #salt
17:29 shoogz joined #salt
17:35 mcqueeno1ama joined #salt
17:46 cyteen__ joined #salt
17:58 cyteen__ joined #salt
18:09 Lionel_Debroux_ joined #salt
18:12 RandyT greetings
18:12 RandyT trying to use jinja to get the last octet of an ip address.
18:12 RandyT {% set fwmark = (node['netip']|regex_match(\\d+$)) %}
18:12 RandyT doesn't like the \ whether it is escaped or not. Is there another way to do this?
18:14 cyteen__ joined #salt
18:21 cyteen__ joined #salt
18:24 _KaszpiR_ joined #salt
18:26 Neighbour RandyT: Try putting the regex between ''s
18:30 cyteen__ joined #salt
18:36 GrisKo joined #salt
18:42 RandyT yeah, figured that out... how do I get the first/only item out of the list?  Using [0] not doing it...
18:45 RandyT appears that it is [0] on the set variable fwmark[0]... thanks
18:45 RandyT perhaps fwmark.first works as well?
18:48 oida joined #salt
18:51 nidr0x joined #salt
18:54 nidr0x joined #salt
18:56 Trauma_ joined #salt
18:58 trouba_w joined #salt
18:58 mcqueenorama joined #salt
19:05 mcqueeno1ama joined #salt
19:15 dhwt joined #salt
19:18 pualj_ joined #salt
19:23 justanotheruser joined #salt
19:23 justan0theruser joined #salt
19:33 aldevar joined #salt
19:39 tiwula joined #salt
19:47 sjorge joined #salt
20:06 rem5 joined #salt
20:08 fracklen joined #salt
20:08 fracklen joined #salt
20:15 dmaphy joined #salt
20:28 pualj_ joined #salt
20:38 jab416171 joined #salt
20:41 Trauma_ joined #salt
20:43 indistylo joined #salt
20:51 Trauma_ joined #salt
21:11 nidr0x joined #salt
21:29 Trauma__ joined #salt
21:30 shoogz joined #salt
21:30 shoogz joined #salt
21:31 shoogz joined #salt
21:31 shoogz joined #salt
21:32 shoogz joined #salt
21:32 shoogz joined #salt
21:46 pualj_ joined #salt
21:57 pualj joined #salt
22:21 rem5 joined #salt
22:42 aldevar left #salt
22:53 hemebond joined #salt
22:53 rem5 joined #salt
22:55 rem5 joined #salt
23:24 fracklen joined #salt
23:43 onlyanegg joined #salt
23:51 fracklen joined #salt

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