--- # Run by verify.yml in a child ansible-playbook process, because the mint guard reads the # controller's environment (lookup env), which a play cannot change; the child gets its # environment from the task that starts it, so the result does not depend on what the runner # exports. The child uses `-i localhost,` and so does not see the molecule group_vars: verify.yml # passes the inputs with -e, and cloudflared_test_expect_minted says what to assert afterwards. - name: Mint with a controlled environment hosts: localhost connection: local gather_facts: false tasks: - name: Run the mint entry point ansible.builtin.include_role: name: mortis.kamino.cloudflared tasks_from: mint vars: cloudflared_mint_confirm: true - name: No tunnel fact was registered ansible.builtin.assert: that: - cloudflared_minted_tunnel_id is not defined - cloudflared_minted_credentials_json is not defined quiet: true when: not (cloudflared_test_expect_minted | default(false) | bool) - name: Parse the minted credentials ansible.builtin.set_fact: cloudflared_test_minted: "{{ cloudflared_minted_credentials_json | from_json }}" no_log: true when: cloudflared_test_expect_minted | default(false) | bool # The stub accepted the secret only as base64 of at least 32 bytes; 32 bytes are 44 # characters. The secret and the API response must not stay in the host's variables. - name: The tunnel facts were registered and the intermediates cleared ansible.builtin.assert: that: - cloudflared_minted_tunnel_id is match('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') - cloudflared_test_minted.TunnelID == cloudflared_minted_tunnel_id - cloudflared_test_minted.AccountTag == cloudflared_account_id - cloudflared_test_minted.TunnelName == cloudflared_tunnel_name - cloudflared_test_minted.TunnelSecret | length == 44 - __cloudflared_tunnel_secret == "" - __cloudflared_tunnel_create == "" fail_msg: The minted tunnel facts are missing or wrong, or an intermediate was kept quiet: true no_log: true when: cloudflared_test_expect_minted | default(false) | bool