在使用下面的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 all -m apt -a "name=mini-httpd state=present"
答案 0 :(得分:1)
-s
无效,如果要安装软件包,则需要是root用户。
您将需要选项--become
。
因此,在Ubuntu上,apache2
的命令如下所示
ansible all -m apt -a "name=apache2 state=present" --become
答案 1 :(得分:0)
E:无法打开锁文件/ var / lib / dpkg / lock-frontend-打开(13:权限被拒绝) E:无法获取dpkg前端锁
安装apt软件包必须是目标计算机上的root用户。如果您正在目标计算机上与之连接的当前用户具有sudo功能,请尝试:
list_display = ('order_id')
如果无法解决您的问题,请参见ansible all -s -m apt -a "name=mini-httpd state=present"
中的所有其他特权升级选项。