mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Had been using bash package, because it's not likely to disappear from the package repository any time soon. Turns out that bash is already installed on the Ansible community.general FreeBSD CI VM image, which makes the test fail. Zsh probably isn't going away any time soon, either, and likely won't be installed on the CI image.
115 lines
3.2 KiB
YAML
115 lines
3.2 KiB
YAML
---
|
|
- name: Test on FreeBSD VMs
|
|
when:
|
|
- ansible_facts.virtualization_type != 'docker'
|
|
- ansible_facts.distribution == 'FreeBSD'
|
|
block:
|
|
##
|
|
## pkgng - example - install single package
|
|
##
|
|
- name: Verify zsh binary is not present
|
|
stat:
|
|
path: /usr/local/bin/zsh
|
|
get_attributes: no
|
|
get_checksum: no
|
|
get_mime: no
|
|
register: pkgng_example1_stat_before
|
|
|
|
- name: Install zsh
|
|
pkgng:
|
|
name: zsh
|
|
register: pkgng_example1
|
|
|
|
- name: Remove zsh (checkmode)
|
|
pkgng:
|
|
name: zsh
|
|
state: absent
|
|
check_mode: yes
|
|
register: pkgng_example1_checkmode
|
|
|
|
- name: Install zsh (idempotent)
|
|
pkgng:
|
|
name: zsh
|
|
register: pkgng_example1_idempotent
|
|
|
|
- name: Verify zsh binary is present
|
|
stat:
|
|
path: /usr/local/bin/zsh
|
|
get_attributes: no
|
|
get_checksum: no
|
|
get_mime: no
|
|
register: pkgng_example1_stat_after
|
|
|
|
- name: Ensure pkgng installs package correctly
|
|
assert:
|
|
that:
|
|
- not pkgng_example1_stat_before.stat.exists
|
|
- pkgng_example1.changed
|
|
- pkgng_example1_checkmode.changed
|
|
- not pkgng_example1_idempotent.changed
|
|
- pkgng_example1_stat_after.stat.exists
|
|
- pkgng_example1_stat_after.stat.executable
|
|
|
|
##
|
|
## pkgng - example - Install zsh in jail
|
|
##
|
|
- name: Test within jail
|
|
#
|
|
# NOTE: FreeBSD 12.0 test runner receives a "connection reset by peer" after ~20% downloaded so we are
|
|
# only running this on 12.1 or higher
|
|
#
|
|
when: ansible_distribution_version is version('12.01', '>=')
|
|
block:
|
|
- name: Setup testjail
|
|
include: setup-testjail.yml
|
|
|
|
- name: Verify zsh binary is not present
|
|
stat:
|
|
path: /usr/jails/testjail/usr/local/bin/zsh
|
|
get_attributes: no
|
|
get_checksum: no
|
|
get_mime: no
|
|
register: pkgng_example2_stat_before
|
|
|
|
- name: Install zsh
|
|
pkgng:
|
|
name: zsh
|
|
jail: testjail
|
|
register: pkgng_example2
|
|
|
|
- name: Remove zsh (checkmode)
|
|
pkgng:
|
|
name: zsh
|
|
state: absent
|
|
jail: testjail
|
|
check_mode: yes
|
|
register: pkgng_example2_checkmode
|
|
|
|
- name: Install zsh (idempotent)
|
|
pkgng:
|
|
name: zsh
|
|
jail: testjail
|
|
register: pkgng_example2_idempotent
|
|
|
|
- name: Verify zsh binary is present
|
|
stat:
|
|
path: /usr/jails/testjail/usr/local/bin/zsh
|
|
get_attributes: no
|
|
get_checksum: no
|
|
get_mime: no
|
|
register: pkgng_example2_stat_after
|
|
|
|
- name: Ensure pkgng installs package correctly
|
|
assert:
|
|
that:
|
|
- not pkgng_example2_stat_before.stat.exists
|
|
- pkgng_example2.changed
|
|
- pkgng_example2_checkmode.changed
|
|
- not pkgng_example2_idempotent.changed
|
|
- pkgng_example2_stat_after.stat.exists
|
|
- pkgng_example2_stat_after.stat.executable
|
|
always:
|
|
- name: Stop and remove testjail
|
|
failed_when: false
|
|
changed_when: false
|
|
command: "ezjail-admin delete -wf testjail"
|