When you run the ansible-playbook, what about prefixing the command with ANSIBLE_ROLES_PATH.
For example: ANSIBLE_ROLES_PATH=your_path ansible-playbook site.yml On Tuesday, November 22, 2016 at 2:25:08 PM UTC-5, [email protected] wrote: > > Ok so I ended up rolling back to playbooks in the top level directory. > > I got myself turned around a bit here. The {{roles_path}} as part of the > include actually wasn't working; which, I should have known since you can't > use ansible.cfg parameters in tasks like that. I think my main problem is > that I'm using 'include' statements to include roles during plays. In this > way, I function them out as reusable functions for different roles. I was > warned that this is a nonstandard, in favor of meta dependencies. I think > that's coming back to bite me now. > > Sample: > - name: database param_def select > # Initial select statement to see if db changes are required > tags: db > include: roles/role_utility_sqlplus/tasks/main.yml > vars: > query_type: "select" > table: "param_def" > filename: "dbselect_paramdef_mhe.sql" > > > > > On Tuesday, November 22, 2016 at 12:53:02 PM UTC-6, [email protected] wrote: >> >> Thanks for the info! I tried this in my own environment, since I actually >> had a similar question before. >> >> Moved playbooks to a playbooks dir. Set role_path=./roles. This broke my >> include statements, which I now modified to '- include: "{{ roles_path }} >> /role_handlers_ant/handlers/main.yml"'. This is likely a better practice >> anyway. >> >> However, it seems that my plays can no longer find my group_vars and >> other such objects. Basic structure is below: >> ansible.cfg >> .ansible/inventory >> playbooks/ >> pb.yml >> roles/ >> # roles... >> host_vars/ >> # host_vars... >> group_vars/ >> # group_vars... >> >> Should host and group vars also be moved? They worked fine before I moved >> playbooks from top level dir to their own dir. >> >> Specifically, the error I get now is below. This is a variable defined in >> a group_vars. >> >>> fatal: [ptl01a0fap006]: FAILED! => {"failed": true, "msg": "The >>> conditional check ''{{ ansible_user_id }}' != '{{ wmadmin }}'' failed. The >>> error was: error while evaluating conditional ('{{ ansible_user_id }}' != >>> '{{ wmadmin }}'): 'wmadmin' is undefined\n\nThe error appears to have >>> been in '/manh/roles/role_utility_preplay_validation/tasks/main.yml': line >>> 2, column 3, but may\nbe elsewhere in the file depending on the exact >>> syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Ensure >>> uid is appropriate for {{ inventory_hostname_short }}\n ^ here\nWe could >>> be wrong, but this one looks like it might be an issue with\nmissing >>> quotes. Always quote template expression brackets when they\nstart a >>> value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be >>> written as:\n\n with_items:\n - \"{{ foo }}\"\n"} >> >> >> Thanks >> > -- 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/f280f4c8-990e-431b-a05a-e4814b8a67e0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
