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

can not run master #203

Closed
undefinedd opened this issue May 16, 2020 · 5 comments
Closed

can not run master #203

undefinedd opened this issue May 16, 2020 · 5 comments

Comments

@undefinedd
Copy link

undefinedd commented May 16, 2020

docker ubuntu 18.04,all dependencies are installed.
when run ansible-playbook master.yml -u root --private-key=/root/.ssh/id_rsa
i get error

TASK [common : Setup ufw SSH. rule=allow, port={{ sshd_port }}, proto=tcp, comment=ssh] *********************************************
[WARNING]: The value 22 (type int) in a string field was converted to '22' (type string). If this does not look like what you
expect, quote the entire value to ensure it does not change.
fatal: [34.80.60.205]: FAILED! => {
    "changed": false,
    "commands": [
        "/usr/sbin/ufw status verbose"
    ]
}

MSG:

ERROR: problem running iptables: iptables v1.6.1: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.

He seems to say that I am not the root user, but I did specify the root user

@derpadoo
Copy link
Contributor

Hi @undefinedd - thanks for taking the time to submit a ticket. I just started working on the agent Docker container (#78) and haven't touched the Master one yet.

Are you running Ansible from a shell within the container? Or running Ansible from the host and connecting to the container via ssh?

Right now, my only thought / suggestions is to:

  • Disable / comment out the ufw portions of the Ansible playbook, since network access will be determined when the container is run through Docker port forwards (-p)

@undefinedd
Copy link
Author

OK. I do use docker but I use the host now.
python version: Python 3.6.9
when i run python3 manage.py runserver I got error :
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
then i run cat ansible-playbooks/roles/master/templates/production.py.j2 > master/config/setting/production.py
i get error:

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/core/management/init.py", line 345, in execute
settings.INSTALLED_APPS
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/conf/init.py", line 76, in getattr
self._setup(name)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/conf/init.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "/home/ubuntu/.local/lib/python3.6/site-packages/django/conf/init.py", line 142, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/ubuntu/scantron/master/config/settings/production.py", line 4, in
from .base import * # noqa
File "/home/ubuntu/scantron/master/config/settings/base.py", line 10, in
import environ
File "/home/ubuntu/.local/lib/python3.6/site-packages/environ.py", line 114
raise ValueError, "No frame marked with %s." % fname
^
SyntaxError: invalid syntax

@derpadoo
Copy link
Contributor

Take another look at the installation documentation, the initial_setup.sh script will populate SECRET_KEY: https://github.com/rackerlabs/scantron#ansible-deployment-server-and-initial-setup

python3 manage.py runserver doesn't need to be run manually and cat-ing out ansible-playbooks/roles/master/templates/production.py.j2 into master/config/setting/production.py won't work because it is a Jinja2 template (https://docs.ansible.com/ansible/latest/user_guide/playbooks_templating.html#templating-jinja2) that has specific fields filled out with Ansible:

image

@derpadoo
Copy link
Contributor

Hi @undefinedd - been playing around with trying to get Master deployted in a container using Ansible. Not completely there yet (or certain that this is the right direction), but had to add the --privileged for ufw-related stuff and --volume /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro for setting the timezone.

@derpadoo
Copy link
Contributor

Going to close this one out for now @undefinedd I can re-open if you are still experiencing issues with it.

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

No branches or pull requests

2 participants