我正在配置一个mesos马拉松集群。我还有下一个角色要安装java和mesos。
---
- name: importar key Mesosphere
  shell: gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E56151BF
- name: ppa java8
  apt_repository: repo='ppa:webupd8team/java' state=present
- name: seleccionar licencia Oracle
  shell: echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
- name: actualizar
  apt: update_cache=yes
- name: instalar java8
  apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
- name: actualizar sources list
  shell: DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]') && CODENAME=$(lsb_release -cs) && echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list
- name: actualizar paquetes
  apt: update_cache=yes cache_valid_time=3600
- name: instalar mesos
  apt: name=mesos state=present install_recommends=yes force=yes
- name: instalar mesosphere
  apt: name=mesosphere state=present install_recommends=yes force=yes我的问题是,当我执行剧本时,它会给我下一个错误:
TASK [common : actualizar sources list] ****************************************
changed: [172.16.8.191]
TASK [common : actualizar paquetes] ********************************************
ok: [172.16.8.191]
TASK [common : instalar mesos] *************************************************
fatal: [172.16.8.191]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'mesos' is available"}
PLAY RECAP *********************************************************************
172.16.8.191               : ok=8    changed=5    unreachable=0    failed=1

但是,如果我第二次执行ansible,它将完美地工作,您可以看到第二次执行:
TASK [common : actualizar paquetes] ********************************************
ok: [172.16.8.191]
TASK [common : instalar mesos] *************************************************
changed: [172.16.8.191]
TASK [common : instalar mesosphere] ********************************************
changed: [172.16.8.191]

有什么问题吗?
谢谢。
@ydaetskcoR解决方案
更改任务“分期付款”:
- name: instalar mesos
  apt: name=mesos state=present install_recommends=yes update_cache=yes force=yes发布于 2016-02-08 15:58:34
您遇到的问题是,如果上次更新是一个多小时前的话,actualizar paquetes任务只执行一个apt-get update来刷新回购列表。
考虑到您只是在前面的任务中添加了Mesos,那么您将无法找到包。重新运行剧本会在没有actualizar设置之前触发cache_valid_time任务,因此会强制使用apt-get update,这将允许您使用上次运行游戏时添加的Mesos。
要修复它,只需将cache_valid_time从actualizar paquetes任务中删除。
正如注释中提到的,您还可以将update_cache仅apt任务移动到实际安装包的主apt任务中,Ansible将在apt-get install之前运行apt-get update。
https://stackoverflow.com/questions/35227363
复制相似问题