From 4067c7ec0b7f2090fb221f5eb7540eda7b975f5f Mon Sep 17 00:00:00 2001 From: Teodoro Cook Date: Wed, 22 Nov 2023 22:04:47 -0600 Subject: [PATCH] Rename mongos package parameter (#19) --- defaults/main.yml | 2 +- molecule/hold/converge.yml | 10 +++++----- molecule/hold/molecule.yml | 2 +- molecule/hold/verify.yml | 6 +++--- tasks/lock.yml | 4 ++-- tasks/main.yml | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 3fa75b1..1b0d869 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -mongos_package_name: +mongos_packages: - mongodb-org-server - mongodb-org-mongos - mongodb-mongosh diff --git a/molecule/hold/converge.yml b/molecule/hold/converge.yml index 984dc9a..77faa5b 100644 --- a/molecule/hold/converge.yml +++ b/molecule/hold/converge.yml @@ -8,7 +8,7 @@ - name: Query Debian package versions ansible.builtin.shell: cmd: "apt-cache madison {{ item }} | awk -F'|' '{ print $2 }'" - loop: "{{ mongos_package_name }}" + loop: "{{ mongos_packages }}" register: _debian_package_query when: ansible_os_family == "Debian" changed_when: false @@ -16,7 +16,7 @@ - name: Query RedHat package versions ansible.builtin.shell: cmd: "yum list {{ item }} --showduplicates | grep '^{{ item }}' | awk '{ print $1,$2 }' | sort -r" - loop: "{{ mongos_package_name }}" + loop: "{{ mongos_packages }}" register: _redhat_package_query when: ansible_os_family == "RedHat" changed_when: false @@ -41,11 +41,11 @@ - name: Initialize package versions ansible.builtin.set_fact: - mongos_package_name: [] + mongos_packages: [] - name: Set target Debian package versions ansible.builtin.set_fact: - mongos_package_name: "{{ mongos_package_name + [_package] }}" + mongos_packages: "{{ mongos_packages + [_package] }}" vars: _stdout: "{{ item.stdout_lines }}" _multiple: "{{ _stdout | length > 1 }}" @@ -58,7 +58,7 @@ - name: Set target RedHat package versions ansible.builtin.set_fact: - mongos_package_name: "{{ mongos_package_name + [_package] }}" + mongos_packages: "{{ mongos_packages + [_package] }}" vars: _stdout: "{{ item.stdout_lines }}" _multiple: "{{ _stdout | length > 1 }}" diff --git a/molecule/hold/molecule.yml b/molecule/hold/molecule.yml index 341bb60..aba2cfe 100644 --- a/molecule/hold/molecule.yml +++ b/molecule/hold/molecule.yml @@ -45,7 +45,7 @@ provisioner: mongos_replicaset_config_name: config mongos_replicaset_shard_name: shard mongodb_shell: mongosh - mongos_package_name: + mongos_packages: - mongodb-org-server - mongodb-org-mongos - mongodb-mongosh diff --git a/molecule/hold/verify.yml b/molecule/hold/verify.yml index 4f1bbff..8361ea5 100644 --- a/molecule/hold/verify.yml +++ b/molecule/hold/verify.yml @@ -6,7 +6,7 @@ - name: Query Debian package versions ansible.builtin.shell: cmd: "apt-cache madison {{ item }} | awk -F'|' '{ print $2 }'" - loop: "{{ mongos_package_name }}" + loop: "{{ mongos_packages }}" register: _debian_package_query when: ansible_os_family == 'Debian' changed_when: false @@ -14,7 +14,7 @@ - name: Query RedHat package versions ansible.builtin.shell: cmd: "yum list {{ item }} --showduplicates | grep '^{{ item }}' | awk '{ print $1,$2 }' | sort -r" - loop: "{{ mongos_package_name }}" + loop: "{{ mongos_packages }}" register: _redhat_package_query when: ansible_os_family == "RedHat" changed_when: false @@ -83,7 +83,7 @@ _package: "{{ item.0 }}" _version: "{{ item.1 | regex_replace(_prefix, '') | regex_replace(_suffix, '') }}" _installed: "{{ (packages[_package] | default([{'version': 'None'}]))[0].version }}" - loop: "{{ mongos_package_name | zip(mongos_package_list) }}" + loop: "{{ mongos_packages | zip(mongos_package_list) }}" when: - ansible_os_family == "RedHat" - _package not in packages or _version != _installed diff --git a/tasks/lock.yml b/tasks/lock.yml index c81fa72..c4aad35 100644 --- a/tasks/lock.yml +++ b/tasks/lock.yml @@ -5,7 +5,7 @@ selection: "{{ _lock_state }}" vars: _version_regex: ".*=.*" - _package_versions: "{{ [mongos_package_name] | flatten | map('regex_search', _version_regex) }}" + _package_versions: "{{ [mongos_packages] | flatten | map('regex_search', _version_regex) }}" _package_holds: "{{ _package_versions | select('string') }}" loop: "{{ _package_holds }}" when: ansible_os_family == "Debian" @@ -17,7 +17,7 @@ state: "{{ 'absent' if _lock_state == 'install' else 'present' }}" vars: _version_regex: ".*=.*" - _package_versions: "{{ [mongos_package_name] | flatten | map('regex_search', _version_regex) }}" + _package_versions: "{{ [mongos_packages] | flatten | map('regex_search', _version_regex) }}" _package_holds: "{{ _package_versions | select('string') }}" loop: "{{ _package_holds }}" when: ansible_os_family == "RedHat" diff --git a/tasks/main.yml b/tasks/main.yml index 5f842ee..776e628 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,7 +20,7 @@ block: - name: Install packages ansible.builtin.package: - name: "{{ mongos_package_name }}" + name: "{{ mongos_packages }}" state: "{{ mongos_package_state }}" always: