@
rooftop64 Ansible playbook:
- name: check that poetry command exists
stat: path=/root/.poetry/bin/poetry
register: _poetry_executable
- name: download the poetry installer
get_url:
url:
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py dest: /tmp/
get-poetry.py when: _poetry_executable.stat.exists == false
- name: run the poetry installer
command: /usr/bin/python3 /tmp/
get-poetry.py -y
when: _poetry_executable.stat.exists == false
- name: install specific poetry version
command: /root/.poetry/bin/poetry self update 1.1.8
environment:
VIRTUAL_ENV: /opt/virtualenvs/{{ project_name }}
tags:
- git_update
- name: install project python dependencies using poetry
environment:
VIRTUAL_ENV: /opt/virtualenvs/{{ project_name }}
command: /root/.poetry/bin/poetry install
args:
chdir: /opt/{{ project_name }}
tags:
- git_update
Error msg:
TASK [celus : install project python dependencies using poetry] *******************************************************************************************************
fatal: [47.243.249.94]: FAILED! => {
"changed": true,
"cmd": ["/root/.poetry/bin/poetry", "install"],
"delta": "0:00:00.770595",
"end": "2025-03-13 09:09:32.128918",
"msg": "non-zero return code",
"rc": 1,
"start": "2025-03-13 09:09:31.358323",
"stderr": "
RuntimeError
The Poetry configuration is invalid:
- Additional properties are not allowed ('package-mode' was unexpected)
at ~/.poetry/venv/lib64/python3.6/site-packages/poetry/core/
factory.py:45 in create_poetry
41│ message = \"\"
42│ for error in check_result[\"errors\"]:
43│ message += \" - {}\\n\".format(error)
44│
→ 45│ raise RuntimeError(\"The Poetry configuration is invalid:\\n\" + message)
46│
47│ # Load package
48│ name = local_config[\"name\"]
49│ version = local_config[\"version\"]
",
"stderr_lines": [
"",
" RuntimeError",
"",
" The Poetry configuration is invalid:",
" - Additional properties are not allowed ('package-mode' was unexpected)",
" ",
"",
" at ~/.poetry/venv/lib64/python3.6/site-packages/poetry/core/
factory.py:45 in create_poetry",
" 41│ message = \"\"",
" 42│ for error in check_result[\"errors\"]:",
" 43│ message += \" - {}\\n\".format(error)",
" 44│ ",
" → 45│ raise RuntimeError(\"The Poetry configuration is invalid:\\n\" + message)",
" 46│ ",
" 47│ # Load package",
" 48│ name = local_config[\"name\"]",
" 49│ version = local_config[\"version\"]"
],
"stdout": "",
"stdout_lines": []
}
Poetry pyproject.toml
https://github.com/techlib/celus/blob/master/pyproject.toml