2021-07-29 22:30:20 +02:00
|
|
|
---
|
2022-08-05 14:03:38 +02:00
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-07-29 22:30:20 +02:00
|
|
|
###################################################
|
2024-06-02 00:25:32 +02:00
|
|
|
- name: Make directory install_c
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ remote_tmp_dir }}/install_c"
|
|
|
|
state: directory
|
|
|
|
|
2021-07-29 22:30:20 +02:00
|
|
|
- name: Install collection netbox.netbox
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: collection
|
|
|
|
name: netbox.netbox
|
2024-06-02 00:25:32 +02:00
|
|
|
dest: "{{ remote_tmp_dir }}/install_c"
|
2021-07-29 22:30:20 +02:00
|
|
|
register: install_c0
|
|
|
|
|
2022-12-22 06:45:07 +01:00
|
|
|
- name: Assert collection netbox.netbox was installed
|
2021-07-29 22:30:20 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_c0 is changed
|
|
|
|
- '"netbox.netbox" in install_c0.new_collections'
|
|
|
|
|
|
|
|
- name: Install collection netbox.netbox (again)
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: collection
|
|
|
|
name: netbox.netbox
|
2024-06-02 00:25:32 +02:00
|
|
|
dest: "{{ remote_tmp_dir }}/install_c"
|
2021-07-29 22:30:20 +02:00
|
|
|
register: install_c1
|
|
|
|
|
|
|
|
- name: Assert collection was not installed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_c1 is not changed
|
|
|
|
|
|
|
|
###################################################
|
2024-06-02 00:25:32 +02:00
|
|
|
- name: Make directory install_r
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ remote_tmp_dir }}/install_r"
|
|
|
|
state: directory
|
|
|
|
|
2021-07-29 22:30:20 +02:00
|
|
|
- name: Install role ansistrano.deploy
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: role
|
|
|
|
name: ansistrano.deploy
|
2024-06-02 00:25:32 +02:00
|
|
|
dest: "{{ remote_tmp_dir }}/install_r"
|
2021-07-29 22:30:20 +02:00
|
|
|
register: install_r0
|
|
|
|
|
2022-12-22 06:45:07 +01:00
|
|
|
- name: Assert collection ansistrano.deploy was installed
|
2021-07-29 22:30:20 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_r0 is changed
|
|
|
|
- '"ansistrano.deploy" in install_r0.new_roles'
|
|
|
|
|
|
|
|
- name: Install role ansistrano.deploy (again)
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: role
|
|
|
|
name: ansistrano.deploy
|
2024-06-02 00:25:32 +02:00
|
|
|
dest: "{{ remote_tmp_dir }}/install_r"
|
2021-07-29 22:30:20 +02:00
|
|
|
register: install_r1
|
|
|
|
|
|
|
|
- name: Assert role was not installed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_r1 is not changed
|
|
|
|
|
|
|
|
###################################################
|
2022-12-22 06:45:07 +01:00
|
|
|
- name: Set requirements file path
|
2021-07-29 22:30:20 +02:00
|
|
|
set_fact:
|
2021-09-09 07:31:44 +02:00
|
|
|
reqs_file: '{{ remote_tmp_dir }}/reqs.yaml'
|
2021-07-29 22:30:20 +02:00
|
|
|
|
|
|
|
- name: Copy requirements file
|
|
|
|
copy:
|
|
|
|
src: 'files/test.yml'
|
|
|
|
dest: '{{ reqs_file }}'
|
|
|
|
|
|
|
|
- name: Install from requirements file
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: both
|
|
|
|
requirements_file: "{{ reqs_file }}"
|
|
|
|
register: install_rq0
|
|
|
|
ignore_errors: true
|
|
|
|
|
2022-04-26 11:51:01 +02:00
|
|
|
- name: Assert requirements file was installed
|
2021-07-29 22:30:20 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_rq0 is changed
|
|
|
|
- '"geerlingguy.java" in install_rq0.new_roles'
|
|
|
|
- '"geerlingguy.php_roles" in install_rq0.new_collections'
|
|
|
|
|
|
|
|
- name: Install from requirements file (again)
|
|
|
|
community.general.ansible_galaxy_install:
|
|
|
|
type: both
|
|
|
|
requirements_file: "{{ reqs_file }}"
|
|
|
|
register: install_rq1
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: Assert requirements file was not installed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- install_rq1 is not changed
|
2024-06-02 00:25:32 +02:00
|
|
|
|
|
|
|
###################################################
|
|
|
|
- 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
|