mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-02-04 08:01:49 +00:00
refactor to comply with current ansible-lint and sanity guidelines
Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
05ee6ebc2a
commit
a85f736f6a
68 changed files with 2640 additions and 2407 deletions
|
|
@ -1,124 +1,147 @@
|
|||
- name: ensure idempotency installed
|
||||
package:
|
||||
---
|
||||
- name: Ensure idempotency installed
|
||||
ansible.builtin.package:
|
||||
name: patch
|
||||
when: ansible_distribution != "MacOSX"
|
||||
- name: create a directory for the result
|
||||
file:
|
||||
dest: '{{ output_dir }}/patch'
|
||||
|
||||
- name: Create a directory for the result
|
||||
ansible.builtin.file:
|
||||
dest: "{{ output_dir }}/patch"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
register: result
|
||||
- name: assert the directory was created
|
||||
assert:
|
||||
|
||||
- name: Assert the directory was created
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.state == 'directory'
|
||||
- name: copy the origin file
|
||||
copy:
|
||||
- result.state == 'directory'
|
||||
|
||||
- name: Copy the origin file
|
||||
ansible.builtin.copy:
|
||||
src: ./origin.txt
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
mode: "0644"
|
||||
register: result
|
||||
- name: patch the origin file in check mode
|
||||
|
||||
- name: Patch the origin file in check mode
|
||||
check_mode: true
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
- name: verify patch the origin file in check mode
|
||||
assert:
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
|
||||
- name: Verify patch the origin file in check mode
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: patch the origin file
|
||||
- result is changed
|
||||
|
||||
- name: Patch the origin file
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
- name: verify patch the origin file
|
||||
assert:
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
|
||||
- name: Verify patch the origin file
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: test patch the origin file idempotency
|
||||
- result is changed
|
||||
|
||||
- name: Test patch the origin file idempotency
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
- name: verify test patch the origin file idempotency
|
||||
assert:
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
- name: Verify test patch the origin file idempotency
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- name: verify the resulted file matches expectations
|
||||
copy:
|
||||
- result is not changed
|
||||
|
||||
- name: Verify the resulted file matches expectations
|
||||
ansible.builtin.copy:
|
||||
src: ./result.txt
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
mode: "0644"
|
||||
register: result
|
||||
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
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
state: absent
|
||||
- name: verify patch the workfile file in check mode state absent
|
||||
assert:
|
||||
|
||||
- name: Verify patch the workfile file in check mode state absent
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: patch the workfile file state absent
|
||||
- result is changed
|
||||
|
||||
- name: Patch the workfile file state absent
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
state: absent
|
||||
- name: verify patch the workfile file state absent
|
||||
assert:
|
||||
|
||||
- name: Verify patch the workfile file state absent
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- name: patch the workfile file state absent idempotency
|
||||
- result is changed
|
||||
|
||||
- name: Patch the workfile file state absent idempotency
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result.patch
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
state: absent
|
||||
- name: verify patch the workfile file state absent idempotency
|
||||
assert:
|
||||
|
||||
- name: Verify patch the workfile file state absent idempotency
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- name: verify the resulted file matches expectations
|
||||
copy:
|
||||
- result is not changed
|
||||
|
||||
- name: Verify the resulted file matches expectations
|
||||
ansible.builtin.copy:
|
||||
src: ./origin.txt
|
||||
dest: '{{ output_dir }}/patch/workfile.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile.txt"
|
||||
mode: "0644"
|
||||
register: result
|
||||
failed_when: result is changed
|
||||
|
||||
- name: copy the origin file whitespace
|
||||
copy:
|
||||
- name: Copy the origin file whitespace
|
||||
ansible.builtin.copy:
|
||||
src: ./origin.txt
|
||||
dest: '{{ output_dir }}/patch/workfile_whitespace.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile_whitespace.txt"
|
||||
mode: "0644"
|
||||
register: result
|
||||
|
||||
- name: patch the origin file
|
||||
- name: Patch the origin file
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result_whitespace.patch
|
||||
dest: '{{ output_dir }}/patch/workfile_whitespace.txt'
|
||||
ignore_whitespace: yes
|
||||
- name: verify patch the origin file
|
||||
assert:
|
||||
dest: "{{ output_dir }}/patch/workfile_whitespace.txt"
|
||||
ignore_whitespace: true
|
||||
- name: Verify patch the origin file
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result is changed
|
||||
|
||||
- name: test patch the origin file idempotency
|
||||
- name: Test patch the origin file idempotency
|
||||
register: result
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: result_whitespace.patch
|
||||
dest: '{{ output_dir }}/patch/workfile_whitespace.txt'
|
||||
ignore_whitespace: yes
|
||||
- name: verify test patch the origin file idempotency
|
||||
assert:
|
||||
dest: "{{ output_dir }}/patch/workfile_whitespace.txt"
|
||||
ignore_whitespace: true
|
||||
- name: Verify test patch the origin file idempotency
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result is not changed
|
||||
|
||||
- name: verify the resulted file matches expectations
|
||||
copy:
|
||||
- name: Verify the resulted file matches expectations
|
||||
ansible.builtin.copy:
|
||||
src: ./result_whitespace.txt
|
||||
dest: '{{ output_dir }}/patch/workfile_whitespace.txt'
|
||||
dest: "{{ output_dir }}/patch/workfile_whitespace.txt"
|
||||
mode: "0644"
|
||||
register: result
|
||||
failed_when: result is changed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue