【发布时间】:2019-08-28 10:27:43
【问题描述】:
我在使用 ansible 自动安装时遇到了一些麻烦。
我使用这个角色 (https://github.com/elastic/ansible-elasticsearch) 在我的 ubuntu 16.04 服务器上安装 elasticsearch。
角色取决于包python-jmespath,如文档中所述。
角色本身不安装包,所以我尝试在角色执行之前安装它。
- hosts: elasticsearch_master_servers
become: yes
tasks:
- name: preinstall jmespath
command: "apt-get install python-jmespath"
- name: Run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
- hosts: elasticsearch_master_servers
become: yes
roles:
- role: elastic.elasticsearch
vars:
...
运行 playbook 时,我希望在执行角色之前安装 python-jmespath 包,但角色执行失败并出现
You need to install \"jmespath\" prior to running json_query filter"
当我使用 dpkg -s python-jmespath 检查包是否手动安装时,我可以看到包安装正确。
第二次运行 playbook(已安装软件包)不会失败。
我是否错过了在 playbook 运行期间更新已安装软件包列表的 ansible 配置?
我做错了什么吗?
提前致谢
【问题讨论】:
标签: ansible ubuntu-16.04