(Cross posted from AWX group, since it’s more of an Ansible question)
I’m dealing with selinux (which I am new to), that I can’t disable in a shared env.
Remote is running python 3.5 and it’s mostly fine with the exception of these file editing modules.
They run into an issue with the libselinux-python module, which I’ve installed but the python3 version seems to have some changes.
Is this still pending support for running under python3 on the remote, or what am I missing here to get my modules working with a python3 remote and selinux?
Task:
- name: Update dockerd options and restart
lineinfile:
path: /etc/sysconfig/docker
regexp: '^OPTIONS=.*?'
insertafter: '^OPTIONS='
line: "--selinux-enabled --log-driver=journald --signature-verification=false -G dockerroot"
Output:
{
"_ansible_parsed": false,
"_ansible_no_log": false,
"module_stderr": "Shared connection to bobshost closed.\r\n",
"changed": false,
"module_stdout": "Traceback (most recent call last):\r\n File \"/home/bob/.ansible/tmp/ansible-tmp-1552573804.16-6957933190533/AnsiballZ_lineinfile.py\",
line 113, in <module>\r\n _ansiballz_main()\r\n File \"/home/bob/.ansible/tmp/ansible-tmp-1552573804.16-6957933190533/AnsiballZ_lineinfile.py\",
line 105, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/bob/.ansible/tmp/ansible-tmp-1552573804.16-6957933190533/AnsiballZ_lineinfile.py\",
line 48, in invoke_module\r\n imp.load_module('__main__', mod, module, MOD_DESC)\r\n File \"/usr/local/lib/python3.5/imp.py\",
line 234, in load_module\r\n return load_source(name, filename, file)\r\n File \"/usr/local/lib/python3.5/imp.py\",
line 170, in load_source\r\n module = _exec(spec, sys.modules[name])\r\n File \"<frozen importlib._bootstrap>\",
line 626, in _exec\r\n File \"<frozen importlib._bootstrap_external>\",
line 662, in exec_module\r\n File \"<frozen importlib._bootstrap>\",
line 222, in _call_with_frames_removed\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/__main__.py\",
line 524, in <module>\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/__main__.py\",
line 515, in main\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/__main__.py\",
line 388, in present\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/__main__.py\",
line 220, in write_changes\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/ansible_lineinfile_payload.zip/ansible/module_utils/basic.py\",
line 2521, in atomic_move\r\n File \"/tmp/ansible_lineinfile_payload_u1z_8ygt/ansible_lineinfile_payload.zip/ansible/module_utils/basic.py\",
line 1038, in selinux_enabled\r\nAttributeError: module 'selinux' has no attribute 'is_selinux_enabled'\r\n",
"rc": 1,
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}