- 
                Notifications
    
You must be signed in to change notification settings  - Fork 29
 
Miscellaneous resilience improvements #2358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            Stringy
  merged 9 commits into
  master
from
mauro/ansible/miscellaneous-resilience-improvements
  
      
      
   
  Sep 4, 2025 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      dda17c6
              
                Remove us-central1-c zone from ansible playbooks
              
              
                Molter73 db576c1
              
                Use break_when when looping zones in ansible
              
              
                Molter73 163dc8c
              
                Ensure VM is removed on failure
              
              
                Molter73 b42cb48
              
                Update Python version in integration tests
              
              
                Molter73 5c46d2c
              
                Revert "Update Python version in integration tests"
              
              
                Molter73 ad194a6
              
                Revert "Use break_when when looping zones in ansible"
              
              
                Molter73 031a347
              
                Remove unneeded register
              
              
                Molter73 0fe9964
              
                Add instance_created var to control loop execution
              
              
                Stringy 8acdf76
              
                Add us-central1-d
              
              
                Stringy File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| --- | ||
| - name: Safely create GCP compute instance | ||
| block: | ||
| - name: Create compute instance | ||
| google.cloud.gcp_compute_instance: | ||
| name: "{{ vm_name }}" | ||
| project: "{{ gcp_project }}" | ||
| auth_kind: "{{ gcp_auth_kind }}" | ||
| service_account_file: "{{ gcp_service_account_file }}" | ||
| zone: "{{ gcp_zone }}" | ||
| machine_type: "{{ vm_machine_type | default('e2-standard-2') }}" | ||
| disks: | ||
| - auto_delete: true | ||
| boot: true | ||
| initialize_params: | ||
| disk_size_gb: "{{ vm_disk_size | default(20) }}" | ||
| source_image: "{{ gcp_source_image }}" | ||
| network_interfaces: | ||
| - network: "{{ network }}" | ||
| access_configs: | ||
| - name: External NAT | ||
| type: ONE_TO_ONE_NAT | ||
| labels: "{{ gcp_default_labels | combine(gcp_extra_labels) }}" | ||
| metadata: "{{ gcp_meta_data | default({}) }}" | ||
| register: instance_result | ||
| 
     | 
||
| - set_fact: | ||
| instance_created: true | ||
| when: instance_result is defined and instance_result.changed | ||
| rescue: | ||
| - name: Remove failed GCP compute instance | ||
| google.cloud.gcp_compute_instance: | ||
| name: "{{ vm_name }}" | ||
| project: "{{ gcp_project }}" | ||
| auth_kind: "{{ gcp_auth_kind }}" | ||
| service_account_file: "{{ gcp_service_account_file }}" | ||
| zone: "{{ gcp_zone }}" | ||
| state: absent | ||
| when: not instance_created | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.