Changeset - b3e67fd6c0c1
[Not reviewed]
0 3 0
Branko Majic (branko) - 7 months ago 2023-11-26 15:48:38
branko@majic.rs
MAR-187: Reorder the deprecation tasks for xmpp_server role to make the runs reliable:

- Deprecated apt repository really needs to be removed first in case
it has an unresolvable URL (so the backports repository cache update
would trigger correctly).
- Use the file removal for Prosody repository as well to make sure the
file is dropped.
3 files changed with 68 insertions and 26 deletions:
0 comments (0 inline, 0 general)
docs/releasenotes.rst
Show inline comments
 
Release notes
 
=============
 

	
 

	
 
x.y.z
 
-----
 

	
 
Minor bug-fixes.
 

	
 
**Bug fixes:**
 

	
 
* ``xmpp_server`` role
 

	
 
  * Make sure to take care of deprecation-related package and
 
    configuration removals prior to running the rest of the tasks to
 
    avoid errors relaetd to deprecated elements being invalid (like
 
    repository URLs for Prosody).
 

	
 

	
 
7.0.0
 
-----
 

	
 
Dropped support for Debian 9 (Stretch), moved away from using
 
non-Debian project repositories (like Prosody ones).
 

	
 
**Breaking changes:**
 

	
 
* All roles
 

	
 
  * Dropped support for Debian 9 (Stretch).
 

	
roles/xmpp_server/molecule/default/prepare.yml
Show inline comments
 
@@ -153,24 +153,32 @@
 
      apt:
 
        name: prosody-0.11
 
        state: present
 

	
 
    - name: Set-up directory for storing additional Prosody modules
 
      file:
 
        path: "/usr/local/lib/prosody/modules/"
 
        state: directory
 
        owner: root
 
        group: root
 
        mode: 0755
 

	
 
    - name: Invalidate the Prosody repository URL for testing if the file gets dropped at correct time during initial converge
 
      copy:
 
        content: "deb http://invalidname/debian buster main"
 
        dest: "/etc/apt/sources.list.d/packages_prosody_im_debian.list"
 
        owner: root
 
        group: root
 
        mode: 0644
 

	
 
- hosts: clients
 
  become: true
 
  tasks:
 

	
 
    - name: Install tool for testing TCP connectivity
 
      apt:
 
        name: hping3
 
        state: present
 

	
 
    - name: Deploy CA certificate
 
      copy:
 
        src: tests/data/x509/ca/level1.cert.pem
roles/xmpp_server/tasks/main.yml
Show inline comments
 
---
 

	
 
# Ansible pre-requisites
 
# ======================
 

	
 
- name: Install Python apt bindings
 
  apt:
 
    name: python-apt
 

	
 
- name: Set-up the Debian backports repository
 
  template:
 
    src: backports.list.j2
 
    dest: /etc/apt/sources.list.d/backports.list
 
    owner: root
 
    group: root
 
    mode: 0644
 
  register: backports_repository_configuration
 

	
 
- name: Update apt cache if backports repository configuration changed (for immediate use)  # noqa 503
 
  # [503] Tasks that run when changed should likely be handlers
 
  #   Since apt_repository module is not reliable (does not deploy
 
  #   change when changing distro version etc), we have to use
 
  #   template instead, but this also means we need to trigger the apt
 
  #   cache reload by hand.
 
  apt:
 
    update_cache: true
 
  when: backports_repository_configuration.changed
 

	
 
- name: Configure package pins to backports for Prosody
 
  template:
 
    src: prosody_backports_pin.j2
 
    dest: /etc/apt/preferences.d/prosody
 
    owner: root
 
    group: root
 
    mode: 0644
 
# Deprecation
 
# ===========
 

	
 
- name: Drop directory for storing custom Prosody modules (deprecation)
 
- name: Drop directory for storing custom Prosody modules
 
  file:
 
    path: "/usr/local/lib/prosody/"
 
    state: absent
 
  notify:
 
    - Restart Prosody
 

	
 
- name: Collect information about installed packages
 
  package_facts:
 

	
 
- name: Uninstall Prosody from project-provided repository
 
  apt:
 
    name: prosody
 
@@ -67,24 +47,63 @@
 
  apt_key:
 
    id: "{{ item }}"
 
    state: absent
 
  with_items:
 
    - "107D65A0A148C237FDF00AB47393D7E674D9DBB5"
 
    - "44AB6DD06DA46979CFAF997F9B1B82786C8F28BA"
 

	
 
- name: Remove Prosody project-provided repository
 
  apt_repository:
 
    repo: "deb http://packages.prosody.im/debian {{ ansible_distribution_release }} main"
 
    state: absent
 

	
 
# Remove the repository configuration file based on path as well, just
 
# to be on the safe side (in case the file was manually modified, and
 
# did not get detected properly by apt_repository module).
 
- name: Remove Prosody project-provided repository (double-tap)
 
  file:
 
    path: "/etc/apt/sources.list.d/packages_prosody_im_debian.list"
 
    state: absent
 

	
 

	
 
# Main implementation
 
# ===================
 

	
 
- name: Set-up the Debian backports repository
 
  template:
 
    src: backports.list.j2
 
    dest: /etc/apt/sources.list.d/backports.list
 
    owner: root
 
    group: root
 
    mode: 0644
 
  register: backports_repository_configuration
 

	
 
- name: Update apt cache if backports repository configuration changed (for immediate use)  # noqa 503
 
  # [503] Tasks that run when changed should likely be handlers
 
  #   Since apt_repository module is not reliable (does not deploy
 
  #   change when changing distro version etc), we have to use
 
  #   template instead, but this also means we need to trigger the apt
 
  #   cache reload by hand.
 
  apt:
 
    update_cache: true
 
  when: backports_repository_configuration.changed
 

	
 
- name: Configure package pins to backports for Prosody
 
  template:
 
    src: prosody_backports_pin.j2
 
    dest: /etc/apt/preferences.d/prosody
 
    owner: root
 
    group: root
 
    mode: 0644
 

	
 
- name: Install additional Prosody dependencies
 
  apt:
 
    name:
 
      - lua-ldap
 
      - prosody-modules
 
    state: present
 
  notify:
 
    - Restart Prosody
 

	
 
- name: Install Prosody
 
  apt:
 
    name: prosody
0 comments (0 inline, 0 general)