2

I am setting up the OpenStack system on two identical VPSs using Ubuntu 20.04 LTS with Kolla-ansible. After installing the necessary dependencies, I ran a deployment check by executing "sudo kolla-ansible -i inventory bootstrap-servers". The command was successful and returned an acceptable result, as shown below:

Bootstrapping servers : ansible-playbook -i inventory -e @/etc/kolla/globals.yml  -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  -e kolla_action=bootstrap-servers /usr/local/share/kolla-ansible/ansible/kolla-host.yml 

PLAY [Gather facts for all hosts] *****************************************************

TASK [Gather facts] *******************************************************************
ok: [compute-storage-node]
ok: [control-node]

TASK [Group hosts to determine when using --limit] ************************************
ok: [control-node]
ok: [compute-storage-node]
[WARNING]: Could not match supplied host pattern, ignoring: all_using_limit_True

PLAY [Gather facts for all hosts (if using --limit)] **********************************
skipping: no hosts matched
[WARNING]: Could not match supplied host pattern, ignoring: baremetal

PLAY [Apply role baremetal] ***********************************************************
skipping: no hosts matched

PLAY RECAP ****************************************************************************
compute-storage-node       : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
control-node               : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Afterward, I ran the command sudo kolla-ansible -i inventory prechecks and encountered an error. The complete output is quite lengthy, but the relevant section is provided below:

TASK [prechecks : Get container facts] ********************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'docker'
fatal: [compute-storage-node]: FAILED! => {"changed": false, "module_stderr": "Shared connection to compute-storage-node closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.6469145-5240-89001723359825/AnsiballZ_kolla_container_facts.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.6469145-5240-89001723359825/AnsiballZ_kolla_container_facts.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.6469145-5240-89001723359825/AnsiballZ_kolla_container_facts.py\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible.modules.kolla_container_facts', init_globals=None, run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_kolla_container_facts_payload_08qe7wec/ansible_kolla_container_facts_payload.zip/ansible/modules/kolla_container_facts.py\", line 18, in <module>\r\nModuleNotFoundError: No module named 'docker'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'docker'
fatal: [control-node]: FAILED! => {"changed": false, "module_stderr": "Shared connection to control-node closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.625407-5238-274995332860437/AnsiballZ_kolla_container_facts.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.625407-5238-274995332860437/AnsiballZ_kolla_container_facts.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ubuntu/.ansible/tmp/ansible-tmp-1683188154.625407-5238-274995332860437/AnsiballZ_kolla_container_facts.py\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible.modules.kolla_container_facts', init_globals=None, run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_kolla_container_facts_payload_fph30x3h/ansible_kolla_container_facts_payload.zip/ansible/modules/kolla_container_facts.py\", line 18, in <module>\r\nModuleNotFoundError: No module named 'docker'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP ************************************************************************************************************************************************************************************************************
compute-storage-node       : ok=6    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   
control-node               : ok=6    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   

Command failed ansible-playbook -i inventory -e @/etc/kolla/globals.yml  -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  -e kolla_action=precheck /usr/local/share/kolla-ansible/ansible/site.yml 

I have checked the both nodes, and I'm sure docker and 'docker' lib has been installed.

python3 -c "import docker; print(docker.__version__)"
6.0.1

And I have checked the python path of ansible.

ansible localhost -m setup -a 'filter=ansible_python'

[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
    "ansible_facts": {
        "ansible_python": {
            "executable": "/usr/bin/python3",
            "has_sslcontext": true,
            "type": "cpython",
            "version": {
                "major": 3,
                "micro": 10,
                "minor": 8,
                "releaselevel": "final",
                "serial": 0
            },
            "version_info": [
                3,
                8,
                10,
                "final",
                0
            ]
        }
    },
    "changed": false
}

I am currently very confused about what exactly happened. It is truly an emergency.

  • 1
    It seems `sudo pip3 install docker` makes sense. – Janson Eric May 04 '23 at 08:55
  • 1
    The `docker` library should be installed from the perspective of the `root` user. – Janson Eric May 04 '23 at 08:56
  • Thanks for sharing your solution. I've encountered the same issue for an installation that had been working for for some time, and at some point something either broke the installation of the Python `docker` module of my hosts, or the use of the module changed. Anyway, the installation of the Python docker is meant to be done by the `openstack.kolla` Ansible collection: https://github.com/openstack/ansible-collection-kolla/blob/stable/zed/roles/docker_sdk/tasks/main.yml (take care to select correct git branch/version), triggered by the `kolla-host.yml` file in kolla-ansible during bootstrap. – timss May 15 '23 at 13:27

0 Answers0