FAILED! => {"changed": false, "msg": "apt cache update failed"} when trying to

14,376

According to official documentation you need to add the key and later the repository:

https://help.vivaldi.com/article/manual-setup-vivaldi-linux-repositories/

Edit your playbook with the task Add key:

- name: Run apt upgrade
  apt:
    upgrade: "yes"
    update_cache: yes
    cache_valid_time: 432000

- name: Add key
  apt_key:
    url: https://repo.vivaldi.com/archive/linux_signing_key.pub
    state: present
  tags:
     - vivaldi

- name: Add Vivaldi Repository
  apt_repository:
      repo: "deb https://repo.vivaldi.com/stable/deb/ stable main"
      state: present
      filename: vivaldi.list
      update_cache: true
  tags:
     - vivaldi

- name: Install Vivaldi
  apt:
      name: vivaldi-stable
      update_cache: yes
      state: latest
  tags:
     - vivaldi
Share:
14,376
user855443
Author by

user855443

Updated on July 25, 2022

Comments

  • user855443
    user855443 almost 2 years

    I am new to Ansible and try as an example task to install Vivaldi. My only task in a role Vivaldi update starts with

        - name: Run apt upgrade
          apt:
            upgrade: "yes"
            update_cache: yes
            cache_valid_time: 432000
        
        - name: Add Vivaldi Repository
          apt_repository:
              repo: "deb https://repo.vivaldi.com/stable/deb/ stable main"
              state: present
              filename: vivaldi.list
              update_cache: true
          tags:
             - vivaldi
    

    and with this I fail on a localhost on a debian 10 installation
    Linux london 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64 GNU/Linux).

    All commands succeed on the command line.

    Ansible is 2.9.15.

    The first task runs ok (if run alone) but the second fails with
    FAILED! => {"changed": false, "msg": "apt cache update failed"}.

    A task to add a repo key fails with
    FAILED! => {"changed": false, "id": "6D3789EDC3401E12", "msg": "key does not seem to have been added"} `

    If I add however the repository manually to /etc/apt/sources.list the last task

        - name: Install Vivaldi
          apt:
              name: vivaldi-stable
              update_cache: yes
              state: latest
          tags:
             - vivaldi
    

    succeeds.

    what am I doing wrong? Help is appreciated!

  • user855443
    user855443 over 3 years
    thank you - in your answer I also noted that you did not include the id of the key (which is not required). now it works!