summaryrefslogtreecommitdiff
path: root/backup_git.yaml
blob: 0a436df6bef1eec58c8feb70d8a7e2cf47e1fec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- hosts: gitservers
  vars_files:
  - vars/aws.yaml
  tasks:
  - name: Ensure that boto is not installed via apt
    apt: name=python-boto state=absent
  - name: Ensure recent boto is installed
    pip: name=boto state=present
  - name: Create encrypted backup
    shell: tar c repositories | gpg --symmetric --cipher-algo AES --passphrase "{{ aws_encryption_key }}" > repositories.tar.asc
    args:
      chdir: /var/lib/gitolite
  - name: Upload backup to S3
    s3:
      bucket=devops-sublab
      object=git-backup.tar.asc
      src=/var/lib/gitolite/repositories.tar.asc
      mode=put
      aws_access_key="{{aws_access_key}}"
      aws_secret_key="{{aws_secret_key}}"
      region=eu-central-1
  - name: Cleanup backup archive
    file: path=/var/lib/gitolite/repositories.tar.asc state=absent