mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
ansible_galaxy_install: add upgrade feature (#8431)
* add upgrade feature * add changelog frag * Update plugins/modules/ansible_galaxy_install.py * Update plugins/modules/ansible_galaxy_install.py
This commit is contained in:
parent
5a5188a453
commit
d46e12e280
3 changed files with 78 additions and 6 deletions
|
@ -4,10 +4,16 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
###################################################
|
||||
- name: Make directory install_c
|
||||
ansible.builtin.file:
|
||||
path: "{{ remote_tmp_dir }}/install_c"
|
||||
state: directory
|
||||
|
||||
- name: Install collection netbox.netbox
|
||||
community.general.ansible_galaxy_install:
|
||||
type: collection
|
||||
name: netbox.netbox
|
||||
dest: "{{ remote_tmp_dir }}/install_c"
|
||||
register: install_c0
|
||||
|
||||
- name: Assert collection netbox.netbox was installed
|
||||
|
@ -20,6 +26,7 @@
|
|||
community.general.ansible_galaxy_install:
|
||||
type: collection
|
||||
name: netbox.netbox
|
||||
dest: "{{ remote_tmp_dir }}/install_c"
|
||||
register: install_c1
|
||||
|
||||
- name: Assert collection was not installed
|
||||
|
@ -28,10 +35,16 @@
|
|||
- install_c1 is not changed
|
||||
|
||||
###################################################
|
||||
- name: Make directory install_r
|
||||
ansible.builtin.file:
|
||||
path: "{{ remote_tmp_dir }}/install_r"
|
||||
state: directory
|
||||
|
||||
- name: Install role ansistrano.deploy
|
||||
community.general.ansible_galaxy_install:
|
||||
type: role
|
||||
name: ansistrano.deploy
|
||||
dest: "{{ remote_tmp_dir }}/install_r"
|
||||
register: install_r0
|
||||
|
||||
- name: Assert collection ansistrano.deploy was installed
|
||||
|
@ -44,6 +57,7 @@
|
|||
community.general.ansible_galaxy_install:
|
||||
type: role
|
||||
name: ansistrano.deploy
|
||||
dest: "{{ remote_tmp_dir }}/install_r"
|
||||
register: install_r1
|
||||
|
||||
- name: Assert role was not installed
|
||||
|
@ -86,3 +100,44 @@
|
|||
assert:
|
||||
that:
|
||||
- install_rq1 is not changed
|
||||
|
||||
###################################################
|
||||
- name: Make directory upgrade_c
|
||||
ansible.builtin.file:
|
||||
path: "{{ remote_tmp_dir }}/upgrade_c"
|
||||
state: directory
|
||||
|
||||
- name: Install collection netbox.netbox 3.17.0
|
||||
community.general.ansible_galaxy_install:
|
||||
type: collection
|
||||
name: netbox.netbox:3.17.0
|
||||
dest: "{{ remote_tmp_dir }}/upgrade_c"
|
||||
register: upgrade_c0
|
||||
|
||||
- name: Assert collection netbox.netbox was installed
|
||||
assert:
|
||||
that:
|
||||
- upgrade_c0 is changed
|
||||
- '"netbox.netbox" in upgrade_c0.new_collections'
|
||||
|
||||
- name: Upgrade collection netbox.netbox
|
||||
community.general.ansible_galaxy_install:
|
||||
state: latest
|
||||
type: collection
|
||||
name: netbox.netbox
|
||||
dest: "{{ remote_tmp_dir }}/upgrade_c"
|
||||
register: upgrade_c1
|
||||
|
||||
- name: Upgrade collection netbox.netbox (again)
|
||||
community.general.ansible_galaxy_install:
|
||||
state: latest
|
||||
type: collection
|
||||
name: netbox.netbox
|
||||
dest: "{{ remote_tmp_dir }}/upgrade_c"
|
||||
register: upgrade_c2
|
||||
|
||||
- name: Assert collection was not installed
|
||||
assert:
|
||||
that:
|
||||
- upgrade_c1 is changed
|
||||
- upgrade_c2 is not changed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue