# Installing MariaDB behind proxy with Ansible

**URL:** <https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992>\
**Category:** Get Help\
**Tags:** proxy, dnf\
**Created:** [June 29, 2026, 8:56am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992 "2026-06-29T08:56:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcusc](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Marcusc](https://forum.ansible.com/u/Marcusc)\
**Post date:** [June 29, 2026, 8:56am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/1 "2026-06-29T08:56:25Z")

</div>

Hi,

with Ansible my plan was and still is, to automate the deployment for around 15 servers with latest Oracle Linux (don’t ask, it’s a requirement) and mariadb.

So far so good and nothing special. One big problem is, that the servers are running in an environment behind a proxy. The proxy should only be active for dnf commands. This is something a got working with every server.  
Installing a dedicated mariadb version (11.4) was at first possible too. (See [Download MariaDB Server - MariaDB.org](https://mariadb.org/download/?t=repo-config&d=Red+Hat+Enterprise+Linux+10&v=11.4&r_m=hs-esslingen))

Long story short: After the first server was installed successfully, all others got an error message, that the repo file could not be downloaded. When installing mariadb with “normal” dnf command on the server itself, no error occures.

Soes somebody have any idea, how I might debug this error? The exact message and the playbook I’ll privide tomorrow from work.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [June 29, 2026, 1:04pm UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/2 "2026-06-29T13:04:34Z")

</div>

Hi @Marcusc

How did you configure proxy at the system level? DNF should honor proxy set via `http(s)_proxy` environment variables so you can try this:

```auto
- name: Install MariaDB
  ansible.builtin.dnf:
  ...
  environment:
    http_proxy: http://proxy.example.com:8080
    https_proxy: http://proxy.example.com:8080

```

---

<div class="post-metadata">

**Author:** ![Marcusc](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Marcusc](https://forum.ansible.com/u/Marcusc)\
**Post date:** [June 30, 2026, 8:21am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/3 "2026-06-30T08:21:51Z")

</div>

Hi,

Thanks for your answer.

Yes, I added the proxy to the dnf config file.  
But using environment I did not test.

Edit:  
I tried the environment change → still the same.  
My playbook:

```auto
---
- name: Plannet - Installation und Einrichtung MariaDB
  hosts: password-test
  become: true

  environment:
    http_proxy: http://IP:8080
    https_proxy: http://IP:8080

  tasks:
    - name: Ensure proxy is set in dnf.conf
      ansible.builtin.lineinfile:
        path: /etc/dnf/dnf.conf
        line: 'proxy=http://10.127.255.28:8080'
        state: present

    - name: Ensure SSL Check is disabled
      ansible.builtin.lineinfile:
        path: /etc/dnf/dnf.conf
        line: 'sslverify=0'
        state: present

    - name: Update everything
      ansible.builtin.dnf:
        name: "*"
        state: latest
        update_cache: true
        validate_certs: false
      environment:
        http_proxy: http://IP:8080
        https_proxy: http://IP:8080

    - name: Ensure repo list present
      ansible.builtin.blockinfile:
        path: /etc/yum.repos.d/MariaDB.repo
        block: |
          # MariaDB 11.4 RedHatEnterpriseLinux repository list - created 2026-06-08 13:40 UTC
          # https://mariadb.org/download/
          [mariadb]
          name = MariaDB
          # rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
          # baseurl = https://rpm.mariadb.org/11.4/rhel/$releasever/$basearch
          baseurl = https://mirror1.hs-esslingen.de/pub/Mirrors/mariadb/yum/11.4/rhel/$releasever/$basearch
          # gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
          gpgkey = https://mirror1.hs-esslingen.de/pub/Mirrors/mariadb/yum/RPM-GPG-KEY-MariaDB
          gpgcheck = 1
        create: true
        state: present

    - name: Add GPG key of HS Esslingen
      ansible.builtin.rpm_key:
        state: present
        key: https://mirror1.hs-esslingen.de/pub/Mirrors/mariadb/yum/RPM-GPG-KEY-MariaDB
        validate_certs: false

    - name: Install MariaDB
      ansible.builtin.dnf:
        name:
          - MariaDB-server
          - MariaDB-client
        state: present
        validate_certs: false
      environment:
        http_proxy: http://IP:8080
        https_proxy: http://IP:8080

    - name: Check if MariaDB service ist enabled
      ansible.builtin.service:
        name: mariadb
        enabled: yes

    - name: Check if MariaDB service is running
      ansible.builtin.service:
        name: mariadb
        state: started

```

The exact error:

> [ERROR]: Task failed: Module failed: Failed to download metadata for repo ‘mariadb’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried  
> Origin: /home/user/ansible/mariadb/playbook.yml:23:7
> 
> 21 state: present  
> 22  
> 23 - name: Update everything  
> ^ column 7
> 
> fatal: [IP]: FAILED! =\> {“changed”: false, “msg”: “Failed to download metadata for repo ‘mariadb’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried”, “rc”: 1, “results”: }

---

<div class="post-metadata">

**Author:** ![jon-nfc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jon-nfc/32/10748_2.png) [@jon-nfc](https://forum.ansible.com/u/jon-nfc)\
**Post date:** [June 30, 2026, 10:30am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/4 "2026-06-30T10:30:10Z")

</div>

> [@Marcusc](#):
>
> Yes, I added the proxy to the dnf config file.  
> But using environment I did not test.
> 
> Edit:  
> I tried the environment change → still the same.

As your posts don’t mention that you’ve done it. Instead of trying to get ansible working though the proxy, I’d confirm that the system in question has connectivity through the proxy. If you do (or have already done ) that, then you know for sure where the issue lays.

---

<div class="post-metadata">

**Author:** ![Marcusc](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Marcusc](https://forum.ansible.com/u/Marcusc)\
**Post date:** [July 1, 2026, 12:14am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/5 "2026-07-01T00:14:13Z")

</div>

Hi,

Thanks for your answer.  
It worked in the past with the posted script.

And the configuration with the proxy set in the dnf.conf file is working. I’m able to install mariadb without any error.

Sorry for not mentioning this fact.

---

<div class="post-metadata">

**Author:** ![Marcusc](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Marcusc](https://forum.ansible.com/u/Marcusc)\
**Post date:** [July 11, 2026, 7:45am UTC](https://forum.ansible.com/t/installing-mariadb-behind-proxy-with-ansible/45992/6 "2026-07-11T07:45:29Z")

</div>

to add some more details.

- if I install mariadb with _sudo dnf install MariaDB-server_, it just works without a breeze.
- Installing the repository with the same proxy worked.

Does anybody have an idea on how I can debug this?

Thanks in advance.
