-
Notifications
You must be signed in to change notification settings - Fork 38
Add safety checks to site production environments & Lock instances after site.yml #844
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
Open
bertiethorpe
wants to merge
18
commits into
main
Choose a base branch
from
feat/prevent-prod-changes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f7efa6c
Add protected environment checks hook
bertiethorpe ca47578
populate protected_environments list
bertiethorpe ceaba17
unlock instances before rebuild-via-slurm
bertiethorpe 36a10e7
fix rebuild unlocking
bertiethorpe ccde8b4
Merge branch 'main' into feat/prevent-prod-changes
bertiethorpe 675d3ba
remove site hook
bertiethorpe ab80154
Merge branch 'main' into feat/prevent-prod-changes
bertiethorpe 0a4988d
define protected envs in common vars, improve lock_unlock_instances
bertiethorpe 2576d25
fix locking instances play
bertiethorpe e2d2a93
linting fix
bertiethorpe f842409
linter error
bertiethorpe 0fa67e5
lock playbook path fix
bertiethorpe af27191
document locking/unlocking instances
bertiethorpe 5192f60
linting docs
bertiethorpe 6119c22
fix
bertiethorpe 7b832c3
improve docs style
bertiethorpe 5bb6d98
Review changes / unlock instances before CI cleanup
bertiethorpe f003db8
prettier linting
bertiethorpe 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,27 @@ | ||
| --- | ||
| # Lock or unlock cluster instances | ||
|
|
||
| # Used for site.yml / rebuild-via-slurm.yml | ||
| # Run required for rebuild.yml / tofu destroy / changes to tofu state etc. | ||
|
|
||
| # Examples: | ||
|
|
||
| # ansible-playbook --limit login,control ansible/adhoc/lock-unlock-instances.yml -e "lock_unlock_action=unlock" | ||
|
|
||
| # ansansible-playbook ansible/adhoc/lock-unlock-instances.yml -e "lock_unlock_action=unlock" -e "lock_unlock_hosts=compute" | ||
|
|
||
| # - name: Unlock compute instances | ||
| # vars: | ||
| # lock_unlock_action: unlock | ||
| # lock_unlock_hosts: compute | ||
| # ansible.builtin.import_playbook: lock-unlock-instances.yml | ||
|
|
||
| - hosts: "{{ lock_unlock_hosts | default('cluster') }}" | ||
| gather_facts: false | ||
| become: false | ||
| tasks: | ||
| - name: Lock/Unlock instances | ||
| openstack.cloud.server_action: | ||
| action: "{{ lock_unlock_action | default('lock') }}" | ||
| server: "{{ inventory_hostname }}" | ||
| delegate_to: localhost |
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,19 @@ | ||
| --- | ||
| - hosts: localhost | ||
| gather_facts: false | ||
| become: false | ||
| tasks: | ||
| - name: Confirm continuing if using production environment | ||
| ansible.builtin.pause: | ||
| prompt: | | ||
| ************************************* | ||
| * WARNING: PROTECTED ENVIRONMENT! * | ||
| ************************************* | ||
|
|
||
| Current environment: {{ appliances_environment_name }} | ||
| Do you really want to continue (yes/no)? | ||
| register: env_confirm_safe | ||
| when: | ||
| - appliances_environment_name in appliances_protected_environments | ||
| - not (appliances_protected_environment_autoapprove | default(false) | bool) | ||
| failed_when: not (env_confirm_safe.user_input | bool) |
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
bertiethorpe marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.