【问题标题】:Can't install package with apt ansible module, but can from shell无法使用 apt ansible 模块安装软件包,但可以从 shell
【发布时间】:2021-02-06 20:40:31
【问题描述】:

当我从命令行运行时,它可以工作:

sudo apt-get install python3.9

当我使用 ansible 运行时,它会抛出错误:

ansible edge -m apt -a 'name=python3.9' -b -i vagrant-inventory.yaml
fatal: [edge]: FAILED! => changed=false 
  msg: No package matching 'python3.9' is available

Ubuntu xenial,python 可执行 python3.5。

我不知道从哪里挖掘,也许这是一些众所周知的问题,或者我应该深入挖掘以找到我的错误?

【问题讨论】:

    标签: ansible ubuntu-16.04 apt


    【解决方案1】:

    @Belenot 我认为您的 ansible 正在使用不同的 python 版本运行,这就是为什么安装无法验证您需要输入的原因:

    ansible --version | grep "python version"
    
    

    如果是这种情况,那么您需要使用 pip3 重新安装 ansible:

    pip3 install ansible
    

    解决这个兼容性问题。

    【讨论】:

      猜你喜欢
      • 2020-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多