Search code examples
ansibleyamlsles

Unable to install rpm package using ansible zypper command


Issue: Unable to install rpm package using ansible zypper command

Code:

---
- name: Upgrade package to latest version on all OS VMs
  hosts: all_OS
  tasks:

  - name: Copy 11 rpm file to server
    copy:
      src: /tmp/package/package-v1.4-1.OStype11.rpm
      dest: /tmp/
    when: ansible_distribution == "OStype" and ansible_distribution_major_version == "v1"

  - name: Install 11 rpm on server
    zypper:
      name: /tmp/package-v1.4-1.OStype11.rpm
      #update_cache: yes
      force: yes
      state: present
    when: ansible_distribution == "OStype" and ansible_distribution_major_version == "v1"

Error:

fatal: [dummy]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper", "--quiet", "--non-interactive", "--xmlout", "install", "--type", "package", "--auto-agree-with-licenses", "--no-recommends", "--force", "--", "/tmp/package-v1.4-1.OStype12.2.rpm"], "msg": "Zypper run command failed with return code 4.", "rc": 4, "stderr": "", "stderr_lines": [], "stdout": "<?xml version='1.0'?>\n<stream>\n<message type=\"error\">Download (curl) error for &apos;https://site/infrastructure_agent/OS/zypp/OStype/12.2/x86_64/repodata/repomd.xml&apos;:\nError code: Connection failed\nError message: Failed to connect to site port 443: Connection timed out\n</message>\n<prompt id=\"8\">\n<text>Abort, retry, ignore?</text>\n<option default=\"1\" value=\"a\" desc=\"Skip retrieval of the file and abort current operation.\"/>\n<option value=\"r\" desc=\"Try to retrieve the file again.\"/>\n<option value=\"i\" desc=\"Skip retrieval of the file and try to continue with the operation without the file.\"/>\n<option value=\"u\" desc=\"Change current base URI and try retrieving the file again.\"/>\n<option value=\"s\" desc=\"Disable SSL certificate authority check and continue.\"/>\n</prompt>\n<prompt id=\"8\">\n<text>Abort, retry, ignore?</text>\n<option default=\"1\" value=\"a\" desc=\"Skip retrieval of the file and abort current operation.\"/>\n<option value=\"r\" desc=\"Try to retrieve the file again.\"/>\n<option value=\"i\" desc=\"Skip retrieval of the file and try to continue with the operation without the file.\"/>\n<option value=\"u\" desc=\"Change current base URI and try retrieving the file again.\"/>\n</prompt>\n<message type=\"error\">ABORT request: Aborting requested by user</message>\n</stream>\n", "stdout_lines": ["<?xml version='1.0'?>", "<stream>", "<message type=\"error\">Download (curl) error for &apos;https://site/infrastructure_agent/OS/zypp/OStype/12.2/x86_64/repodata/repomd.xml&apos;:", "Error code: Connection failed", "Error message: Failed to connect to site port 443: Connection timed out", "</message>", "<prompt id=\"8\">", "<text>Abort, retry, ignore?</text>", "<option default=\"1\" value=\"a\" desc=\"Skip retrieval of the file and abort current operation.\"/>", "<option value=\"r\" desc=\"Try to retrieve the file again.\"/>", "<option value=\"i\" desc=\"Skip retrieval of the file and try to continue with the operation without the file.\"/>", "<option value=\"u\" desc=\"Change current base URI and try retrieving the file again.\"/>", "<option value=\"s\" desc=\"Disable SSL certificate authority check and continue.\"/>", "</prompt>", "<prompt id=\"8\">", "<text>Abort, retry, ignore?</text>", "<option default=\"1\" value=\"a\" desc=\"Skip retrieval of the file and abort current operation.\"/>", "<option value=\"r\" desc=\"Try to retrieve the file again.\"/>", "<option value=\"i\" desc=\"Skip retrieval of the file and try to continue with the operation without the file.\"/>", "<option value=\"u\" desc=\"Change current base URI and try retrieving the file again.\"/>", "</prompt>", "<message type=\"error\">ABORT request: Aborting requested by user</message>", "</stream>"]}

Solution

  • Error message: Failed to connect to download.newrelic.com port 443: Connection timed out

    Seems that it tries to download some additional files. Try to install this package manually on a test environment to see the full error.

    Or maybe outbound to download.newrelic.com port 443 is firewalled?