mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 15:15:26 +01:00
Enable at, patch and synchronize tests (#5)
* Enable at, patch and synchronize tests * Remove commented out tasks * Skip currently unsupported platforms * Skip AIX on at
This commit is contained in:
parent
ce9ec16375
commit
27482c25f9
6 changed files with 57 additions and 19 deletions
|
|
@ -1,3 +1,2 @@
|
||||||
shippable/posix/group1
|
shippable/posix/group1
|
||||||
destructive
|
destructive
|
||||||
disabled # fixme package
|
|
||||||
|
|
|
||||||
|
|
@ -16,34 +16,37 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: >-
|
||||||
|
Skipping {{ ansible_distribution }} as ansible-base does not contain
|
||||||
|
the packaging module ({{ ansible_pkg_mgr }}) for this operating system
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum'] or ansible_distribution in ['AIX']
|
||||||
|
|
||||||
|
- name: stop executing on hosts that we don't have package manager modules for
|
||||||
|
meta: end_host
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum'] or ansible_distribution in ['AIX']
|
||||||
|
|
||||||
- set_fact: output_dir_test={{output_dir}}/at
|
- set_fact: output_dir_test={{output_dir}}/at
|
||||||
|
|
||||||
- name: make sure our testing sub-directory does not exist
|
- name: make sure our testing sub-directory does not exist
|
||||||
file: path="{{ output_dir_test }}" state=absent
|
file:
|
||||||
|
path: "{{ output_dir_test }}"
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: create our testing sub-directory
|
- name: create our testing sub-directory
|
||||||
file: path="{{ output_dir_test }}" state=directory
|
file:
|
||||||
|
path: "{{ output_dir_test }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
##
|
##
|
||||||
## at
|
## at
|
||||||
##
|
##
|
||||||
|
|
||||||
- name: define distros to attempt installing at on
|
|
||||||
set_fact:
|
|
||||||
package_distros:
|
|
||||||
- RedHat
|
|
||||||
- CentOS
|
|
||||||
- ScientificLinux
|
|
||||||
- Fedora
|
|
||||||
- Ubuntu
|
|
||||||
- Debian
|
|
||||||
- openSUSE Leap
|
|
||||||
|
|
||||||
- name: ensure at is installed
|
- name: ensure at is installed
|
||||||
package:
|
package:
|
||||||
name: at
|
name: at
|
||||||
state: present
|
state: present
|
||||||
when: ansible_distribution in package_distros
|
when: ansible_pkg_mgr in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
- name: run the first example
|
- name: run the first example
|
||||||
at:
|
at:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
destructive
|
destructive
|
||||||
shippable/posix/group1
|
shippable/posix/group1
|
||||||
skip/aix
|
skip/aix
|
||||||
disabled # fixme package
|
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,76 @@
|
||||||
|
- debug:
|
||||||
|
msg: >-
|
||||||
|
Skipping {{ ansible_distribution }} as ansible-base does not contain
|
||||||
|
the packaging module ({{ ansible_pkg_mgr }}) for this operating system
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
|
- name: stop executing on hosts that we don't have package manager modules for
|
||||||
|
meta: end_host
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
- name: ensure idempotency installed
|
- name: ensure idempotency installed
|
||||||
package:
|
package:
|
||||||
name: patch
|
name: patch
|
||||||
when: ansible_distribution != "MacOSX"
|
when: ansible_pkg_mgr in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
- name: create a directory for the result
|
- name: create a directory for the result
|
||||||
file:
|
file:
|
||||||
dest: '{{ output_dir }}/patch'
|
dest: '{{ output_dir }}/patch'
|
||||||
state: directory
|
state: directory
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: assert the directory was created
|
- name: assert the directory was created
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result.state == 'directory'
|
- result.state == 'directory'
|
||||||
|
|
||||||
- name: copy the origin file
|
- name: copy the origin file
|
||||||
copy:
|
copy:
|
||||||
src: ./origin.txt
|
src: ./origin.txt
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: patch the origin file in check mode
|
- name: patch the origin file in check mode
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: result
|
register: result
|
||||||
patch:
|
patch:
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
|
|
||||||
- name: verify patch the origin file in check mode
|
- name: verify patch the origin file in check mode
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: patch the origin file
|
- name: patch the origin file
|
||||||
register: result
|
register: result
|
||||||
patch:
|
patch:
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
|
|
||||||
- name: verify patch the origin file
|
- name: verify patch the origin file
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: test patch the origin file idempotency
|
- name: test patch the origin file idempotency
|
||||||
register: result
|
register: result
|
||||||
patch:
|
patch:
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
|
|
||||||
- name: verify test patch the origin file idempotency
|
- name: verify test patch the origin file idempotency
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
|
|
||||||
- name: verify the resulted file matches expectations
|
- name: verify the resulted file matches expectations
|
||||||
copy:
|
copy:
|
||||||
src: ./result.txt
|
src: ./result.txt
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
register: result
|
register: result
|
||||||
failed_when: result is changed
|
failed_when: result is changed
|
||||||
|
|
||||||
- name: patch the workfile file in check mode state absent
|
- name: patch the workfile file in check mode state absent
|
||||||
check_mode: true
|
check_mode: true
|
||||||
register: result
|
register: result
|
||||||
|
|
@ -57,30 +78,36 @@
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: verify patch the workfile file in check mode state absent
|
- name: verify patch the workfile file in check mode state absent
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: patch the workfile file state absent
|
- name: patch the workfile file state absent
|
||||||
register: result
|
register: result
|
||||||
patch:
|
patch:
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: verify patch the workfile file state absent
|
- name: verify patch the workfile file state absent
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
- name: patch the workfile file state absent idempotency
|
- name: patch the workfile file state absent idempotency
|
||||||
register: result
|
register: result
|
||||||
patch:
|
patch:
|
||||||
src: result.patch
|
src: result.patch
|
||||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: verify patch the workfile file state absent idempotency
|
- name: verify patch the workfile file state absent idempotency
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
|
|
||||||
- name: verify the resulted file matches expectations
|
- name: verify the resulted file matches expectations
|
||||||
copy:
|
copy:
|
||||||
src: ./origin.txt
|
src: ./origin.txt
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
shippable/posix/group1
|
shippable/posix/group1
|
||||||
disabled # fixme package
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,18 @@
|
||||||
|
- debug:
|
||||||
|
msg: >-
|
||||||
|
Skipping {{ ansible_distribution }} as ansible-base does not contain
|
||||||
|
the packaging module ({{ ansible_pkg_mgr }}) for this operating system
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
|
- name: stop executing on hosts that we don't have package manager modules for
|
||||||
|
meta: end_host
|
||||||
|
when: ansible_pkg_mgr not in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
- name: install rsync
|
- name: install rsync
|
||||||
package:
|
package:
|
||||||
name: rsync
|
name: rsync
|
||||||
when: ansible_distribution != "MacOSX"
|
when: ansible_pkg_mgr in ['apt', 'dnf', 'yum']
|
||||||
|
|
||||||
- name: cleanup old files
|
- name: cleanup old files
|
||||||
shell: rm -rf {{output_dir}}/*
|
shell: rm -rf {{output_dir}}/*
|
||||||
- name: create test new files
|
- name: create test new files
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue