Skip to content
Draft
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
10 changes: 10 additions & 0 deletions ansible/adhoc/lock_unlock_instances.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

- hosts: "{{ target_hosts | default('all') }}"
gather_facts: no

Check failure on line 4 in ansible/adhoc/lock_unlock_instances.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[truthy]

Truthy value should be one of [false, true]
become: no

Check failure on line 5 in ansible/adhoc/lock_unlock_instances.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[truthy]

Truthy value should be one of [false, true]
tasks:
- name: Lock/Unlock instances
openstack.cloud.server_action:
action: "{{ server_action | default('lock') }}"
server: "{{ inventory_hostname }}"

Check failure on line 10 in ansible/adhoc/lock_unlock_instances.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[new-line-at-end-of-file]

No new line character at the end of file
10 changes: 10 additions & 0 deletions ansible/adhoc/rebuild-via-slurm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

# See docs/slurm-controlled-rebuild.md.

- hosts: localhost
gather_facts: false
vars:
server_action: unlock
target_hosts: compute
tasks:
- name: Unlock compute instances for rebuild

Check failure on line 17 in ansible/adhoc/rebuild-via-slurm.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

syntax-check[unknown-module]

couldn't resolve module/action 'ansible.builtin.include_playbook'. This often indicates a misspelling, missing collection, or incorrect module path.
ansible.builtin.include_playbook:
file: adhoc/lock_unlock_instances.yml

- hosts: login
run_once: true
gather_facts: false
Expand Down
6 changes: 6 additions & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---
- name: Lock all instances
vars:
server_action: lock
target_hosts: all
ansible.builtin.import_playbook: adhoc/lock_unlock_instances.yml

- name: Run pre.yml hook
vars:
# hostvars not available here, so have to recalculate environment root:
Expand Down
23 changes: 23 additions & 0 deletions environments/site/hooks/pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

- hosts: localhost
gather_facts: no

Check failure on line 4 in environments/site/hooks/pre.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[truthy]

Truthy value should be one of [false, true]
become: no

Check failure on line 5 in environments/site/hooks/pre.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[truthy]

Truthy value should be one of [false, true]
vars:
protected_environments:
- prd
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 protected_environments
- not (prd_continue | default(false) | bool)
failed_when: not (env_confirm_safe.user_input | bool)

Check failure on line 23 in environments/site/hooks/pre.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[new-line-at-end-of-file]

No new line character at the end of file
Loading