skip to Main Content

I am using PackageCloud package to install Rabbitmq using Ansible. When I installed using PackageCloud, some Rabbitmq servers run version 3.8.19 and some run 3.9.1. But I am trying to pin Rabbitmq version so that all Rabbitmq servers in all environments have the same version 3.8.19.

I added a file too /etc/apt/preferences.d/rabbitmq with the content

Package: rabbitmq-server
Pin: version 1:3.8.19
Pin-Priority: 1000

as mentioned in RMQ documentation but it still installs the latest version 3.9.2 instead of 3.8.19.

2

Answers


  1. Just add a conditional check on the version which is present in the file you placed on the system:

        - shell: cat /etc/apt/preferences.d/rabbitmq
          changed_when: false
          ignore_errors: true
          register: rab_version
    
        - shell: echo
          when: '"3.8.19" in rab_version.stdout'
    
    Login or Signup to reply.
  2. After the configured the repositories you should have something like:

    sudo apt-cache policy rabbitmq-server
    rabbitmq-server:
      Installed: (none)
      Candidate: 3.9.3-1
      Version table:
         3.9.3-1 500
            500 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal/main amd64 Packages
         3.9.2-1 500
            500 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal/main amd64 Packages
         3.9.1-1 500
            500 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal/main amd64 Packages
         3.9.0-1 500
            500 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal/main amd64 Packages
         3.8.21-1 500
            500 https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu focal/main amd64 Packages
    
    

    then you can pin the version using:

    sudo cat /etc/apt/preferences.d/rabbitmq
    Package: rabbitmq-server
    Pin: version  3.8.19-1
    Pin-Priority: 1000
    

    now the Candidate is the right one:

     sudo apt-cache policy rabbitmq-server
    rabbitmq-server:
      Installed: (none)
      Candidate: 3.8.19-1
    

    just install it and then:

    rabbitmqctl status
    Status of node rabbit@node0 ...
    Runtime
    
    OS PID: 18690
    OS: Linux
    Uptime (seconds): 15
    Is under maintenance?: false
    RabbitMQ version: 3.8.19
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search