Skip to content

Commit

Permalink
make google SDK installing optional (#26)
Browse files Browse the repository at this point in the history
* make google SDK installing optional

---------

Signed-off-by: kogeler <roman.gavrilov@parity.io>
  • Loading branch information
kogeler authored Mar 24, 2023
1 parent c4befa8 commit 0fde07b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace: parity
name: chain

# The version of the collection. Must be compatible with semantic versioning
version: 1.0.8
version: 1.0.9

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
2 changes: 2 additions & 0 deletions roles/node/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ node_chain_backup_url: ""
node_chain_backup_gcp_bucket: ""
# Link to a gcp backup, you have to specify a full path including a bucket name.
node_chain_backup_gcp_path: ""
# If you don't have pre-installed google SDK the role can install it
node_chain_backup_gcp_install_sdk: false
# If it's true, backup will be restored using the diff mode even if the 'db' folder exists.
# It works only for diff sync restoring types, there is only one now - gcp.
# It can be useful if you want to restore a broken db very quickly.
Expand Down
42 changes: 23 additions & 19 deletions roles/node/tasks/802-restore-chain-gcp.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
---

- name: Restore {{ item.part }} | GCP restoring | Install packages
ansible.builtin.package:
name: gpg
update_cache: yes

- name: Restore {{ item.part }} | GCP restoring | Add Google cloud apt GPG key
ansible.builtin.apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg

- name: Restore {{ item.part }} | GCP restoring | Add gce-sdk repository
ansible.builtin.apt_repository:
repo: deb http://packages.cloud.google.com/apt cloud-sdk-{{ ansible_distribution_release }} main
filename: /etc/apt/sources.list.d/gce_sdk.list
update_cache: yes

- name: Restore {{ item.part }} | GCP restoring | Install packages
ansible.builtin.package:
name: google-cloud-sdk
update_cache: no
- block:

- name: Restore {{ item.part }} | GCP restoring | Install packages
ansible.builtin.package:
name: gpg
update_cache: yes

- name: Restore {{ item.part }} | GCP restoring | Add Google cloud apt GPG key
ansible.builtin.apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg

- name: Restore {{ item.part }} | GCP restoring | Add gce-sdk repository
ansible.builtin.apt_repository:
repo: deb http://packages.cloud.google.com/apt cloud-sdk-{{ ansible_distribution_release }} main
filename: /etc/apt/sources.list.d/gce_sdk.list
update_cache: yes

- name: Restore {{ item.part }} | GCP restoring | Install packages
ansible.builtin.package:
name: google-cloud-sdk
update_cache: no

when: node_chain_backup_gcp_install_sdk | bool

- name: Restore {{ item.part }} | GCP restoring | Check last version
ansible.builtin.command: gsutil cat {{ item.gcp_path }}/latest_version.meta.txt
Expand Down

0 comments on commit 0fde07b

Please sign in to comment.