IRC Logs for #crimsonfu Friday, 2018-09-21

*** chasmo77 has quit IRC10:25
*** chasmo77 has joined #crimsonfu10:25
*** chasmo77 has quit IRC10:28
*** chasmo77 has joined #crimsonfu10:29
pdurbinHas anyone here used --extra-vars with Ansible?14:38
beneyes19:38
pdurbinDo you have to put variables in curly braces like this? {{foo}}19:39
beneno19:41
benewell, not on the commandl ine19:41
beneansible-playbook -e 'foo=bar'19:41
benein the yaml, your vars need braces... some of the time19:42
beneansible will usually tell you when it's wrong, although the error message can be misleading19:42
beneansible-lint will usually catch that stuff and tell you also19:43
pdurbinonly some of the time in the yaml?19:44
beneas an e.g. a 'when: foo' conditional does not take the var in braces19:45
beneif it's working, then i wouldn't worry about it19:45
benethere's no points for yaml style :-)19:45
pdurbinPlease take a look at https://github.com/IQSS/dataverse-ansible/commit/eb29ab619:45
benethat looks okay provided you want the play to bomb out if those vars are not set19:46
beneif this is for general consumption/usage, it's probably friendlier to check for missing/unset vars and explicitly tell the user that they have to set them to use the playbook19:47
beneso you can have tasks/main.yml include a tasks/requirements.yml with checks for missing vars and have it bomb out before making any changes at all if they're not set19:48
beneand since you are writing plays that check and fail, you can customize the message:19:49
benehttps://docs.ansible.com/ansible/2.6/modules/fail_module.html19:49
pdurbinThis just in. I'm hearing that the problem is the nesting.19:52
beneah19:53
beneso -e '{"git":{"branch": "foo", "repo": "bar" }}'19:55
beneor something like that19:55
benebut it's ugly19:55
benegit_repo and git_branch would be cleaner :-)19:57
benei use a lot of underscores in my ansible variable names19:57
benehttps://github.com/bpeisenbraun/ansible-role-rsnapshot/blob/master/defaults/main.yml19:58
pdurbinI did try passing JSON in like that but it didn't work. I had to add the curly braces with nested variables. To target them, I guess. I dunno.20:02
pdurbinbene: no nesting in your yaml. ok. thanks20:02
*** chasmo77 has quit IRC23:35
*** chasmo77 has joined #crimsonfu23:36

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!