1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/ansible_galaxy_install/tasks/main.yml
patchback[bot] 6037c5d1e6
[PR #5680/488e828f backport][stable-6] ansible_galaxy_install: use locale C tentatively, else en_US (#5722)
ansible_galaxy_install: use locale C tentatively, else en_US (#5680)

* ansible_galaxy_install: use locale C tentatively, else en_US

* use custom exception to signal unsupported locale

* add step to remove artefacts at the end of the test

* add step to remove artefacts at the beginning of the test

* comment out context controller

* trying with temporary dir as destination

* remove collection before test with reqs file

* ensure collections are installed in temp dir in tests + check_force

* simplified the change

* added extra condition for failing locale

* improved exception handling

* add changelog fragment

(cherry picked from commit 488e828f9b)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-12-22 06:00:34 +00:00

88 lines
2.3 KiB
YAML

---
# 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
###################################################
- name: Install collection netbox.netbox
community.general.ansible_galaxy_install:
type: collection
name: netbox.netbox
register: install_c0
- name: Assert collection netbox.netbox was installed
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
register: install_c1
- name: Assert collection was not installed
assert:
that:
- install_c1 is not changed
###################################################
- name: Install role ansistrano.deploy
community.general.ansible_galaxy_install:
type: role
name: ansistrano.deploy
register: install_r0
- name: Assert collection ansistrano.deploy was installed
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
register: install_r1
- name: Assert role was not installed
assert:
that:
- install_r1 is not changed
###################################################
- name: Set requirements file path
set_fact:
reqs_file: '{{ remote_tmp_dir }}/reqs.yaml'
- 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
- name: Assert requirements file was installed
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