如何在ubuntu机器的客户端使用Ansible安装httpd包

问题描述 投票:0回答:1

我正在使用下面的ansible命令安装httpd包

"appserver | FAILED! => {
    "cache_update_time": 1556452826,
    "cache_updated": false,
    "changed": false,
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'mini-httpd'' failed: E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?\n",
    "rc": 100,
    "stderr": "E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?\n",
    "stderr_lines": [
        "E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)",
        "E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?"
    ],
    "stdout": "",
    "stdout_lines": []
}

ansible命令:

ansible all -m apt  -a "name=mini-httpd state=present"
ubuntu ansible
1个回答
0
投票

E:无法打开锁文件/ var / lib / dpkg / lock-frontend - 打开(13:权限被拒绝)E:无法获取dpkg前端锁

安装apt软件包需要在目标计算机上是root用户。如果您在目标计算机上连接的当前用户具有sudo功能,请尝试:

ansible all -s -m apt  -a "name=mini-httpd state=present"

如果这不能解决您的问题,请参阅ansible --help以获取所有其他权限升级选项。

© www.soinside.com 2019 - 2024. All rights reserved.