google.cloud/tests/integration/targets/inventory_gce/playbooks/testcase_hostname.yml
Jorge Gallegos adf05c4ecf
Adding integration test for dynamic inventory plugin
Signed-off-by: Jorge Gallegos <jgallego@redhat.com>
2025-06-10 13:57:27 -07:00

22 lines
608 B
YAML

---
- name: TEST | print hosts
ansible.builtin.debug:
var: groups
- name: TEST | fetch instance info for vm1
google.cloud.gcp_compute_instance_info:
filters:
- name = {{ prefix }}-vm1
zone: "{{ gcp_zone }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
register: _vm
- name: TEST | compare API vs inventory hostnames
ansible.builtin.assert:
that:
- _vm.resources | length > 0
- _vm.resources[0].hostname in groups['gcp_dns_static']