nodes_wait 60 || true # ans CMD: run CMD as greg in his project directory. ans() { timeout 300 runuser -l greg -c "cd ~/ansible && $*" /dev/null | grep -qx MANIFEST.json' need "ansible.posix is installed in $P/collections" '[ -f $P/collections/ansible_collections/ansible/posix/MANIFEST.json ]' need "ansible-galaxy collection list shows it under the project's collections directory" 'ans ansible-galaxy collection list ansible.posix 2>/dev/null | grep -qx "# $P/collections/ansible_collections"' task 2 "community.general for this ansible-core, and ini.yml using ini_file" need "ansible-doc community.general.ini_file works" 'ans ansible-doc community.general.ini_file >"$OUT" 2>&1 && grep -q "^> COMMUNITY.GENERAL.INI_FILE" "$OUT"' need "the installed community.general supports this ansible-core (no \"does not support\" warning)" '! grep -q "does not support Ansible version" "$OUT"' need "/home/greg/ansible/ini.yml exists and uses community.general" 'grep -q "community\.general" $P/ini.yml' need "ansible-playbook ini.yml runs without failures" 'ans ansible-playbook ini.yml >"$OUT" 2>&1; grep -Eq "^node1 +: ok=" "$OUT" && ! grep -E " : ok=" "$OUT" | grep -Eq "(unreachable|failed)=[1-9]"' need "node1's /etc/lab.ini has port = 8080 in [web]" "in_node node1 python3 -c 'import configparser, sys; c = configparser.ConfigParser(); c.read(\"/etc/lab.ini\"); sys.exit(c.get(\"web\", \"port\", fallback=\"\") != \"8080\")'" task 3 "community.crypto installed with -p outside collections_path" need "community.crypto is installed in /home/greg/elsewhere" '[ -f /home/greg/elsewhere/ansible_collections/community/crypto/MANIFEST.json ]' need "Ansible can't find its modules: ansible-doc community.crypto.openssl_privatekey fails" '! ans ansible-doc community.crypto.openssl_privatekey 2>/dev/null | grep -q "^> COMMUNITY.CRYPTO.OPENSSL_PRIVATEKEY"' rm -f "$OUT"