ansible-collections / ansible-collections/google.cloud
iap connection: gcloud_configuration option should accept gcloud configuration name
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### SUMMARY
iap connection plugin: The gcloud_configuration option should accept configuration name rather than path to configuration.
##### ISSUE TYPE
- Bug Report
##### COMPONENT NAME
iap connection plugin
##### ANSIBLE VERSION
```paste below
ansible [core 2.20.5]
config file = None
configured module search path = ['/home/nia1048596/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/nia1048596/demo/.venv/lib/python3.14/site-packages/ansible
ansible collection location = /home/nia1048596/.ansible/collections:/usr/share/ansible/collections
executable location = /home/nia1048596/demo/.venv/bin/ansible
python version = 3.14.4 (main, Apr 8 2026, 17:48:49) [GCC 15.2.1 20260209] (/home/nia1048596/demo/.venv/bin/python)
jinja version = 3.1.6
pyyaml version = 6.0.3 (with libyaml v0.2.5)
```
##### COLLECTION VERSION
```paste below
# /home/nia1048596/demo/.venv/lib/python3.14/site-packages/ansible_collections
Collection Version
------------ -------
google.cloud 1.13.0
```
##### CONFIGURATION
```paste below
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less
GALAXY_SERVERS:
```
##### OS / ENVIRONMENT
Arch Linux
##### STEPS TO REPRODUCE
Create a new gcloud config `demo`.
```
gcloud config configurations create demo
```
Prepare ansible inventory `hosts.yaml`. The GCP VM `demo` doesn't need to exist.
```
all:
hosts:
demo:
ansible_connection: google.cloud.iap
ansible_gcloud_configuration: demo
```
Execute an ansible ad-hoc command:
```
$ uv run ansible -i hosts.yaml -m command -a hostname -vvvvv all
```
##### EXPECTED RESULTS
gcloud not crashed
##### ACTUAL RESULTS
gcloud crashed
```paste below
ansible [core 2.20.5]
config file = None
configured module search path = ['/home/nia1048596/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/nia1048596/demo/.venv/lib/python3.14/site-packages/ansible
ansible collection location = /home/nia1048596/.ansible/collections:/usr/share/ansible/collections
executable location = /home/nia1048596/demo/.venv/bin/ansible
python version = 3.14.4 (main, Apr 8 2026, 17:48:49) [GCC 15.2.1 20260209] (/home/nia1048596/demo/.venv/bin/python)
jinja version = 3.1.6
pyyaml version = 6.0.3 (with libyaml v0.2.5)
No config file found; using defaults
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /home/nia1048596/demo/hosts.yaml as it did not pass its verify_file() method
script declined parsing /home/nia1048596/demo/hosts.yaml as it did not pass its verify_file() method
Parsed /home/nia1048596/demo/hosts.yaml inventory source with yaml plugin
Loading callback plugin minimal of type stdout, v2.0 from /home/nia1048596/demo/.venv/lib/python3.14/site-packages/ansible/plugins/callback/minimal.py
Attempting to use 'default' callback.
Skipping callback 'default', as we already have a stdout callback.
Attempting to use 'junit' callback.
Attempting to use 'oneline' callback.
Skipping callback 'oneline', as we already have a stdout callback.
Attempting to use 'tree' callback.
Loading collection google.cloud from /home/nia1048596/demo/.venv/lib/python3.14/site-packages/ansible_collections/google/cloud
IAP: CMD /usr/bin/gcloud compute start-iap-tunnel demo 22 --configuration /home/nia1048596/demo/demo
started IAP thread
IAP: TUNNEL FAILURE
ERROR: gcloud crashed (OperationalError): unable to open database file
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
IAP: CLOSING TUNNEL
IAP: STOPPING TUNNEL PROCESS
[ERROR]: Task failed: Failure when starting IAP tunnel
Origin:
{'action': 'command', 'args': {'_raw_params': 'hostname'}, 'timeout': 0, 'async_val': 0, 'poll': 15}
demo | FAILED | rc=-1 >>
Task failed: Failure when starting IAP tunnel
```
Try to manually execute the gcloud command shown in the verbose output
```
$ /usr/bin/gcloud compute start-iap-tunnel demo 22 --configuration /home/nia1048596/demo/demo
ERROR: gcloud crashed (OperationalError): unable to open database file
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
```
It should be `--configuration demo` rather than `--configuration /home/nia1048596/demo/demo`
Contributor guide
Research direction
Start with the google.cloud IAP connection plugin and trace how the ansible_gcloud_configuration inventory value is used to assemble the gcloud command. Reproduce the issue with the provided demo configuration and verbose command, then verify that the command uses --configuration demo rather than a path and the tunnel starts without the database-file error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100