artefactual-labs / ansible-archivematica-src

An ansible role for deploying Archivematica from from its source code repositories
GNU Affero General Public License v3.0
5 stars 21 forks source link

Problem: Role fails when not defining SS api key in am-configure (vagrant deploy) #311

Open mamedin opened 3 years ago

mamedin commented 3 years ago

Error in vagrant deploy:

TASK [artefactual.archivematica-src : Get SS API Key] **************************
fatal: [am-local]: FAILED! => {"changed": false, "module_stderr": "sudo: se requiere una contraseña\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP *********************************************************************
am-local                   : ok=213  changed=133  unreachable=0    failed=1    skipped=174  rescued=0    ignored=3   
mamedin commented 3 years ago

The deploy-pub commits fix the issue for the deploy-pub deploys, but it is a workaround.

The following task doesn't work fine when using vagrant (port 2222 and its ssh key):

- name: "Get SS API Key"
  shell: >
    echo "select \`key\` from tastypie_apikey where id in (select id from auth_user where username = '{{ archivematica_src_configure_ss_user }}');"
    | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1
  args:
    chdir: "{{ archivematica_src_ss_app }}"
    executable: /bin/bash
  environment: "{{ archivematica_src_ss_environment }}"
  delegate_to: "{{ archivematica_src_configure_ss_url|urlsplit('hostname') }}"
  become: yes
  remote_user: "{{ archivematica_src_configure_ss_ssh_user | default('artefactual') }}"
  register: archivematica_src_configure_ss_api_key_temp
  when: 
     - "archivematica_src_configure_dashboard|bool or archivematica_src_configure_ss|bool"
     - "archivematica_src_configure_ss_api_key is undefined"

So we should check this task, especially the delegate_to directive. It only should be used when SS is in a separate VM.