剧本:
---
- name: Update repositories cache
apt: update_cache=yes
- name: Install build-essential
apt: name=build-essential state=present
- name: Disable SELinux
selinux: state=disabled
结果:
TASK [common : Update repositories cache] ***************************************************************************************************************************************************************************************************
changed: [server]
TASK [common : Install build-essential] *****************************************************************************************************************************************************************************************************
ok: [server]
TASK [common : Disable SELinux] *************************************************************************************************************************************************************************************************************
fatal: [server]: FAILED! => {"changed": false, "failed": true, "msg": "libselinux-python required for this module"}
我试图找到libselinux-python
,但似乎不存在。当我尝试其他一些库如python-selinux
时,无法在系统上安装。
答案 0 :(得分:5)
将您的任务更改为此。您需要先安装python-selinux
。的 Ansible intro install requirements
强>
您应该将此添加到您的任务中。
- name: Install the libselinux-python package
apt: name=python-selinux state=present
整个任务都是这样的。
---
- name: Update repositories cache
apt: update_cache=yes
- name: Install build-essential
apt: name=build-essential state=present
- name: Install the libselinux-python package
apt: name=python-selinux state=present
- name: Disable SELinux
selinux: state=disabled