Ansible pamd:模块故障

时间:2019-07-01 13:25:09

标签: ansible rhel7 ansible-issue

我将此剧本作为角色的一部分,对pam模块进行了一些更改:

---

- name: "{{ BANNER}} - SET MODE"
  copy:
    remote_src: True
    src: "{{ LOGIN_DEF }}"
    dest: "{{ LOGIN_DEF_BCK }}_RH7-021_{{ CK_ORA }}"

  replace:
    path: "{{ LOGIN_DEF }}"
    regexp: '{{ item.src }}'
    replace: '{{ item.dst }}'
  with_items:
    - { src: '(.*FAIL_DELAY.*)', dst: '#\1' }

  lineinfile:
    path: "{{ LOGIN_DEF }}"
    line: 'FAIL_DELAY 10'

  replace:
    path: "{{ PASSWORDAUTH }}"
    regexp: '{{ item.src }}'
    replace: '{{ item.dst }}'
  with_items:
    - { src: '^auth .* pam_faildelay.so', dst: '' }

  pamd:
    name: password-auth
    type: auth
    control: sufficient
    module_path: 'pam_unix.so'
    new_type: auth
    new_control: optional
    new_module_path: 'pam_faildelay.so'
    module_arguments:
    state: after

  replace:
    path: "{{ SYSTEMAUTH }}"
    regexp: '{{ item.src }}'
    replace: '{{ item.dst }}'
  with_items:
    - { src: '^auth .* pam_faildelay.so', dst: '' }

  pamd:
    name: system-auth
    type: auth
    control: sufficient
    module_path: 'pam_unix.so'
    new_type: auth
    new_control: optional
    new_module_path: 'pam_faildelay.so'
    module_arguments:
    state: after

  debug: msg="{{ MSG_SET }}"

我跑步时遇到此错误:

TASK [RH7-021 : pamd] ***********************************************************************************************************************************************
fatal: [10.13.203.165]: FAILED! => {"changed": false, "module_stderr": "", "module_stdout": "\r\nTraceback (most recent call last):\r\n  
File \"/home/ccansible/.ansible/tmp/ansible-tmp-1561986679.75-245340126875212/AnsiballZ_pamd.py\", line 113, in <module>\r\n    _ansiballz_main()\r\n  
File \"/home/ccansible/.ansible/tmp/ansible-tmp-1561986679.75-245340126875212/AnsiballZ_pamd.py\", line 105, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  
File \"/home/ccansible/.ansible/tmp/ansible-tmp-1561986679.75-245340126875212/AnsiballZ_pamd.py\", line 48, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  
File \"/tmp/ansible_pamd_payload_NpycuP/__main__.py\", line 880, in <module>\r\n  File \"/tmp/ansible_pamd_payload_NpycuP/__main__.py\", line 816, in main\r\n  File \"/tmp/ansible_pamd_payload_NpycuP/__main__.py\", line 458, in __init__\r\n  
File \"/tmp/ansible_pamd_payload_NpycuP/__main__.py\", line 371, in rule_from_string\r\n
AttributeError: 'NoneType' object has no attribute 'group'\r\n", 
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
        to retry, use: --limit @/home/PG005856/HARDENING/main.retry

我无法弄清楚到底是什么问题,我在其他剧本上使用了相同的方法,效果很好。

控制节点具有此ansible版本:

ansible 2.7.6
  config file = /home/PG005856/HARDENING/ansible.cfg
  configured module search path = [u'/home/PG005856/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /ansible/lib/python2.7/site-packages/ansible
  executable location = /ansible/bin/ansible
  python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

目标服务器是:

    Linux rh7-test-ansible 3.10.0-693.17.1.el7.x86_64 #1 SMP Sun Jan 14 10:36:03 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
   cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 7.4 (Maipo)

我已经读到这是一个错误,但我可以想象到ansible 2.7版已解决。

我不知道该怎么办,我可以用shell模块的sed行来归档相同的结果,但是我想使用pamd:模块。

0 个答案:

没有答案