Roles having a defaults/main.yml will have, in that file, variables that are lower priority than basically anything in Ansible - including inventory.
Variables in vars/ are going to be used. It seems the confusion is the use of "vars/" instead of "defaults/". (In either case, this is a matter of overriding things - precedence - not OO inheritance) On Sun, Sep 7, 2014 at 5:42 PM, Mike Bell <[email protected]> wrote: > Hi, > > I'm trying to override some default variables in a rolebook that I'm using > from ansible galaxy. In my playbook I have the following: > > --- > - hosts: all > vars_files: > - "vars/main.yml" > tasks: > - name: Update apt cache if needed. > apt: update_cache=yes cache_valid_time=3600 > roles: > - { role: geerlingguy.apache } > > > and in my vars/main.yml I have the following: > > apache_listen_port: 80 > apache_packages: > - apache2 > > > The apache_packages var is defined in the rolebook under /vars > > When I run the provision (through vagrant) it still reads the default vars > from the role and not my override. I'm still new to ansible but read the > documentation on variable inheritance which says this should be possible. > > I'm not really sure what I'm doing wrong, any pointers would be greatly > appreciated. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/e160737b-e671-4d82-8742-951c04500894%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/e160737b-e671-4d82-8742-951c04500894%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgx3G2WXjrbBhxOAFGY%2BUGkODCOgYyouXXZVgdgU%2BCS6bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
