<p>Maybe specify other package names that one can see at <a href="http://deb.debian.org/debian/pool/main/m/mariadb-10.3/" rel="nofollow noreferrer">http://deb.debian.org/debian/pool/main/m/mariadb-10.3/</a></p>
<p>like:</p>
<pre><code>- name: Install Mysql and htop
  apt: 
    update_cache: yes
    cache_valid_time: 0
    state: present
    name: &quot;{{packages}}&quot;
  vars:
    packages:
    - mariadb-server
    - mariadb-client
    - htop
</code></pre>

CC BY-SA 4.0
2021-08-05T23:26:47.753Z
2021-08-05T23:26:47.753Z
mikequentel
<p>Do you know how I can fix this error?</p>
<p>I'm getting <strong>404</strong> response from my node machibe when I'm trying to install <strong>default-mysql-client and server</strong> using Ansible-playbook  apt module or shel.</p>
<p><strong>Facts</strong></p>
<p>I do can install another software like <code>htop</code>, If I use the <code>shel:</code> option I'm getting the same error, but when I install the packages trough <code>ssh</code> works like a charm. The node with the problem has installed ansible, I <code>purge</code> it to check if that could be the problem, did not help me.</p>
<p>I have 2 nodes and the second do not experience the same issue, They have the same <code>/etc/apt/source.list</code>.</p>
<p><strong>Edit:</strong>
I paid attention in the error message that it is trying to install <code> mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb</code>
instead of <code>name: ['default-mysql-client','default-mysql-server'] </code>.</p>
<p><strong>Source.list node</strong></p>
<pre><code># 

# deb cdrom:[Debian GNU/Linux 10.8.0 _Buster_ - Official amd64 NETINST 20210206-10:34]/ buster main

# deb cdrom:[Debian GNU/Linux 10.8.0 _Buster_ - Official amd64 NETINST 20210206-10:34]/ buster main

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

# Added by aby for ansible course
#deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching &quot;deb cdrom&quot;
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
</code></pre>
<p><strong>Host</strong></p>
<pre><code>ansible --version

ansible [core 2.11.3] 
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
  jinja version = 2.11.2
  libyaml = True
</code></pre>
<pre><code>lsb_release -a
Debian GNU/Linux 10 (buster)
</code></pre>
<p><strong>Nodes</strong></p>
<pre><code>lsb_release -a
Debian GNU/Linux 10 (buster)
</code></pre>
<p><strong>Playbook</strong></p>
<pre><code>- name: Deploy a web app
  hosts: db_and_web_server1 , db_and_web_server2
  become: yes
  tasks:
    - name: Update and Upgrade system
      apt:
        upgrade: yes
        update_cache: yes
        cache_valid_time: 0
        
    - name: Install all required dependencies 
      apt: 
        name: ['python', 'python-setuptools', 'python-dev', 'build-essential', 'python-pip','htop']
        update_cache: yes
        state: latest 
  
    - name: Install Mysql and htop
      apt: 
        update_cache: yes
        cache_valid_time: 0
        name: ['default-mysql-client','default-mysql-server'] 
        #state: latest
        #shell: apt install -y default-mysql-client
        #shell: &quot;apt install -y --fix-missing default-mysql-client&quot;
      #ignore_errors: true
      #shell: apt install -f -y 
    - name: Start MySql Service
      service:
        name: mysql
        state: started
        enabled: yes
</code></pre>
<p><strong>Error</strong></p>
<pre><code>fatal: [db_and_web_server1]: FAILED! =&gt; 
{
    &quot;changed&quot;: true,
    &quot;cmd&quot;: &quot;apt install -y default-mysql-client&quot;,
    &quot;delta&quot;: &quot;0:00:00.940517&quot;,
    &quot;end&quot;: &quot;2021-08-02 11:09:07.829191&quot;,
    &quot;msg&quot;: &quot;non-zero return code&quot;,
    &quot;rc&quot;: 100,
    &quot;start&quot;: &quot;2021-08-02 11:09:06.888674&quot;,
    &quot;stderr&quot;: &quot;\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nE: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]\nE: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?&quot;,
    &quot;stderr_lines&quot;: [&quot;&quot;,
        &quot;WARNING: apt does not have a stable CLI interface. Use with caution in scripts.&quot;,
        &quot;&quot;,
        &quot;E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]&quot;,
        &quot;E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]&quot;,
        &quot;E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?&quot;
    ],
    &quot;stdout&quot;: &quot;Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following additional packages will be installed:\n  libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libreadline5\n  mariadb-client-10.3 mariadb-client-core-10.3\nSuggested packages:\n  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl\nThe following NEW packages will be installed:\n  default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl\n  libdbi-perl libreadline5 mariadb-client-10.3 mariadb-client-core-10.3\n0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 6,904 kB/7,986 kB of archives.\nAfter this operation, 54.5 MB of additional disk space will be used.\nErr:1 http://deb.debian.org/debian buster/main amd64 mariadb-client-core-10.3 amd64 1:10.3.27-0+deb10u1\n  404  Not Found [IP: 2a04:4e42:62::644 80]\nErr:2 http://deb.debian.org/debian buster/main amd64 mariadb-client-10.3 amd64 1:10.3.27-0+deb10u1\n  404  Not Found [IP: 2a04:4e42:62::644 80]&quot;,
    &quot;stdout_lines&quot;: [
        &quot;Reading package lists...&quot;,
        &quot;Building dependency tree...&quot;,
        &quot;Reading state information...&quot;,
        &quot;The following additional packages will be installed:&quot;,
        &quot;  libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libreadline5&quot;,
        &quot;  mariadb-client-10.3 mariadb-client-core-10.3&quot;,
        &quot;Suggested packages:&quot;,
        &quot;  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl&quot;,
        &quot;The following NEW packages will be installed:&quot;,
        &quot;  default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl&quot;,
        &quot;  libdbi-perl libreadline5 mariadb-client-10.3 mariadb-client-core-10.3&quot;,
        &quot;0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.&quot;,
        &quot;Need to get 6,904 kB/7,986 kB of archives.&quot;,
        &quot;After this operation, 54.5 MB of additional disk space will be used.&quot;,
        &quot;Err:1 http://deb.debian.org/debian buster/main amd64 mariadb-client-core-10.3 amd64 1:10.3.27-0+deb10u1&quot;,
        &quot;  404  Not Found [IP: 2a04:4e42:62::644 80]&quot;,
        &quot;Err:2 http://deb.debian.org/debian buster/main amd64 mariadb-client-10.3 amd64 1:10.3.27-0+deb10u1&quot;,
        &quot;  404  Not Found [IP: 2a04:4e42:62::644 80]&quot;
    ]
}
</code></pre>

CC BY-SA 4.0
2021-08-04T23:52:31.987Z
Boy that really doesn't make a lot of sense.  Are you getting the same stdout when you do apt-get install from the shell vs ansible? (at least up to the 404 error)
Peter Turner
CC BY-SA 4.0
2021-08-05T19:25:26.307Z
No, When I use the shell works fine.
The problem here IMO It's when I use ansible is trying to install another package.
Aby W
<ansible>
Can not install mysql client and server using a playbook Ansible
Aby W
# Can not install mysql client and server using a playbook Ansible

(Asked by: username_0 on 2021-08-04)

Do you know how I can fix this error?
I'm getting 404 response from my node machibe when I'm trying to install default-mysql-client and server using Ansible-playbook  apt module or shel.
Facts
I do can install another software like htop, If I use the shel: option I'm getting the same error, but when I install the packages trough ssh works like a charm. The node with the problem has installed ansible, I purge it to check if that could be the problem, did not help me.
I have 2 nodes and the second do not experience the same issue, They have the same /etc/apt/source.list.
Edit:
I paid attention in the error message that it is trying to install  mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb
instead of name: ['default-mysql-client','default-mysql-server'] .
Source.list node
# 

# deb cdrom:[Debian GNU/Linux 10.8.0 _Buster_ - Official amd64 NETINST 20210206-10:34]/ buster main

# deb cdrom:[Debian GNU/Linux 10.8.0 _Buster_ - Official amd64 NETINST 20210206-10:34]/ buster main

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

# Added by aby for ansible course
#deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

Host
ansible --version

ansible [core 2.11.3] 
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
  jinja version = 2.11.2
  libyaml = True

lsb_release -a
Debian GNU/Linux 10 (buster)

Nodes
lsb_release -a
Debian GNU/Linux 10 (buster)

Playbook
- name: Deploy a web app
  hosts: db_and_web_server1 , db_and_web_server2
  become: yes
  tasks:
    - name: Update and Upgrade system
      apt:
        upgrade: yes
        update_cache: yes
        cache_valid_time: 0
        
    - name: Install all required dependencies 
      apt: 
        name: ['python', 'python-setuptools', 'python-dev', 'build-essential', 'python-pip','htop']
        update_cache: yes
        state: latest 
  
    - name: Install Mysql and htop
      apt: 
        update_cache: yes
        cache_valid_time: 0
        name: ['default-mysql-client','default-mysql-server'] 
        #state: latest
        #shell: apt install -y default-mysql-client
        #shell: "apt install -y --fix-missing default-mysql-client"
      #ignore_errors: true
      #shell: apt install -f -y 
    - name: Start MySql Service
      service:
        name: mysql
        state: started
        enabled: yes

Error
fatal: [db_and_web_server1]: FAILED! => 
{
    "changed": true,
    "cmd": "apt install -y default-mysql-client",
    "delta": "0:00:00.940517",
    "end": "2021-08-02 11:09:07.829191",
    "msg": "non-zero return code",
    "rc": 100,
    "start": "2021-08-02 11:09:06.888674",
    "stderr": "\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nE: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]\nE: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?",
    "stderr_lines": ["",
        "WARNING: apt does not have a stable CLI interface. Use with caution in scripts.",
        "",
        "E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-core-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]",
        "E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.3/mariadb-client-10.3_10.3.27-0+deb10u1_amd64.deb  404  Not Found [IP: 2a04:4e42:62::644 80]",
        "E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following additional packages will be installed:\n  libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libreadline5\n  mariadb-client-10.3 mariadb-client-core-10.3\nSuggested packages:\n  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl\nThe following NEW packages will be installed:\n  default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl\n  libdbi-perl libreadline5 mariadb-client-10.3 mariadb-client-core-10.3\n0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 6,904 kB/7,986 kB of archives.\nAfter this operation, 54.5 MB of additional disk space will be used.\nErr:1 http://deb.debian.org/debian buster/main amd64 mariadb-client-core-10.3 amd64 1:10.3.27-0+deb10u1\n  404  Not Found [IP: 2a04:4e42:62::644 80]\nErr:2 http://deb.debian.org/debian buster/main amd64 mariadb-client-10.3 amd64 1:10.3.27-0+deb10u1\n  404  Not Found [IP: 2a04:4e42:62::644 80]",
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "The following additional packages will be installed:",
        "  libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libreadline5",
        "  mariadb-client-10.3 mariadb-client-core-10.3",
        "Suggested packages:",
        "  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl",
        "The following NEW packages will be installed:",
        "  default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl",
        "  libdbi-perl libreadline5 mariadb-client-10.3 mariadb-client-core-10.3",
        "0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.",
        "Need to get 6,904 kB/7,986 kB of archives.",
        "After this operation, 54.5 MB of additional disk space will be used.",
        "Err:1 http://deb.debian.org/debian buster/main amd64 mariadb-client-core-10.3 amd64 1:10.3.27-0+deb10u1",
        "  404  Not Found [IP: 2a04:4e42:62::644 80]",
        "Err:2 http://deb.debian.org/debian buster/main amd64 mariadb-client-10.3 amd64 1:10.3.27-0+deb10u1",
        "  404  Not Found [IP: 2a04:4e42:62::644 80]"
    ]
}

**Tags:** ansible

> **Comments:**
> **username_1**: Boy that really doesn't make a lot of sense.  Are you getting the same stdout when you do apt-get install from the shell vs ansible? (at least up to the 404 error)  
> **username_0**: No, When I use the shell works fine. The problem here IMO It's when I use ansible is trying to install another package.  

---

## 1 answers

### Answer by username_2 on 2021-08-05. Score: 1

Maybe specify other package names that one can see at http://deb.debian.org/debian/pool/main/m/mariadb-10.3/
like:
- name: Install Mysql and htop
  apt: 
    update_cache: yes
    cache_valid_time: 0
    state: present
    name: "{{packages}}"
  vars:
    packages:
    - mariadb-server
    - mariadb-client
    - htop


---

