nodes_wait 60 || true # ans CMD: run CMD as greg in his project directory. ans() { setsid -w timeout 300 runuser -l greg -c "cd ~/ansible && $*" "$OUT"; recap0' task 2 "dd.yml makes /root/swapfile with dd, only once" need "/home/greg/ansible/dd.yml exists, with a dd command" "[ -f $A/dd.yml ] && grep -q 'dd ' $A/dd.yml" for n in $(nodes_names); do need "/root/swapfile on $n is 16 MiB" "[ \"\$(in_node $n stat -c %s /root/swapfile)\" = 16777216 ]" done need "a second run of dd.yml reports changed=0 and leaves the files alone" 'before=$(for n in $(nodes_names); do in_node $n stat -c %Y /root/swapfile; done); ans ansible-playbook dd.yml >"$OUT"; recap0 && [ "$before" = "$(for n in $(nodes_names); do in_node $n stat -c %Y /root/swapfile; done)" ]' task 3 "sshver.yml prints openssh-server's version on every node" need "/home/greg/ansible/sshver.yml exists" "[ -f $A/sshver.yml ]" need "sshver.yml doesn't run rpm" "! grep -Eq '(^|[^_a-z])rpm +-' $A/sshver.yml" need "running sshver.yml prints each node's openssh-server version" 'ans ansible-playbook sshver.yml >"$OUT" || exit 1 for n in $(nodes_names); do v=$(in_node $n rpm -q --qf "%{VERSION}" openssh-server) awk -v n="$n" "\$0 == \"ok: [\" n \"] => {\" {f=1} f {print} /^}/ {f=0}" "$OUT" | grep -qF "$v" || exit 1 done' rm -f "$OUT"