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

Fails when installing packages #391

Open misilot opened 8 months ago

misilot commented 8 months ago

This task is failing when trying to install with the following task https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.15.x/tasks/install-packages.yml#L8-L13

This is on Ubuntu 22.04LTS

TASK [artefactual.archivematica-src : Install/Upgrade Debian packages: Ansible dependencies] *****

fatal: [test-arc22]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_change_held_packages": false,
            "allow_downgrade": false,
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "clean": false,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "fail_on_autoremove": false,
            "force": false,
            "force_apt_get": false,
            "install_recommends": null,
            "lock_timeout": 60,
            "name": [
                "acl",
                "python3-pycurl",
                "python3-setuptools",
                "git",
                "python3-mysqldb",
                "sqlite3",
                "ca-certificates"
            ],
            "only_upgrade": false,
            "package": [
                "acl",
                "python3-pycurl",
                "python3-setuptools",
                "git",
                "python3-mysqldb",
                "sqlite3",
                "ca-certificates"
            ],
            "policy_rc_d": null,
            "purge": false,
            "state": "{'code': 16, 'name': 'running'}",
            "update_cache": null,
            "update_cache_retries": 5,
            "update_cache_retry_max_delay": 12,
            "upgrade": "no"
        }
    },
    "msg": "value of state must be one of: absent, build-dep, fixed, latest, present, got: {'code': 16, 'name': 'running'}"
}

For some reason the status is getting {'code': 16, 'name': 'running'} instead of another value.

Is state defined somewhere else? I tried greping but did not see it.

Adding state: latest to https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.15.x/tasks/main.yml#L122-L128 seemed to have fixed it at least for us locally.

Also had to add it to this file https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.15.x/tasks/ss-osdeps.yml#L66-L75

Now stuck on this step

TASK [artefactual.archivematica-src : Create virtualenv and install pip-tools] ***************************************************************************************************************************************
fatal: [test-arc22]: FAILED! => {"changed": false, "cmd": ["/usr/share/archivematica/virtualenvs/archivematica-storage-service/bin/pip3", "install", "pip==21.3.1", "pip-tools==6.4.0"], "msg": "\n:stderr: Could not find platform independent libraries <prefix>\nCould not find platform dependent libraries <exec_prefix>\nConsider setting $PYTHONHOME to <prefix>[:<exec_prefix>]\nFatal Python error: Py_Initialize: Unable to get the locale encoding\nModuleNotFoundError: No module named 'encodings'\n\nCurrent thread 0x00007fc916c74740 (most recent call first):\n"}
misilot commented 8 months ago

another place I needed to adjust

https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.15.x/tasks/pipeline-osdeps.yml#L99-L115

re: the virtualenv step above.

I just deleted everything in the virtualenv directory, figuring Ansible will recreate it

mamedin commented 8 months ago

Sorry, we should use a different variable name, instead "state"

In your inventory or playbooks you have defined:

state:
  - code: 16
    name: "running"

And when calling the following, it is not using the default value (latest)

https://github.com/artefactual-labs/ansible-archivematica-src/blob/stable/1.15.x/tasks/install-packages.yml#L8-L13

That's the reason because it fails to you and it works for us.

We are going to change that variable name, and set less generic one.

misilot commented 8 months ago

Hmm, I can't find anything in my inventory or playbook that defines: "state", "16" or "running"

misilot commented 8 months ago

Ok, so I found it. It looks like it's coming from the aws_ec2 inventory plugin we use

https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html

or more specifically the awscli https://github.com/aws/aws-cli/blob/develop/awscli/examples/lightsail/get-instance.rst you can see the state variable defined as an example :(