Hi,
During a test i noticed that if I power on or power off a machine using the module above, the labels of the machine are removed (No other script or interaction is being used, just this task).
Playbook example straightforward:
name: PowerON VM
hosts: all
gather_facts: false
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
- name: Power ON nstance-1
gcp_compute_instance:
status: RUNNING
project: project1
zone: europe-southwest1-a
name: instance-1
delegate_to: localhost
tags:
- encender_individual
--- Ansible version --
bash-4.4# ansible --version
ansible [core 2.15.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.9)
jinja version = 3.1.2
libyaml = True
— This collection versions:
community.google 1.0.0
google.cloud 1.3.
— Runnig enviroment:
Is an execution enviroement in AAP in a container of image RHEL 8.9 running on the base OS RHEL 8.8
Any hint? What is happening? I have tried to add the deletion_protection:true but still doesent work
— For someone who wants to reproduce it —
STEPS TO REPRODUCE
1 Create an instance in GCP
2 Create a static/dynamic/smart inventory with the data of the machine and prepare the credentials to authorize
3Add a label with a key and value to the machine you created
4 Create the following playbook (handle authorization as you need)
name: PowerON VM
hosts: all
gather_facts: false
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
name: Power ON nstance-1
gcp_compute_instance:
status: RUNNING
project: your_project
zone: your_zone
name: name_of_your_instance
delegate_to: localhost
tags:
- poweron
Thanks in advance!