Commit 2cc60956 by Feanil Patel

Merge pull request #3044 from edx/feanil/backup_restore

Fixes needed to make backups and splunk work in gocd.
parents 0f312073 a078d495
......@@ -64,7 +64,7 @@ GO_SERVER_H2DB_BACKUP_PATH: "artifacts/db_backup/"
GO_SERVER_H2DB_BACKUP_LOCATION: "{{ GO_SERVER_HOME }}/{{ GO_SERVER_H2DB_BACKUP_PATH }}/{{ GO_SERVER_H2DB_NAME }}"
# For use in backup/restore of a GoCD configuration.
GO_SERVER_BACKUP_ENVIRONMENT: "sandbox"
GO_SERVER_BACKUP_ENVIRONMENT: "{{ COMMON_ENVIRONMENT }}"
GO_SERVER_BACKUP_SNITCH_URL: "https://nosnch.in/4444444444"
GO_SERVER_BACKUP_FILENAME: "go-server-latest-backup.tgz"
GO_SERVER_TEMP_RESTORE_DIRECTORY: "/tmp/go-server-backup"
......@@ -77,10 +77,10 @@ GO_SERVER_BACKUP_TMP_LOCATION: "/tmp/{{ GO_SERVER_BACKUP_FILENAME }}"
GO_SERVER_BACKUP_CRON_SCRIPT_LOCATION: "/root/gocd_backup.sh"
# When "true", attempts to restore go-server backup from S3.
GO_SERVER_RESTORE_BACKUP: "false"
GO_SERVER_RESTORE_BACKUP: false
# When "true", attempts to configure regular, cron-based backups to S3 on go-server.
GO_SERVER_CONFIGURE_BACKUPS: "false"
GO_SERVER_CONFIGURE_BACKUPS: false
# password file setup
GO_SERVER_PASSWORD_FILE_NAME: "password.txt"
......
......@@ -104,7 +104,7 @@
force: no
- include: download_backup.yml
when: GO_SERVER_BACKUP_S3_BUCKET and GO_SERVER_BACKUP_S3_OBJECT and GO_SERVER_RESTORE_BACKUP == "true"
when: GO_SERVER_BACKUP_S3_BUCKET and GO_SERVER_BACKUP_S3_OBJECT and GO_SERVER_RESTORE_BACKUP
- name: replace the admin line in the password file post-restore
lineinfile:
......@@ -126,4 +126,4 @@
state: restarted
- include: setup_regular_backup.yml
when: GO_SERVER_BACKUP_S3_BUCKET and GO_SERVER_BACKUP_S3_OBJECT and GO_SERVER_CONFIGURE_BACKUPS == "true"
when: GO_SERVER_BACKUP_S3_BUCKET and GO_SERVER_BACKUP_S3_OBJECT and GO_SERVER_CONFIGURE_BACKUPS
......@@ -7,7 +7,7 @@ gocd_password="{{ GO_SERVER_BACKUP_PASSWORD }}"
gocd_backup_location="{{ GO_SERVER_BACKUP_TMP_LOCATION }}"
s3_backup_bucket="{{ GO_SERVER_BACKUP_S3_BUCKET }}"
snitch_url="{{ GO_SERVER_BACKUP_SNITCH_URL }}"
gocd_backup_base=gocd-"{{ GO_SERVER_BACKUP_ENVIRONMENT }}"
gocd_backup_base="gocd-{{ GO_SERVER_BACKUP_ENVIRONMENT }}"
# Trigger the backup and capture the backup path.
# The output of the api call is documented here:
......@@ -86,4 +86,4 @@ case $aws_output in
esac
# Remove the tarball.
rm -f "$gocd_backup_location"
\ No newline at end of file
rm -f "$gocd_backup_location"
......@@ -67,6 +67,12 @@
when: download_deb.changed
notify: restart splunkforwarder
# Ensure permissions on splunk content
- name: ensure splunk forder permissions
file: path={{ splunkforwarder_output_dir }} state=directory recurse=yes owner=splunk group=splunk
when: download_deb.changed
notify: restart splunkforwarder
# Update credentials
- name: update admin pasword
shell: "{{ splunkforwarder_output_dir }}/bin/splunk edit user admin -password {{ SPLUNKFORWARDER_PASSWORD }} -auth admin:changeme --accept-license --answer-yes --no-prompt"
......@@ -78,12 +84,6 @@
when: download_deb.changed and create_boot_script.changed
notify: restart splunkforwarder
# Ensure permissions on splunk content
- name: ensure splunk forder permissions
file: path={{ splunkforwarder_output_dir }} state=directory recurse=yes owner=splunk group=splunk
when: download_deb.changed
notify: restart splunkforwarder
# Drop template files.
- name: drop input configuration
template:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment