gpt4 book ai didi

python - 如何使用 Ansible 在 Ubuntu 上禁用 SELinux?

转载 作者:太空宇宙 更新时间:2023-11-03 13:32:44 26 4
gpt4 key购买 nike

剧本:

---
- 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时,系统无法安装。

最佳答案

将您的任务更改为此。您需要先安装 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

关于python - 如何使用 Ansible 在 Ubuntu 上禁用 SELinux?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44253909/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com