cloud_cloud
cloud_cloud

Reputation: 2189

How to disable SELinux on Ubuntu with Ansible?

The playbook:

---
- name: Update repositories cache
  apt: update_cache=yes

- name: Install build-essential
  apt: name=build-essential state=present

- name: Disable SELinux
  selinux: state=disabled

The result:

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"}

I tried to find libselinux-python but it seems like not exist. When I try some other libraries such as python-selinux, can't been installed on the system.

Upvotes: 3

Views: 8875

Answers (1)

Sahil Gulati
Sahil Gulati

Reputation: 15141

Change you tasks to this. You need to install python-selinux first. Ansible intro install requirements

You should add this to your tasks.

- name: Install the libselinux-python package
  apt: name=python-selinux state=present

Whole tasks will be like this.

---
- 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

Upvotes: 6

Related Questions