Defaults section in vars when designing a role

Hi,

I’m trying to design a relatively generic role for managing AWS Elastic Beanstalk applications. Because some of the configuration options need to be the same across a few environments I’d like to have a place towards the top level of the vars file that contains these. I have something working [1] but the tasks file is very verbose. Specifically, the following seems very verbose.

instance_type: “{{ item.1.rds_instance_type|default(eb.defaults[item.1.defaults].rds_instance_type)|default(omit) }}”

Is this a common pattern when writing reusable Ansible roles?
If not, how is this kind of problem usually addressed?
Also, are there any other problems you can see with either file?

Thanks,
Rob

[1] https://gist.github.com/anonymous/bf4fdd7172b6f6588af2

Hi Rob,

I don’t think there’s anything overly verbose about that. You could use the defaults/main.yml file to put defaults in, rather than using the default() method you’re using, but that depends on what you’re trying to do to a degree and might not work since you’re using with_subelements.

Hope that helps some.