mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
203747027e
* Move licenses to LICENSES/, run add-license.py, add LICENSES/MIT.txt.
* Replace 'Copyright:' with 'Copyright'
sed -i 's|Copyright:\(.*\)|Copyright\1|' $(rg -l 'Copyright:')
Co-authored-by: Maxwell G <gotmax@e.email>
(cherry picked from commit 123c7efe5e
)
Co-authored-by: Felix Fontein <felix@fontein.de>
98 lines
2.6 KiB
YAML
98 lines
2.6 KiB
YAML
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
# Test code for the homebrew module.
|
|
# Copyright (c) 2020, Abhijeet Kasurde <akasurde@redhat.com>
|
|
# 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: Find brew binary
|
|
command: which brew
|
|
register: brew_which
|
|
when: ansible_distribution in ['MacOSX']
|
|
|
|
- name: Get owner of brew binary
|
|
stat:
|
|
path: "{{ brew_which.stdout }}"
|
|
register: brew_stat
|
|
when: ansible_distribution in ['MacOSX']
|
|
|
|
#- name: Use ignored-pinned option while upgrading all
|
|
# homebrew:
|
|
# upgrade_all: yes
|
|
# upgrade_options: ignore-pinned
|
|
# become: yes
|
|
# become_user: "{{ brew_stat.stat.pw_name }}"
|
|
# register: upgrade_option_result
|
|
# environment:
|
|
# HOMEBREW_NO_AUTO_UPDATE: True
|
|
|
|
#- assert:
|
|
# that:
|
|
# - upgrade_option_result.changed
|
|
|
|
- vars:
|
|
package_name: gnu-tar
|
|
|
|
block:
|
|
- name: Make sure {{ package_name }} package is not installed
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
|
|
- name: Install {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: present
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result.changed
|
|
|
|
- name: Again install {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: present
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- not package_result.changed
|
|
|
|
- name: Uninstall {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result.changed
|
|
|
|
- name: Again uninstall {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- not package_result.changed
|