Hi,
I am wanting to use the environment
task parameter with dictionaries taken from two roles, e.g.
in roles/ruby/vars/main.yml
:
ruby_environment:
GEM_HOME: "/home/deploy/.gem/ruby/2.1.2"
PATH: "/home/deploy/.gem/ruby/2.1.2/bin:/opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/bin:/opt/rubies/ruby-2.1.2/bin"
in roles/rails/tasks/main.yml
, I am wanting to do something like this:
- name: execute bundler
command: bundle install --deployment
environment:
"{{ ruby_environment }}" merged with "RAILS_ENV: production"
Is this possible?
Thanks,
Steve
To add: would prefer not to use hash_behaviour = merge if possible.
--To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f2468b4d-0e07-401e-8f95-fe40405d4fc7%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c901cda8-bcf5-4e15-a576-73adeb965e1e%40googlegroups.com.
dict1 + dict2I also have an update to 'set theory' that will allow you to do dict1|union(dict2)
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CADn%2BHswCwhz%2B7c%2Bn8f2jdRm0-1%2BDjp6Rqrt%2BgYyXThTauGfMNg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5bbe2eda-80db-438a-b5a8-0eef1561df98%40googlegroups.com.
I could swear I had patched the union filter to use update when dicts were passed in, let me try this again.
Brian Coca
I think your filter plugin could be more easily written:hash_a.update(hash_b)perhaps?If you send in a pull request, this seems reasonable to have as a core filter.I'd probably call it 'update' if I'm correct on the above, which I think I am. If not, perhaps "merge".
def update(dic, odic):
dic.update(odic)
return dic
class FilterModule(object):
def filters(self):
return {
'update': update,
'update_dict': update,
'merge_dict': update
}
there is a hash_merge PR pending but it won't make it into 1.9.