# keep getting error : "module\_stderr": "Shared connection to host closed

**URL:** <https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852>\
**Category:** Ansible Project\
**Created:** [July 14, 2022, 7:27pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852 "2022-07-14T19:27:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [July 14, 2022, 7:27pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852/1 "2022-07-14T19:27:43Z")

</div>

any idea why?

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [July 14, 2022, 7:57pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852/2 "2022-07-14T19:57:47Z")

</div>

No.

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

Antony.

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [July 14, 2022, 8:36pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852/3 "2022-07-14T20:36:06Z")

</div>

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 \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 \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”,

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [July 14, 2022, 8:37pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852/4 "2022-07-14T20:37:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [July 14, 2022, 9:06pm UTC](https://forum.ansible.com/t/keep-getting-error-module-stderr-shared-connection-to-host-closed/36852/5 "2022-07-14T21:06:21Z")

</div>

i think its because the destination machine dont have python3
