Merge branch 'main' into feat/apt-cache-valid-time
This commit is contained in:
commit
9ae5eca2a3
26 files changed
+1192
-623
No files matched your search
@@ -20,116 +20,3 @@
|
||||
max-concurrent-downloads: 3
|
||||
roles:
|
||||
- role: mortis.kamino.docker
|
||||
|
||||
# The plays below are refusals: argument_specs rejects the wrong types before any task runs,
|
||||
# so the idempotence run stays clean. A sentinel in the failure message tells "the role
|
||||
# refused" from "the fail task after the role ran", which a bare rescue cannot.
|
||||
- name: A docker_users value that is not a list is refused
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_users:
|
||||
not: a-list
|
||||
tasks:
|
||||
- name: Apply the role with a mapping for docker_users
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the wrong type was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The argument check stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_users' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
- name: A docker_remove value that is not a boolean is refused
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_remove: maybe
|
||||
tasks:
|
||||
- name: Apply the role with a non-boolean docker_remove
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the wrong type was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The argument check stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_remove' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# The architecture is written into the one-line apt source, so a value with a space or a bracket is refused before anything
|
||||
# changes. The derived default is covered by the converge above and verify.yml (the container is x86_64, so the source says amd64).
|
||||
- name: A docker_apt_arch value that would corrupt the apt source is refused
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: "bad arch"
|
||||
tasks:
|
||||
- name: Apply the role with a bad architecture
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the bad architecture was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The validation stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_apt_arch' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# The unit timings are checked before anything changes.
|
||||
- name: A docker_stop_at_shutdown_timeout of 0 is refused
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_stop_at_shutdown_timeout: 0
|
||||
tasks:
|
||||
- name: Apply the role with a timeout of 0
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the timeout was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The validation stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_stop_at_shutdown_timeout' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# A key that docker_daemon_options and a dedicated input both set, and a log value dockerd would reject, stop the run before any change.
|
||||
- name: A bad daemon setting is refused
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Apply the role with each bad setting
|
||||
ansible.builtin.include_tasks: tasks/refuse_daemon.yml
|
||||
vars:
|
||||
docker_refused: "{{ item }}"
|
||||
loop:
|
||||
- {docker_live_restore: true, docker_daemon_options: {live-restore: false}}
|
||||
- {docker_log_driver: local, docker_daemon_options: {log-driver: json-file}}
|
||||
- {docker_log_max_size: 10m, docker_daemon_options: {log-opts: {max-size: 1m}}}
|
||||
- {docker_log_driver: Local}
|
||||
- {docker_log_max_size: ten}
|
||||
- {docker_log_max_file: "0"}
|
||||
- {docker_log_max_file: "-1"}
|
||||
@@ -1,4 +1,133 @@
|
||||
---
|
||||
# The refusals need no container, so they run once, on the controller, in check mode so that a
|
||||
# refusal that regressed cannot change it. The controller has no gathered facts, so a play that
|
||||
# does not test the architecture sets it. A sentinel in the failure message tells "the role
|
||||
# refused" from "the fail task after the role ran", which a bare rescue cannot.
|
||||
- name: A docker_users value that is not a list is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
check_mode: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: amd64
|
||||
docker_users:
|
||||
not: a-list
|
||||
tasks:
|
||||
- name: Apply the role with a mapping for docker_users
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the wrong type was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The argument check stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_users' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
- name: A docker_remove value that is not a boolean is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
check_mode: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: amd64
|
||||
docker_remove: maybe
|
||||
tasks:
|
||||
- name: Apply the role with a non-boolean docker_remove
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the wrong type was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The argument check stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_remove' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# The architecture is written into the one-line apt source, so a value with a space or a bracket is refused before anything
|
||||
# changes. The derived default is covered by converge.yml and the plays below (the container is x86_64, so the source says amd64).
|
||||
- name: A docker_apt_arch value that would corrupt the apt source is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
check_mode: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: "bad arch"
|
||||
tasks:
|
||||
- name: Apply the role with a bad architecture
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the bad architecture was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The validation stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_apt_arch' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# The unit timings are checked before anything changes.
|
||||
- name: A docker_stop_at_shutdown_timeout of 0 is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
check_mode: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: amd64
|
||||
docker_stop_at_shutdown_timeout: 0
|
||||
tasks:
|
||||
- name: Apply the role with a timeout of 0
|
||||
block:
|
||||
- name: Include the role
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.docker
|
||||
- name: Fail when the timeout was accepted
|
||||
ansible.builtin.fail:
|
||||
msg: MOLECULE-ACCEPTED
|
||||
rescue:
|
||||
- name: The validation stopped the play
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
||||
- "'docker_stop_at_shutdown_timeout' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# A key that docker_daemon_options and a dedicated input both set, and a log value dockerd would reject, stop the run before any change.
|
||||
- name: A bad daemon setting is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
check_mode: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
docker_apt_arch: amd64
|
||||
tasks:
|
||||
- name: Apply the role with each bad setting
|
||||
ansible.builtin.include_tasks: tasks/refuse_daemon.yml
|
||||
vars:
|
||||
docker_refused: "{{ item }}"
|
||||
loop:
|
||||
- {docker_live_restore: true, docker_daemon_options: {live-restore: false}}
|
||||
- {docker_log_driver: local, docker_daemon_options: {log-driver: json-file}}
|
||||
- {docker_log_max_size: 10m, docker_daemon_options: {log-opts: {max-size: 1m}}}
|
||||
- {docker_log_driver: Local}
|
||||
- {docker_log_max_size: ten}
|
||||
- {docker_log_max_file: "0"}
|
||||
- {docker_log_max_file: "-1"}
|
||||
|
||||
# What the role is for, as far as stand-in packages can show it: the repository key and the
|
||||
# source line are in place and apt really used them, the packages are installed from that
|
||||
# repository, the unit is enabled and running, and the user joined the group. The second play
|
||||
|
||||
Reference in new issue
Block a user