mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-03-22 02:29:08 +00:00
Add diff and change detection to systemd generation (#608)
Fix #339 Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
cc34c2b780
commit
7a307453a5
5 changed files with 203 additions and 28 deletions
|
|
@ -0,0 +1,123 @@
|
|||
# Systemd generation
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
name: idempotency
|
||||
state: absent
|
||||
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: started
|
||||
command: 1h
|
||||
generate_systemd:
|
||||
path: /tmp/
|
||||
restart_policy: always
|
||||
time: 120
|
||||
no_header: true
|
||||
names: true
|
||||
pod_prefix: whocares
|
||||
separator: zzzz
|
||||
container_prefix: contain
|
||||
register: system0
|
||||
|
||||
- name: Check if the result is changed
|
||||
assert:
|
||||
that:
|
||||
- system0 is changed
|
||||
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: started
|
||||
command: 1h
|
||||
generate_systemd:
|
||||
path: /tmp/
|
||||
restart_policy: always
|
||||
time: 120
|
||||
no_header: true
|
||||
names: true
|
||||
pod_prefix: whocares
|
||||
separator: zzzz
|
||||
container_prefix: contain
|
||||
register: system1
|
||||
|
||||
- name: Check if the result is not changed
|
||||
assert:
|
||||
that:
|
||||
- system1 is not changed
|
||||
|
||||
- name: Remove the systemd unit file
|
||||
ansible.builtin.file:
|
||||
path: /tmp/containzzzzidempotency.service
|
||||
state: absent
|
||||
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: started
|
||||
command: 1h
|
||||
generate_systemd:
|
||||
path: /tmp/
|
||||
restart_policy: always
|
||||
time: 120
|
||||
no_header: true
|
||||
names: true
|
||||
pod_prefix: whocares
|
||||
separator: zzzz
|
||||
container_prefix: contain
|
||||
register: system2
|
||||
|
||||
- name: Check if the result is changed
|
||||
assert:
|
||||
that:
|
||||
- system2 is changed
|
||||
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: started
|
||||
command: 1h
|
||||
generate_systemd:
|
||||
path: /tmp/
|
||||
restart_policy: always
|
||||
time: 120
|
||||
no_header: true
|
||||
names: true
|
||||
pod_prefix: whocares
|
||||
separator: zzzz
|
||||
container_prefix: contain
|
||||
register: system3
|
||||
|
||||
- name: Check if the result is not changed
|
||||
assert:
|
||||
that:
|
||||
- system3 is not changed
|
||||
|
||||
- name: Add string to change the systemd unit file
|
||||
ansible.builtin.shell: echo 'test=onetwo' >> /tmp/containzzzzidempotency.service
|
||||
|
||||
- containers.podman.podman_container:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: "{{ idem_image }}"
|
||||
name: idempotency
|
||||
state: started
|
||||
command: 1h
|
||||
generate_systemd:
|
||||
path: /tmp/
|
||||
restart_policy: always
|
||||
time: 120
|
||||
no_header: true
|
||||
names: true
|
||||
pod_prefix: whocares
|
||||
separator: zzzz
|
||||
container_prefix: contain
|
||||
register: system4
|
||||
|
||||
- name: Check if the result is changed
|
||||
assert:
|
||||
that:
|
||||
- system4 is changed
|
||||
|
|
@ -23,6 +23,9 @@
|
|||
- name: Test idempotency of containers in pods
|
||||
include_tasks: idem_pods.yml
|
||||
|
||||
- name: Test idempotency of systemd generation
|
||||
include_tasks: idem_systemd.yml
|
||||
|
||||
- name: Test idempotency of other settings
|
||||
include_tasks: idem_all.yml
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue