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

Parameterize the archive_file variable in archive_db.yml #67

Open
jmiranda opened this issue Sep 8, 2023 · 1 comment
Open

Parameterize the archive_file variable in archive_db.yml #67

jmiranda opened this issue Sep 8, 2023 · 1 comment

Comments

@jmiranda
Copy link
Member

jmiranda commented Sep 8, 2023

After following the instructions written by @awalkowiak to archive and restore a remote database, we realized that we should probably parameterize the source archive used in the restore_db.yml playbook.

Here are the instructions that Artur sent to me.

  1. Run this to pull db from obnav (this will download db archive to openboxes-devops/ansible/build/archive_db/<db_server_name>:

     ansible-playbook -e @secrets/vault_rimu -i inventories/pih_rimu.yml dba/archive_db.yml -l dbprd
    
  2. Run this to upload the db pulled with command above:

    ansible-playbook -e @secrets/vault_rimu -i inventories/pih_rimu.yml dba/restore_db.yml -l obdev2 -e 'force=true'
    

Both commands will take a couple of minutes.

Optionals:
If you'd like to pull db from other server than I put in the 1st command, then change the last param to be one of: dbprd, dbstg, obdev1-5

If you changed the db that you are pulling, then you have to go to the restore_db.yml and change this line: https://github.com/openboxes/openboxes-devops/blob/master/ansible/dba/restore_db.yml#L5 to look into proper directory (you have to change the hardcoded /dbprd/ part)

[restore_db.yml](https://github.com/openboxes/openboxes-devops/blob/master/ansible/dba/restore_db.yml)
    archive_file: ../build/archive_db/dbprd/openboxes.tgz
@jmiranda
Copy link
Member Author

jmiranda commented Sep 8, 2023

Now that I'm looking at the archive_db playbook, I realized the vars are set by default but Ansible allows you to pass a variable as an environment variable similar to the force argument below.

ansible-playbook -e @secrets/vault_rimu -i inventories/pih_rimu.yml dba/restore_db.yml -l obdev2 -e 'force=true,archive_file=../build/archive_db/obdev1/openboxes.tgz'

However, I feel like there could be an easier way of overriding the variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant