1

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]"
    ]
}
2
  • 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
    Aug 4, 2021 at 23:52
  • 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
    Aug 5, 2021 at 19:25

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.