ansible-galaxy icon indicating copy to clipboard operation
ansible-galaxy copied to clipboard

Problem to migrate an manual installation to ansible

Open bvalot opened this issue 3 years ago • 4 comments

Hi,

I'm currently working to migrate my galaxy server to ansible for simplify the migration process and have the advantage of all tools available. At this point, I follow the training part with some small modification to use my already data and database. I give the following error at step 9 of galaxy section:

TASK [galaxyproject.galaxy : Get current Galaxy DB version] ********************************************************************************* fatal: [chrono-galaxy.univ-fcomte.fr]: FAILED! => {"msg": "The conditional check 'current_db_version.rc != 0 and 'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr' failed. The error was: error while evaluating conditional (current_db_version.rc != 0 and 'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr): 'dict object' has no attribute 'stderr'"}

My old installation was 21.09 galaxy version and I try to install the 22.01 with ansible with a fresh galaxy root and venv.

Thanks in advance, Benoit

bvalot avatar Aug 30 '22 07:08 bvalot

I advance on this bug. I have add DEBUG and verbosity to ansible-playbook and get this error: {"rc": 13, "cmd": "/srv/galaxy/venv/bin/python /srv/galaxy/server/scripts/manage_db.py -c /srv/galaxy/config/galaxy.yml db_version", "failed": true, "msg": "[Errno 13] Permission non accord\u00e9e: b'/srv/galaxy/venv/bin/python'", "exception": " File \"/tmp/ansible_ansible.legacy.command_payload_i7vb68dg/ansible_ansible.legacy.command_payload.zip/ansible/module_utils/basic.py\", line 2726, in run_command\n cmd = subprocess.Popen(args, **kwargs)\n File \"/usr/lib/python3.9/subprocess.py\", line 951, in __init__\n self._execute_child(args, executable, preexec_fn, close_fds,\n File \"/usr/lib/python3.9/subprocess.py\", line 1823, in _execute_child\n raise child_exception_type(errno_num, err_msg, err_filename)\n", "invocation": {"module_args": {"chdir": "/srv/galaxy/server", "_raw_params": "/srv/galaxy/venv/bin/python /srv/galaxy/server/scripts/manage_db.py -c /srv/galaxy/config/galaxy.yml db_version", "warn": true, "_uses_shell": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "executable": null, "creates": null, "removes": null, "stdin": null}}}

Seems the problem is due to the fact that the galaxy server was built with the root user instead of the galaxy user. My current playbook look like this:

---
- hosts: galaxyservers
  become: true
  vars_files:
    - group_vars/secret.yml
  pre_tasks:
    - name: Install Dependencies
      package:
        name: ['acl', 'bzip2', 'git', 'make', 'python3-psycopg2', 'tar', 'virtualenv']
  roles:
    - galaxyproject.postgresql
    - role: natefoo.postgresql_objects
      become: true
      become_user: postgres
    - geerlingguy.pip
    - galaxyproject.galaxy
    - role: uchida.miniconda
      become: true
      become_user: "{{ galaxy_user.name }}"

bvalot avatar Aug 30 '22 13:08 bvalot

if I had this option to galaxyserver.yml variables, the playbook run without error: galaxy_privsep_user: {name: galaxy, shell: /bin/bash}

bvalot avatar Aug 30 '22 14:08 bvalot

Are you trying to use privilege separation mode (where the code is installed as a different user from the one that runs Galaxy)? If not, then setting galaxy_privsep_user should not be necessary, but you'll need to make sure that you have set become_user or remote_user appropriately when running galaxyproject.galaxy.

natefoo avatar Aug 31 '22 16:08 natefoo

The ansible playbook is run with my account with sudo privilege. All is done locally in one serveur. I want that galaxy serveur and database is run with the galaxy user that have not root privilege.

I have activate galaxy_separate_privileges: true, but it is not sufficient to work without change galaxy_privsep_user to galaxy user

bvalot avatar Sep 01 '22 07:09 bvalot