Skip to content

Commit

Permalink
Try to taint server resources on patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnGarbutt committed Oct 15, 2024
1 parent 4c07815 commit dfcc54e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ __pycache__
/inventory
/collections
/bin
/clouds.yaml
/clouds.yaml
.vscode/*
29 changes: 29 additions & 0 deletions roles/cluster_infra/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,35 @@
- providers.tf
- resources.tf

- name: Find terraform outputs, just to initi tofu state
azimuth_cloud.terraform.terraform_output:
project_path: "{{ terraform_project_path }}"
binary_path: "{{ terraform_binary_path }}"
backend_config_files:
- "{{ terraform_project_path }}/backend_config.json"
when:
- azimuth_update_reason is defined
- azimuth_update_reason == 'patch'

- name: Terraform look at the current state list
ansible.builtin.command: "{{ terraform_binary_path }} state list"
args:
chdir: "{{ terraform_project_path }}"
when:
- azimuth_update_reason is defined
- azimuth_update_reason == 'patch'
register: terraform_state_list

- name: Taint all servers if this is a patch update
ansible.builtin.command: "{{ terraform_binary_path }} taint openstack_compute_instance_v2.cluster_server"
args:
chdir: "{{ terraform_project_path }}"
with_items: "{{ terraform_state_list.stdout_lines }}"
when:
- azimuth_update_reason is defined
- azimuth_update_reason == 'patch'
- item is match("openstack_compute_instance_v2..*")

- name: Provision infrastructure
community.general.terraform:
binary_path: "{{ terraform_binary_path }}"
Expand Down

0 comments on commit dfcc54e

Please sign in to comment.