Skip to content

Commit

Permalink
Upgrade nodejs repo
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Jan 15, 2020
1 parent 0ee4125 commit 3a24960
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions roles/StackStorm.nodejs/tasks/nodejs_yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
until: _task is succeeded
tags: nodejs

# nodejs updates the version in their repo rpm without updating the version of the rpm itself.
- name: Determine if nodesource repo upgrade is required
shell: "grep -q pub_{{ nodejs_major_version }}.x /etc/yum.repos.d/nodesource-*.repo"
changed_when: no
failed_when: no
register: nodesource_repo_check

- name: Remove old nodesource repo on upgrade
when: nodesource_repo_check.rc != 0
become: yes
yum:
name: "nodesource-release-el{{ ansible_facts.distribution_major_version }}-1.noarch"
state: absent
register: rm_nodesource_repo
tags: nodejs

- name: Add nodesource repo
become: yes
yum:
Expand All @@ -25,6 +41,7 @@
# TODO: Allow yum downgrade since Ansible 2.4
# https://github.com/ansible/ansible/pull/21516
# allow_downgrade: yes
update_cache: "{{ rm_nodesource_repo is changed }}"
register: _task
retries: 5
delay: 3
Expand Down

0 comments on commit 3a24960

Please sign in to comment.