没有直接安装 .deb 包的模块。当您必须将 dpkg 作为命令运行时,它总是将安装任务标记为已更改的任务。我在正确配置它时遇到了一些麻烦,所以我在这里作为公共笔记本发布。
这是使用 dpkg 安装的任务:
- name: Install old python 
  command: dpkg -i {{ temp_dir }}/{{ item }}
  with_items: 
    - python2.4-minimal_2.4.6-6+precise1_i386.deb
    - python2.4_2.4.6-6+{{ ubuntu_release }}1_i386.deb
    - libpython2.4_2.4.6-6+{{ ubuntu_release }}1_i386.deb
    - python2.4-dev_2.4.6-6+{{ ubuntu_release }}1_i386.deb
在另一个任务中上传到 {{temp_dir}} 的文件。