--- - name: Create a Swarm cluster docker_swarm: state: present advertise_addr: "{{ansible_default_ipv4.address | default('127.0.0.1')}}" name: default diff: yes #################################################################### ## autolock_managers ############################################### #################################################################### - name: autolock_managers (check mode) docker_swarm: state: present autolock_managers: yes check_mode: yes diff: yes register: output_1 - name: autolock_managers docker_swarm: state: present autolock_managers: yes diff: yes register: output_2 - name: autolock_managers (idempotent) docker_swarm: state: present autolock_managers: yes diff: yes register: output_3 - name: autolock_managers (idempotent, check mode) docker_swarm: state: present autolock_managers: yes check_mode: yes diff: yes register: output_4 - name: autolock_managers (change, check mode) docker_swarm: state: present autolock_managers: no check_mode: yes diff: yes register: output_5 - name: autolock_managers (change) docker_swarm: state: present autolock_managers: no diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## ca_force_rotate ################################################# #################################################################### - name: ca_force_rotate (check mode) docker_swarm: state: present ca_force_rotate: 1 check_mode: yes diff: yes register: output_1 - name: ca_force_rotate docker_swarm: state: present ca_force_rotate: 1 diff: yes register: output_2 - name: ca_force_rotate (idempotent) docker_swarm: state: present ca_force_rotate: 1 diff: yes register: output_3 - name: ca_force_rotate (idempotent, check mode) docker_swarm: state: present ca_force_rotate: 1 check_mode: yes diff: yes register: output_4 - name: ca_force_rotate (change, check mode) docker_swarm: state: present ca_force_rotate: 0 check_mode: yes diff: yes register: output_5 - name: ca_force_rotate (change) docker_swarm: state: present ca_force_rotate: 0 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## dispatcher_heartbeat_period ##################################### #################################################################### - name: dispatcher_heartbeat_period (check mode) docker_swarm: state: present dispatcher_heartbeat_period: 10 check_mode: yes diff: yes register: output_1 - name: dispatcher_heartbeat_period docker_swarm: state: present dispatcher_heartbeat_period: 10 diff: yes register: output_2 - name: dispatcher_heartbeat_period (idempotent) docker_swarm: state: present dispatcher_heartbeat_period: 10 diff: yes register: output_3 - name: dispatcher_heartbeat_period (idempotent, check mode) docker_swarm: state: present dispatcher_heartbeat_period: 10 check_mode: yes diff: yes register: output_4 - name: dispatcher_heartbeat_period (change, check mode) docker_swarm: state: present dispatcher_heartbeat_period: 23 check_mode: yes diff: yes register: output_5 - name: dispatcher_heartbeat_period (change) docker_swarm: state: present dispatcher_heartbeat_period: 23 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## election_tick ################################################### #################################################################### - name: election_tick (check mode) docker_swarm: state: present election_tick: 20 check_mode: yes diff: yes register: output_1 - name: election_tick docker_swarm: state: present election_tick: 20 diff: yes register: output_2 - name: election_tick (idempotent) docker_swarm: state: present election_tick: 20 diff: yes register: output_3 - name: election_tick (idempotent, check mode) docker_swarm: state: present election_tick: 20 check_mode: yes diff: yes register: output_4 - name: election_tick (change, check mode) docker_swarm: state: present election_tick: 5 check_mode: yes diff: yes register: output_5 - name: election_tick (change) docker_swarm: state: present election_tick: 5 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## heartbeat_tick ################################################## #################################################################### - name: heartbeat_tick (check mode) docker_swarm: state: present heartbeat_tick: 2 check_mode: yes diff: yes register: output_1 - name: heartbeat_tick docker_swarm: state: present heartbeat_tick: 2 diff: yes register: output_2 - name: heartbeat_tick (idempotent) docker_swarm: state: present heartbeat_tick: 2 diff: yes register: output_3 - name: heartbeat_tick (idempotent, check mode) docker_swarm: state: present heartbeat_tick: 2 check_mode: yes diff: yes register: output_4 - name: heartbeat_tick (change, check mode) docker_swarm: state: present heartbeat_tick: 3 check_mode: yes diff: yes register: output_5 - name: heartbeat_tick (change) docker_swarm: state: present heartbeat_tick: 3 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## keep_old_snapshots ############################################## #################################################################### - name: keep_old_snapshots (check mode) docker_swarm: state: present keep_old_snapshots: 1 check_mode: yes diff: yes register: output_1 - name: keep_old_snapshots docker_swarm: state: present keep_old_snapshots: 1 diff: yes register: output_2 - name: keep_old_snapshots (idempotent) docker_swarm: state: present keep_old_snapshots: 1 diff: yes register: output_3 - name: keep_old_snapshots (idempotent, check mode) docker_swarm: state: present keep_old_snapshots: 1 check_mode: yes diff: yes register: output_4 - name: keep_old_snapshots (change, check mode) docker_swarm: state: present keep_old_snapshots: 2 check_mode: yes diff: yes register: output_5 - name: keep_old_snapshots (change) docker_swarm: state: present keep_old_snapshots: 2 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## labels ########################################################## #################################################################### - name: labels (check mode) docker_swarm: state: present labels: a: v1 b: v2 check_mode: yes diff: yes register: output_1 - name: labels docker_swarm: state: present labels: a: v1 b: v2 diff: yes register: output_2 - name: labels (idempotent) docker_swarm: state: present labels: a: v1 b: v2 diff: yes register: output_3 - name: labels (idempotent, check mode) docker_swarm: state: present labels: a: v1 b: v2 check_mode: yes diff: yes register: output_4 - name: labels (change, check mode) docker_swarm: state: present labels: a: v1 c: v3 check_mode: yes diff: yes register: output_5 - name: labels (change) docker_swarm: state: present labels: a: v1 c: v3 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## log_entries_for_slow_followers ################################## #################################################################### - name: log_entries_for_slow_followers (check mode) docker_swarm: state: present log_entries_for_slow_followers: 42 check_mode: yes diff: yes register: output_1 - name: log_entries_for_slow_followers docker_swarm: state: present log_entries_for_slow_followers: 42 diff: yes register: output_2 - name: log_entries_for_slow_followers (idempotent) docker_swarm: state: present log_entries_for_slow_followers: 42 diff: yes register: output_3 - name: log_entries_for_slow_followers (idempotent, check mode) docker_swarm: state: present log_entries_for_slow_followers: 42 check_mode: yes diff: yes register: output_4 - name: log_entries_for_slow_followers (change, check mode) docker_swarm: state: present log_entries_for_slow_followers: 23 check_mode: yes diff: yes register: output_5 - name: log_entries_for_slow_followers (change) docker_swarm: state: present log_entries_for_slow_followers: 23 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## name ############################################################ #################################################################### - name: name (idempotent, check mode) docker_swarm: state: present name: default check_mode: yes diff: yes register: output_1 - name: name (idempotent) docker_swarm: state: present name: default diff: yes register: output_2 # The name 'default' is hardcoded in docker swarm. Trying to change # it causes a failure. This might change in the future, so we also # accept a change for this test. - name: name (change, should fail) docker_swarm: state: present name: foobar diff: yes register: output_3 ignore_errors: yes - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is not changed' - 'output_1.actions[0] == "No modification"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is not changed' - 'output_2.actions[0] == "No modification"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is failed or output_3 is changed' #################################################################### ## node_cert_expiry ################################################ #################################################################### - name: node_cert_expiry (check mode) docker_swarm: state: present node_cert_expiry: 7896000000000000 check_mode: yes diff: yes register: output_1 - name: node_cert_expiry docker_swarm: state: present node_cert_expiry: 7896000000000000 diff: yes register: output_2 - name: node_cert_expiry (idempotent) docker_swarm: state: present node_cert_expiry: 7896000000000000 diff: yes register: output_3 - name: node_cert_expiry (idempotent, check mode) docker_swarm: state: present node_cert_expiry: 7896000000000000 check_mode: yes diff: yes register: output_4 - name: node_cert_expiry (change, check mode) docker_swarm: state: present node_cert_expiry: 8766000000000000 check_mode: yes diff: yes register: output_5 - name: node_cert_expiry (change) docker_swarm: state: present node_cert_expiry: 8766000000000000 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## rotate_manager_token ############################################ #################################################################### - name: rotate_manager_token (true, check mode) docker_swarm: state: present rotate_manager_token: yes check_mode: yes diff: yes register: output_1 - name: rotate_manager_token (true) docker_swarm: state: present rotate_manager_token: yes diff: yes register: output_2 - name: rotate_manager_token (false, idempotent) docker_swarm: state: present rotate_manager_token: no diff: yes register: output_3 - name: rotate_manager_token (false, check mode) docker_swarm: state: present rotate_manager_token: no check_mode: yes diff: yes register: output_4 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' #################################################################### ## rotate_worker_token ############################################# #################################################################### - name: rotate_worker_token (true, check mode) docker_swarm: state: present rotate_worker_token: yes check_mode: yes diff: yes register: output_1 - name: rotate_worker_token (true) docker_swarm: state: present rotate_worker_token: yes diff: yes register: output_2 - name: rotate_worker_token (false, idempotent) docker_swarm: state: present rotate_worker_token: no diff: yes register: output_3 - name: rotate_worker_token (false, check mode) docker_swarm: state: present rotate_worker_token: no check_mode: yes diff: yes register: output_4 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' #################################################################### ## snapshot_interval ############################################### #################################################################### - name: snapshot_interval (check mode) docker_swarm: state: present snapshot_interval: 12345 check_mode: yes diff: yes register: output_1 - name: snapshot_interval docker_swarm: state: present snapshot_interval: 12345 diff: yes register: output_2 - name: snapshot_interval (idempotent) docker_swarm: state: present snapshot_interval: 12345 diff: yes register: output_3 - name: snapshot_interval (idempotent, check mode) docker_swarm: state: present snapshot_interval: 12345 check_mode: yes diff: yes register: output_4 - name: snapshot_interval (change, check mode) docker_swarm: state: present snapshot_interval: 54321 check_mode: yes diff: yes register: output_5 - name: snapshot_interval (change) docker_swarm: state: present snapshot_interval: 54321 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined' #################################################################### ## task_history_retention_limit #################################### #################################################################### - name: task_history_retention_limit (check mode) docker_swarm: state: present task_history_retention_limit: 23 check_mode: yes diff: yes register: output_1 - name: task_history_retention_limit docker_swarm: state: present task_history_retention_limit: 23 diff: yes register: output_2 - name: task_history_retention_limit (idempotent) docker_swarm: state: present task_history_retention_limit: 23 diff: yes register: output_3 - name: task_history_retention_limit (idempotent, check mode) docker_swarm: state: present task_history_retention_limit: 23 check_mode: yes diff: yes register: output_4 - name: task_history_retention_limit (change, check mode) docker_swarm: state: present task_history_retention_limit: 7 check_mode: yes diff: yes register: output_5 - name: task_history_retention_limit (change) docker_swarm: state: present task_history_retention_limit: 7 diff: yes register: output_6 - name: assert changed when remove a swarm cluster assert: that: - 'output_1 is changed' - 'output_1.actions[0] == "Swarm cluster updated"' - 'output_1.diff.before is defined' - 'output_1.diff.after is defined' - 'output_2 is changed' - 'output_2.actions[0] == "Swarm cluster updated"' - 'output_2.diff.before is defined' - 'output_2.diff.after is defined' - 'output_3 is not changed' - 'output_3.actions[0] == "No modification"' - 'output_3.diff.before is defined' - 'output_3.diff.after is defined' - 'output_4 is not changed' - 'output_4.actions[0] == "No modification"' - 'output_4.diff.before is defined' - 'output_4.diff.after is defined' - 'output_5 is changed' - 'output_5.actions[0] == "Swarm cluster updated"' - 'output_5.diff.before is defined' - 'output_5.diff.after is defined' - 'output_6 is changed' - 'output_6.actions[0] == "Swarm cluster updated"' - 'output_6.diff.before is defined' - 'output_6.diff.after is defined'