Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make ondemand and ondemand_dex package installs idempotent #217

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@ new features to _this role_.

## Installing a specific version

`ondemand_package` defaults to `latest` meaning this will install the latest version on the versioned
yum/deb repository. For example, it'll install the latest version, 2.0.20 from the versioned 2.0 yum
repo.

We use `ondemand_package` for the `name` paramter of the [ansible yum](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_module.html)
so you can speicify a specific version with `ondemand-2.0.20` or use the comparison operators
ansible supports.
The `ondemand_package` variable controls the version of the rpm/dep package installed. The default value of `ondemand` will install the latest version from the relevant repository, but will not upgrade an
existing installation. You can install a specific version using the full package name (e.g. `ondemand-3.0.3`) or use the comparison operators supported by the `name` parameter of the ansible [yum](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_module.html)
or [apt](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html) modules. Use `latest` to upgrade an existing installation.

### Installing from latest or nightly

Expand Down
7 changes: 2 additions & 5 deletions defaults/main/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rpm_repo_key: "https://yum.osc.edu/ondemand/RPM-GPG-KEY-ondemand"
deb_repo_key: "https://apt.osc.edu/ondemand/DEB-GPG-KEY-ondemand"
deb_repo_key_id: "4B72FE2B92D31755"

ondemand_package: "ondemand"
ondemand_package: "ondemand" # Idempotent. Use `latest` to upgrade, or full package name or comparison operators.
ondemand_package_excludes: []

# OSC's repo rpm isn't signed
Expand All @@ -33,10 +33,7 @@ apt_update_cache: true

# flip this flag if you want to install the ondemand-dex RPM
install_ondemand_dex: false
# This will default to latest ondemand-dex package if install_ondemand_dex
# is set to true, to control the version installed add the version of the
# package to install (ondemand-dex-2.32.0)
ondemand_dex_package: ondemand-dex
ondemand_dex_package: ondemand-dex # behaviour as for ondemand_package

# needed for testing. no reason to change these in production.
disable_htcacheclean: false
Expand Down
2 changes: 2 additions & 0 deletions molecule/upgrade/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
hosts: default
roles:
- role: ood-ansible
vars_files:
- vars/converge.yml
1 change: 1 addition & 0 deletions molecule/upgrade/vars/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ondemand_package: 'latest'
12 changes: 6 additions & 6 deletions tasks/install-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@

- name: Install Open Ondemand (RHEL)
ansible.builtin.yum:
name: "{{ ondemand_package }}"
state: "{% if ondemand_package == 'ondemand' %}latest{% else %}present{% endif %}"
name: "{{ 'ondemand' if ondemand_package == 'latest' else ondemand_package }}"
state: "{{ 'latest' if ondemand_package == 'latest' else 'present' }}"
update_cache: true
exclude: "{{ ondemand_package_excludes | default([]) }}"
when: ansible_os_family == "RedHat"

- name: Install Open Ondemand (Debian)
ansible.builtin.apt:
name: "{{ ondemand_package }}"
state: "{% if ondemand_package == 'ondemand' %}latest{% else %}present{% endif %}"
name: "{{ 'ondemand' if ondemand_package == 'latest' else ondemand_package }}"
state: "{{ 'latest' if ondemand_package == 'latest' else 'present' }}"
update_cache: true
when: ansible_os_family == "Debian"

- name: Install ondemand-dex
ansible.builtin.package:
name: "{{ ondemand_dex_package }}"
state: "{% if ondemand_dex_package == 'ondemand-dex' %}latest{% else %}present{% endif %}"
name: "{{ 'ondemand-dex' if ondemand_dex_package == 'latest' else ondemand-dex }}"
state: "{{ 'latest' if ondemand_dex_package == 'latest' else 'present' }}"
when: install_ondemand_dex