Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 01-error-handling.yaml #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iamvikramkumar
Copy link

While executing this playbook i got this error No package matching 'docker.io' is available

Screenshot (750)

For handle this issue

  1. Ensure your Ansible playbook includes a task to update the apt cache before attempting to install any packages.
- name: Update apt cache
 apt:
   update_cache: yes
  1. Here is the full playbook code
- hosts: all
  become: true

  tasks:
    - name: Enable universe repository
      ansible.builtin.command: add-apt-repository universe
      register: universe_result
      changed_when: "'universe' in universe_result.stdout"

    - name: Update apt cache
      ansible.builtin.apt:
        update_cache: yes

    - name: Make sure the packages and openssl are up to date
      ansible.builtin.apt:
        name: "{{ item }}"
        state: latest
      loop:
        - openssh-server
        - openssl
      ignore_errors: yes

    - name: Verify if Docker is installed
      ansible.builtin.command: docker --version
      register: output
      ignore_errors: yes

    - name: Install Docker
      ansible.builtin.apt:
        name: docker.io
        state: present
      when: output.failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant