keep getting error : "module_stderr": "Shared connection to host closed

821 views
Skip to first unread message

Tony Wong

unread,
Jul 14, 2022, 3:27:44 PM7/14/22
to Ansible Project
any idea why?

Antony Stone

unread,
Jul 14, 2022, 3:58:22 PM7/14/22
to ansible...@googlegroups.com
On Thursday 14 July 2022 at 21:27:43, Tony Wong wrote:

> any idea why?

No.

Give us more context, and we might have a clue.

Antony.

--
"Once you have a panic, things tend to become rather undefined."

- murble

Please reply to the list;
please *don't* CC me.

Tony Wong

unread,
Jul 14, 2022, 4:36:06 PM7/14/22
to Ansible Project
failed: [xxxxxxxx] (item={'search': '#image: graylog/graylog:4.3.2', 'add': 'image: graylog/graylog:4.3.3'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "add": "image: graylog/graylog:4.3.3",
        "search": "#image: graylog/graylog:4.3.2"
    },
    "module_stderr": "Shared connection to xxxxx closed.\r\n",
    "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/twong/.ansible/tmp/ansible-tmp-1657826370.868146-3737-103625139036728/AnsiballZ_lineinfile.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/twong/.ansible/tmp/ansible-tmp-1657826370.868146-3737-103625139036728/AnsiballZ_lineinfile.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/twong/.ansible/tmp/ansible-tmp-1657826370.868146-3737-103625139036728/AnsiballZ_lineinfile.py\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible.modules.lineinfile', init_globals=None, run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\r\n    fname, loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\r\n    mod_name, mod_fname, mod_loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\r\n    exec code in run_globals\r\n  File \"/tmp/ansible_lineinfile_payload_oqguHr/ansible_lineinfile_payload.zip/ansible/modules/lineinfile.py\", line 577, in <module>\r\n  File \"/tmp/ansible_lineinfile_payload_oqguHr/ansible_lineinfile_payload.zip/ansible/modules/lineinfile.py\", line 568, in main\r\n  File \"/tmp/ansible_lineinfile_payload_oqguHr/ansible_lineinfile_payload.zip/ansible/modules/lineinfile.py\", line 342, in present\r\n  File \"/usr/lib64/python2.7/re.py\", line 266, in _expand\r\n    return sre_parse.expand_template(template, match)\r\n  File \"/usr/lib64/python2.7/sre_parse.py\", line 800, in expand_template\r\n    raise error, \"unmatched group\"\r\nsre_constants.error: unmatched group\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",



-----------

playbook task 

- name: add line
lineinfile:
backup: no
backrefs: yes
state: present
path: "{{ file_path }}"
regexp: '^(\s*)[#]?{{ item.search }}(: )*'
line: '\1{{ item.search }}\2\n\1{{ item.add }}'
with_items:
- { search: "{{ line.replace_with }}", add: "{{ line.line_to_add }}" }

Tony Wong

unread,
Jul 14, 2022, 4:37:37 PM7/14/22
to Ansible Project
however this worked though

- name: comment line
lineinfile:
backup: no
backrefs: yes
state: present
path: "{{ file_path }}"
regexp: '^(\s*)[#]?{{ item.search }}(: )*'
line: '\1{{ item.replace }}'
with_items:
- { search: "{{ line.line_to_replace }}", replace: "{{ line.replace_with }}" }


Tony Wong

unread,
Jul 14, 2022, 5:06:47 PM7/14/22
to ansible...@googlegroups.com
i think its because the destination machine dont have python3

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/rO_ZxY7PLT8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0a83ed84-4db1-439f-9eb8-adf70e47ef75n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages