# Ansible ssh error on alma linux

**URL:** <https://forum.ansible.com/t/ansible-ssh-error-on-alma-linux/6822>\
**Category:** Get Help\
**Tags:** ansible-core\
**Created:** [June 27, 2024, 11:05pm UTC](https://forum.ansible.com/t/ansible-ssh-error-on-alma-linux/6822 "2024-06-27T23:05:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivia\_Barker](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/olivia_barker/32/3988_2.png) [@olivia\_Barker](https://forum.ansible.com/u/olivia_Barker)\
**Post date:** [June 27, 2024, 11:05pm UTC](https://forum.ansible.com/t/ansible-ssh-error-on-alma-linux/6822/1 "2024-06-27T23:05:03Z")

</div>

hello i am trying to setup a wireguard tunnel between my lan and a oracle always free vps and im having issues running tasks on it it gathers facts correctly but when i use the dnf module? ansible erros on the next task and wont work untill i rol back to a pre ansible snapshot i made

```auto
fatal: [vps]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_9.7p1, OpenSSL 3.3.1 4 Jun 2024\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 2: Including file /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf\r\ndebug2: resolve_canonicalize: hostname 132.145.76.199 is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/olivia/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/olivia/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master at '/home/olivia/.ansible/cp/e382842f2e'\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 178929\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet_timeout: read header failed: Broken pipe\r\ndebug2: Received exit status from master 137\r\nShared connection to 132.145.76.199 closed.\r\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 137
}

```

here is the playbook snippet

```yml
- name: install wireguard 
  ansible.builtin.dnf:
    name:
      - wireguard-tools
    state: latest
  become: true
- name: add sysctls for ip forwarding
  ansible.builtin.copy:
    src: 90-ip-forwarding.conf
    dest: /etc/sysctl.d/90-ip-forwarding.conf
  become: true
- name: apply sysctls
  ansible.builtin.command:
    cmd: sysctl -p 
  become: true

```

it errors after the dnf tasks(or the first task in the play all the first tasks are installing things to i cant tell)  
i have a second plain ssh session and that continues to work fine after the ansible one errors out. i opened an issue on github but it was closed and said to come here instead

---

<div class="post-metadata">

**Author:** ![rmenage](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rmenage](https://forum.ansible.com/u/rmenage)\
**Post date:** [August 5, 2025, 5:02pm UTC](https://forum.ansible.com/t/ansible-ssh-error-on-alma-linux/6822/2 "2025-08-05T17:02:23Z")

</div>

In my recent experience, I get the same error when provisioning a cloud based VMs running Centos (maybe the same problem occurs with other Redhat/Fedora distributions) with small amount of RAM (1GB or less) and that are swap-less.

On AWS, it happens with “t3.micro”, so I use “t3.small” to avoid the problem.

The root issue is a bug with the dnf command.

Some references:

- [1907030 – "dnf update" runs out of memory on swapless machines with 1G or less of RAM](https://bugzilla.redhat.com/show_bug.cgi?id=1907030)
- [记一次关于Ansible Shared connection to remotehost closed 问题的排查过程 - 鹏叔的技术博客](https://pengtech.net/ansible/ansible_trouble_shooting.html) (in Chinese)
