2017-05-02 7 views
0

別のターゲットリリースからパッケージを再インストールする必要があります。問題は、パッケージがすでにインストールされている場合、何もしないということです。別のリリースからdebパッケージを再インストール

- 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 

とansible答えは:私のansible脚本断片である

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

私は新しいをインストールする前に古いバージョンを削除することができますが、パッケージの全体の束は、(例えばsshlibsslに依存します。

はところで、リモートホストの作品でapt-get install libssl1.0.0 -t jessie-backportsコマンド、およびのlibsslは

+0

現在何の状態=はaptのタスクがあなたの中に存在しないのはなぜ? – papey

+0

state = presentはデフォルト値 – kakabomba

+0

です。aptモジュールで 'force:true'を使ってみましたか? –

答えて

0

ソリューションは、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] }}" 
関連する問題