Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'db_name' is undefined error in Vagrant up /roles/db/tasks/main.yml task #193

Open
jpmjpmjpm opened this issue Oct 7, 2023 · 6 comments · May be fixed by #201
Open

'db_name' is undefined error in Vagrant up /roles/db/tasks/main.yml task #193

jpmjpmjpm opened this issue Oct 7, 2023 · 6 comments · May be fixed by #201

Comments

@jpmjpmjpm
Copy link
Contributor

Aiming at upgrading Ubuntu / python / Django and else, I'm back using this good playbook. However when running it 'as is' against a VM/Vagrant box, I got following error:

TASK [db : Ensure database is created] ***************************************
task path: ./roles/db/tasks/main.yml:35
fatal: [my-cool-app.local]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'db_name' is undefined. 'db_name' is undefined
The error appears to be in '/home/jpmerx/dev/ansible-django-stack/roles/db/tasks/main.yml': line 35, column 3, but maybe elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:\n\n\n- name: Ensure database is created\n  ^ here"}

I imagine that the root cause is that group_vars/vagrant/vars.yml variables are not taken into account.

However, I don't know why. Is there some specific thing that I have to manage on my side? Or is this a bug/regression? If the last point is true, then I can volunteer to fix it.

Thanks!

@YPCrumble
Copy link
Collaborator

@jpmjpmjpm I think there are quite a few updates to get the repo working for 22.04. @autn would you be able to make a PR here next week with the changes you made to get it working on 22.04 so we can get them into this repo?

@jpmjpmjpm
Copy link
Contributor Author

jpmjpmjpm commented Oct 7, 2023

@jpmjpmjpm I think there are quite a few updates to get the repo working for 22.04. @autn would you be able to make a PR here next week with the changes you made to get it working on 22.04 so we can get them into this repo?

@YPCrumble Thanks for your quick response. Do I understand well that the master branch of the repo is known to be currently broken?

@autn
Copy link
Contributor

autn commented Oct 10, 2023

@jpmjpmjpm do you define db_name in group_vars/[your_environment_name]/vars.yml?

@jpmjpmjpm
Copy link
Contributor Author

@jpmjpmjpm do you define db_name in group_vars/[your_environment_name]/vars.yml?

I just used the master repo without any changes.

@YPCrumble
Copy link
Collaborator

@jpmjpmjpm just had a chance to look at this. It looks like I had updated the repo for Ubuntu 22.04, but I do know that my team has had to make quite a few updates to things like RabbitMQ configuration that they will likely be able to make a PR into this repo for this week.

For your issue in particular, v2.0 of this repo is using Ansible's group_vars which you could take a look at in the Ansible documentation for managing inventory, as well as here in our README: https://github.com/jcalazan/ansible-django-stack#configuring-your-application

That's likely the source of your issue. I just made a PR to run our test suite every week; if that's passing then I believe the repo should be working as-is for Ubuntu 22.04.

You could also check this issue but I thought I had solved this problem as long as the directory structure is up to date with Ansible's group_vars: #186

Let me know if none of this leads to the solution?

@jpmjpmjpm
Copy link
Contributor Author

@jpmjpmjpm just had a chance to look at this. It looks like I had updated the repo for Ubuntu 22.04, but I do know that my team has had to make quite a few updates to things like RabbitMQ configuration that they will likely be able to make a PR into this repo for this week.

For your issue in particular, v2.0 of this repo is using Ansible's group_vars which you could take a look at in the Ansible documentation for managing inventory, as well as here in our README: https://github.com/jcalazan/ansible-django-stack#configuring-your-application

That's likely the source of your issue. I just made a PR to run our test suite every week; if that's passing then I believe the repo should be working as-is for Ubuntu 22.04.

You could also check this issue but I thought I had solved this problem as long as the directory structure is up to date with Ansible's group_vars: #186

Let me know if none of this leads to the solution?

Sorry for being late in responding!

In fact, in the past, running the command vagrant up without any change to the repo was working perfectly to provision a vanilla vagrant server. That was great to proceed from a working repo proceeding with updates. It is no longer the case, as now, we get the error I mentioned above.

Any idea how to solve that? I mean without forcing modifications to have a working tool form scratch?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants