Skip to content
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

Try to taint server resources on patch #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should extract all of this into something we can use more easily for other appliances.

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