19:02:26 #startmeeting ansible core irc public meeting 19:02:26 Meeting started Tue Jun 25 19:02:26 2019 UTC. 19:02:26 This meeting is logged and archived in a public location. 19:02:26 The chair is bcoca. Information about MeetBot at http://wiki.debian.org/MeetBot. 19:02:26 Useful Commands: #action #agreed #halp #info #idea #link #topic. 19:02:26 The meeting name has been set to 'ansible_core_irc_public_meeting' 19:02:30 o/ 19:02:36 hello 19:02:36 o/ 19:02:37 \o 19:02:48 #topic to fact or not to _info 19:02:58 https://github.com/ansible/community/issues/474#issuecomment-504782354 19:03:10 * cyberpear lurks 19:03:24 hi! 19:03:39 about topic: I 19:04:03 I'm wondering what's the best way to proceed with _facts modules which return ansible_facts, but should not be _facts modules 19:04:50 there are two options: return both ansible_facts and info in another way, and deprecate ansible_facts (will get nicer if return values can effectively deprecated, that's WIP for 2.9, but the output will double) 19:05:02 rename them and phase out returning of ansible_facts on the same timeline as the old name goes away 19:05:06 i would deprecate module in favor of new copy with 'non facts' 19:05:09 the other is to deprecate the _facts module, and add a new _info module which will return the information not as ansible_facts 19:05:25 cyberpear: rename either chagnes existing behaviour or perpetuates it 19:05:34 fair enough 19:06:08 just put a comment in the top of the file that says "this was copied from _facts" so folks trawling git history can find it 19:06:30 felixfontein: we have a feature we want (but still vaporware) that would allow to deprecate return values, but i think we should not wait for it and go with B option 19:06:32 I'd add something like that to the module's documentation, so people reading the docs (as opposed the code) will also know 19:06:50 +10K to 'docs telling teh full story' 19:07:12 The other issues with duplicate/modify is that "full test" overhead now increases significantly 19:07:20 nitzmahone: also maintenance 19:07:33 I added something like that to all _facts -> _info renames I made, something like "The module was called xxx_facts until 2.9. The usage didn't change.", but that of course only applies to modules which never returned ansible_facts in the first place 19:07:45 Azure folks just went for rename + alias + deprecate `ansible_facts` 19:08:01 nitzmahone: w/o deprecation msg? 19:08:22 On a related note: what are we doing at 2.9 release to things still named _facts? 19:08:33 testing is a good point. we could simply change the tests to only use the new modules, and keep the old ones untested. but I'm not really happy about that 19:08:36 (eg "abandoned" modules) 19:08:39 ^ felixfontein has been renameing those, that is why he brought up this point 19:08:56 Ah, wasn't sure if it was in relation to a small subset 19:09:05 I only renamed ones which didn't return ansible_facts so far 19:09:07 he has taken point and done a lot of work already 19:09:10 felixfontein++ 19:09:23 If maintainers *want* to use it as a chance to reset the UI, new module makes sense, but otherwise it seems like a lot more work to duplicate 19:09:26 (or tried to push the maintainers to do it, in case of google and azure modules) 19:09:41 how many modules are we talking about? 19:10:01 several hundred I think 19:10:08 Ugh. 19:10:12 *cringe* 19:10:29 everything in cloud/ which is still called _facts (and not part of vmware, google and azure) 19:10:37 and some more 19:10:37 i was going to say 'case by case' ... but we'll be here till sun goes nova 19:10:57 yes. already "just" renaming them all is a lot of work 19:11:09 im still partial to B .. but at this point 'anything that gets us there' 19:12:38 I agree we should avoid unnecessary copying, to avoid having either untested modules or an unnecessary increase in test overhead (and maintenance in general). 19:12:39 if you rename, can you have the module detect whether it was called w/ `_facts` name and only return facts in that case? 19:12:58 If we go with the bulk rename, I'll take the task to go add the deprecation warnings on all "ansible_facts"-returning things once I merge the dep warnings on retvals support 19:13:07 cyberpear: yes you can detect the name. I'm using that to issue a warning that the module has been renamed 19:13:15 nitzmahone: how far are we from that ? 19:13:41 cyberpear: you get module_name parameter 19:13:50 I have the dep warnings stuff working, just some performance enhancements to dedupe the metadata in ser/deser and figuring out WTH to do with `AnsibleVaultUnicodeText` 19:14:02 which is really 'action called', so ti does not always match either old/new name i.e copy when used from template 19:14:11 nitzmahone: do you already have a PR? 19:14:23 Nah, still just local right now 19:14:54 nitzmahone: push wip, i might be able to help you with vault stuff 19:14:55 We could also enforce the filtering in the default action 19:15:07 (in addition, I mean) 19:15:29 nitzmahone: execute_module might be better place, since you can bypass the normal action in many cases 19:15:34 e.g gather_facts 19:15:50 Yeah, I meant in ActionBase 19:17:15 so how long? 19:17:26 cause i dont think A is feasable w/o that code 19:17:38 well, its feasable, but really bad user experience 19:18:15 I can probably have an e2e working thing ready this week or next 19:18:32 Just gotta ignore some other things :) 19:18:36 felixfontein: that work fo ryou? 19:18:48 sure, fine for me 19:18:58 I'm somewhat busy this week anyway 19:19:15 You want to wait for that to be merged before you proceed with the renames then? 19:19:17 k, so i think we are going option A for now (if nitz can get feature in) 19:19:23 we might want to revisit next month? 19:19:42 It's basically the only 2.9 feature I have slated, everything else is playing with future release fun 19:19:46 nitzmahone: w/o your feature, a new module is a better option 19:20:38 Yep, one of the reasons I put it on the roadmap 19:20:56 another is for me tore move 'ansible facts injection!' 19:21:01 People can still do new modules if they *want* to, but I think the default should be rename + deprecate 19:21:02 s/remove/change the default/ 19:21:09 yep 19:21:26 k, so tabling this decision contingent on nitzmahone's feature being merged. 19:21:38 #topic ansible_facts in loops 19:21:46 https://github.com/ansible/community/issues/474#issuecomment-505235184 19:22:04 nitzmahone: that would change behaviour of include_vars: '{{item}}' 19:22:35 also, afaik the loop facts are always merged 19:22:37 Not necessarily- that and 'set_fact' have their own conditional separate from "everything else" 19:22:41 They aren't 19:23:05 They're merged after the task completes, but each iteration of the loop replaces the local value set by the last one 19:23:13 hmm only for include_vars/set_fact (both come up as examaples that they do) 19:23:16 ? 19:23:32 ah, yes, interloop they are not, they are merged at final result 19:23:35 Right 19:23:38 That's the problem 19:24:04 So either I have to treat discovery result "special" or we need to merge inside the loop 19:24:08 do we really need to merge all facts or just discovery? 19:24:33 for now i would do just discovery, as the other change has many implications we might not see right now (but im sure they'll break playbooks) 19:24:37 Doesn't really matter- it's only merging with its own results, not the full var space 19:24:55 but now it affects behaviour of loop if loop depends on them 19:25:01 This is a *really* corner case 19:25:09 ansible_os_distribution .... 19:25:35 This wouldn't affect individual loop result accessibility, only the internal storage of the merged result (which isn't visible to playbooks) 19:25:59 how not? that is used to template each loop iteration 19:26:13 and passed to each task (action/module) 19:26:41 https://github.com/ansible/ansible/blob/devel/lib/ansible/executor/task_executor.py#L686 19:27:16 yes, that is done so EACH loop iteraction can do 'post result processing' failed_when/changed_when/notify/etc 19:27:24 This is for the "outer" copy- conditionals etc can still see the individual results per iteration, we're not changing that. This is basically what gets merged with the rest of vars when the task is done 19:27:49 b;ut the 'outer' is what is then entered back into loop to retemplate task/conneciotn/shell/become/etc 19:27:56 The only time you'd see a difference is if you called a facts module in a loop and it returned different keys 19:28:13 or you had facts and loop changes + updates them 19:28:16 (across iterations) 19:28:19 e.g hostname 19:28:52 though i imagine only time this would actually bite us is doing package/dist upgrades 19:29:07 Basically this would make the behavior consistent if you called the module N times manually and in a loop 19:29:37 Right now, loop only "keeps" the last value of ansible_facts returned, where calling it N times manually, it merges 19:29:41 but they are not meant to be the same 19:29:55 loops have more data than 'successive tasks' 19:30:37 also that line affects not only with_/loop, but retry/until 19:30:39 Intra-loop, the observable behavior would be exactly the same, unless different keys were returned, in which case you'd "see" the old keys (where today you wouldn't, unless you're accessing the current result) 19:30:56 i expect diff keys can happen in retry/until 19:31:21 even in normal loop, for momdules that both make changes and return the results as facts 19:31:21 Which I still can't see a problem with... 19:31:24 (or because of modules returning strange stuff in ansible_facts, like docker_service) 19:31:46 hostname is best example i have, but i know others do same, they make a change and return 'updated facts' 19:31:57 Right, but still the same keys, right? 19:32:17 Same keys will not result in any observable change 19:32:27 diff values, which if conditional on value, changes behaviour of iteration (hostname is bad example here. but something like parted/mount might be more important) 19:33:00 Different keys will still show the "newest" values associated, it's just that the previous keys that don't appear in the new result will *also* be present (as if you'd run the module by manually N times) 19:33:15 e.g if ansible_mounts['x'] == 'efs2', now loop runs on contion being same since start, change would make it variable per iteration 19:33:17 The value behavior will be indistinguishable for the same keys 19:33:50 keys only matter in that their value changes 19:34:23 Today, it replaces the entire `ansible_facts` dict on each run, I just want to merge it 19:34:31 no, it wont, same key=value would stay same, diff vlaues for same key could change behaviour current is 'value is same as before task started', change, value depends on last iteration 19:34:31 And the values will still change 19:34:52 they change on result side 19:35:01 for post,not for pre, you wantto make it reentrant 19:35:36 They will be exactly the same on the result side as they are today, except that the set of visible keys will increase if the keys change during iteration 19:35:56 again, keys really dont matter, its the values 19:36:08 also now you need to handle merge_behaviour? 19:36:21 How else can I say: "the values will be exactly the same as they are today?" 19:36:42 I'd make it behave the same way as the current ansible_facts merge that occurs 19:36:52 then i have no clue what you are saying, since key/val needs to change to make it reentrant 19:37:08 There's nothing about concurrency or reentrancy here 19:37:22 you want to persist facts over iterations 19:37:30 which currently they are not 19:37:33 I'll just PR it 19:37:43 Feel free to poke holes in it there 19:37:50 ok, seeing code might clarify what you mean, cause right now im lost to yoru meaning 19:39:29 #topic open floor 19:40:58 k if nothing new closing in 1min 19:42:00 #endmeeting