我正在Ansible中运行此pip命令
- name: Install airflow
pip: "name=apache-airflow[async,postgres] state=present"
environment:
SLUGIFY_USES_TEXT_UNIDECODE: yes
AIRFLOW_GPL_UNIDECODE: yes
但是我收到一个错误
Invalid requirement: 'apache-airflow[async'\nTraceback (most recent call last):\n File \"/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py\", line 82, in __init__\n req = Requirement(req)\n File \"/usr/local/lib/python2.7/dist-packages/pip/_vendor/packaging/requirements.py\", line 96, in __init__\n requirement_string[e.loc:e.loc + 8]))\nInvalidRequirement: Invalid requirement, parse error at \"'[async'\"
我认为通过引用点行,不会尝试分隔逗号的任何一侧。 Ansible中有没有一种方法可以逃脱逗号或以其他方式将参数列表传递到Airflow安装行中
链接到Airflow安装文档https://airflow.apache.org/installation.html
答案 0 :(得分:0)
分离命令似乎可行。
- name: Install airflow async
pip: name=apache-airflow[async] state=present
environment:
SLUGIFY_USES_TEXT_UNIDECODE: yes
AIRFLOW_GPL_UNIDECODE: yes
- name: Airflow with postgres
pip:
name: apache-airflow[postgres]
environment:
SLUGIFY_USES_TEXT_UNIDECODE: yes
AIRFLOW_GPL_UNIDECODE: yes
答案 1 :(得分:0)
只需用'\'对其进行转义。虽然没有测试。希望它能起作用。
- name: Install airflow
pip: "name=apache-airflow[async\\,postgres] state=present"
environment:
SLUGIFY_USES_TEXT_UNIDECODE: yes
AIRFLOW_GPL_UNIDECODE: yes