Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
11 changes: 11 additions & 0 deletions ansible/adhoc/lock_unlock_instances.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- hosts: cluster
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: "{{ appliances_server_action | default('lock') }}"
server: "{{ inventory_hostname }}"
delegate_to: localhost

Check failure on line 11 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
5 changes: 5 additions & 0 deletions ansible/adhoc/rebuild-via-slurm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

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

- name: Unlock compute instances for rebuild
vars:
appliances_server_action: unlock
ansible.builtin.command: ansible-playbook --limit compute adhoc/lock_unlock_instances.yml

- hosts: login
run_once: true
gather_facts: false
Expand Down
19 changes: 19 additions & 0 deletions ansible/safe-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- hosts: localhost
gather_facts: no

Check failure on line 3 in ansible/safe-env.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 4 in ansible/safe-env.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

yaml[truthy]

Truthy value should be one of [false, true]
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)

Check failure on line 19 in ansible/safe-env.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
6 changes: 6 additions & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---

- ansible.builtin.import_playbook: safe-env.yml

- name: Lock cluster instances
ansible.builtin.command: ansible-playbook adhoc/lock_unlock_instances.yml

Check failure on line 6 in ansible/site.yml

View workflow job for this annotation

GitHub Actions / Lint / Lint

syntax-check[specific]

'ansible.builtin.command' is not a valid attribute for a Play

- name: Run pre.yml hook
vars:
# hostvars not available here, so have to recalculate environment root:
Expand Down
2 changes: 2 additions & 0 deletions environments/common/inventory/group_vars/all/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ansible_user: rocky
appliances_repository_root: "{{ lookup('env', 'APPLIANCES_REPO_ROOT') }}"
appliances_environment_root: "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
appliances_environment_name: "{{ appliances_environment_root | basename | regex_replace('\\W+', '') }}" # [a-zA-Z0-9_] only
appliances_protected_environments:
- prd
appliances_cockpit_state: absent # RHEL cockpit installed but not enabled in genericcloud images; appliance defaults to removing it
# appliances_state_dir: # define an absolute path here to use for persistent state: NB: This is defined as /var/lib/state in inventory by the default Terraform
appliances_mode: configure
Expand Down
Loading