confluentinc / cp-ansible

Ansible playbooks for the Confluent Platform
Apache License 2.0
42 stars 405 forks source link

cp-ansible install fails every time a new release occurs #1797

Open travisdowns opened 1 month ago

travisdowns commented 1 month ago

Describe the issue Whenever a new point release occurs (e.g., 7.7.0 to 7.7.1) using any cp-ansible other than the current point release will fail to install on Ubuntu because a mix of package versions are in use. In particular, it seems that confluent-kafka-rest confluent-rest-utils are at some point installed without an explicit version, or somehow pick up the newest version, but then later when the kafka broker is installed at the old version, which depends on these packages, it implies a downgrade them which fails

To Reproduce

On ubuntu 20.04 install cp-ansible 7.7.0 from galaxy and try to install the Kafka broker.

The following error occurs:

kafka > TASK [confluent.platform.kafka_broker : Install the Kafka Broker Packages] *****
kafka > FAILED - RETRYING: [...]: Install the Kafka Broker Packages (5 retries left).
kafka > FAILED - RETRYING: [...]: Install the Kafka Broker Packages (4 retries left).
kafka > FAILED - RETRYING: [...]: Install the Kafka Broker Packages (3 retries left).
kafka > FAILED - RETRYING: [...]: Install the Kafka Broker Packages (2 retries left).
kafka > FAILED - RETRYING: [...]: Install the Kafka Broker Packages (1 retries left).
kafka > fatal: [...]: FAILED! => {"attempts": 5, "cache_update_time": 1727401895, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"       install 'confluent-rest-utils=7.7.0-1' 'confluent-metadata-service=7.7.0-1' 'confluent-kafka-rest=7.7.0-1'' failed: E: Packages were downgraded and -y was used without --allow-downgrades.\n", "rc": 100, "stderr": "E: Packages were downgraded and -y was used without --allow-downgrades.\n", "stderr_lines": ["E: Packages were downgraded and -y was used without --allow-downgrades."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following NEW packages will be installed:\n  confluent-metadata-service\nThe following packages will be DOWNGRADED:\n  confluent-kafka-rest confluent-rest-utils\n0 upgraded, 1 newly installed, 2 downgraded, 0 to remove and 92 not upgraded.\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following NEW packages will be installed:", "  confluent-metadata-service", "The following packages will be DOWNGRADED:", "  confluent-kafka-rest confluent-rest-utils", "0 upgraded, 1 newly installed, 2 downgraded, 0 to remove and 92 not upgraded."]}

I checked the version of confluent-kafka-rest and confluent-rest-utils installed at the moment of the above failure and it was 7.7.1, presumably installed by an earlier step in the playbook.

Expected behaviour

Installs cleanly.

Inventory File

all:
  vars:
    ansible_become: true
    ansible_connection: ssh
    ansible_user: ubuntu
    confluent_server_enabled: false
    jmxexporter_enabled: true
    kafka_broker_custom_java_args: -Djava.net.preferIPv4Stack=True
    kafka_broker_custom_listeners:
      private_listener:
        name: PRIVATE
        port: 9193
    kafka_controller_custom_java_args: -Djava.net.preferIPv4Stack=True
    mask_secrets: false
    mask_sensitive_diff: false
kafka_broker:
  hosts:
    <omit>:
      ansible_host: <omit>
      kafka_broker_custom_listeners:
        internal:
          hostname: <omit>
kafka_controller:
  hosts:
    <omit>:
      ansible_host: <omit>

Logs

I don't have the full log with -vvv but a relevant part is above.

Environment (please complete the following information):

Additional context

A workaround is just to reinstall cp-ansible to the newest version when this occurs.