繁体   English   中英

从另一个版本重新安装deb软件包

[英]Reinstall deb package from another release

我需要从另一个目标版本中重新安装软件包。 问题是,如果已安装软件包,则不会采取任何措施。 我的剧本片段是:

- name: Add jessie-backports repo
  apt_repository:
    repo: 'deb http://httpredir.debian.org/debian jessie-backports main'
    state: present

- name: install libssl from jessie-backports
  apt:
    name: libssl1.0.0
    default_release: jessie-backports

答案是:

ptmp3 | SUCCESS => {
    "cache_update_time": 1493744770, 
    "cache_updated": true, 
    "changed": false, 
    "invocation": {
        ....
    }
}

我可以在安装新版本之前删除旧版本,但是整个软件包都取决于libssl (例如ssh )。

Btw命令apt-get install libssl1.0.0 -t jessie-backports在远程主机上运行,​​并且libssl已更新

解决方案是在apt任务中包括要安装的软件包的确切版本。 可以通过apt-cacheapt-cache policy libssl1.0.0 )检索确切的版本。

适当的剧本块是:

- name: Add jessie-backports repo
  apt_repository:
    update_cache: yes
    repo: 'deb http://httpredir.debian.org/debian jessie-backports main'
    state: present

- name: get libssl1.0.0 jessie-backports version
  shell: apt-cache policy libssl1.0.0 | grep jessie-backports -B1 | head -n1 | sed -e 's/^\s*\**\s*\(\S*\).*/\1/'
  register: libsslinstalled

- name: install libssl from jessie-backports
  apt:
    name: "libssl1.0.0={{ libsslinstalled.stdout_lines[0] }}"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM