Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: server_git
- user: test
- become: true
- vars_files:
- - ../vars/servers.yml
- tasks:
- - name: Definindo nome do arquivo de backup
- set_fact:
- git_backup_output: "{{ inventory_hostname | regex_replace('\.','_')}}_{{lookup('pipe','date +%Y%m%d%H%M%S')}}"
- - name: Gerando backup do git no servidor remoto
- command: gitlab-rake gitlab:backup:create
- - name: Recuperando nome dos arquivos de backup
- shell: ls /var/opt/gitlab/backups/
- register: _git_backups
- - name: Alterando permissao do arquivo
- shell: chmod 0666 /var/opt/gitlab/backups/{{ item }}
- with_items: "{{_git_backups.stdout_lines}}"
- - debug:
- msg: "src: /var/opt/gitlab/backups/{{ item }} dest: /mnt/vmware_26/git/{{ item }}"
- with_items: "{{_git_backups.stdout_lines}}"
- - name: Transferindo o backup para o Storage
- fetch:
- src: "/var/opt/gitlab/backups/{{ item }}"
- dest: "/mnt/vmware_26/git/{{ item }}"
- flat: yes
- become: false
- with_items: "{{_git_backups.stdout_lines}}"
- - name: Removendo arquivo de backup
- file:
- state: absent
- path: "/var/opt/gitlab/backups/{{ item }}"
- with_items: "{{_git_backups.stdout_lines}}"
- become: true
- SSH password:
- PLAY [server_git] ***************************************************************************************************************************************************************
- TASK [Gathering Facts] **********************************************************************************************************************************************************
- ok: [git-01]
- TASK [Definindo nome do arquivo de backup] **************************************************************************************************************************************
- ok: [git-01]
- TASK [Gerando backup do git no servidor remoto] *********************************************************************************************************************************
- changed: [git-01]
- TASK [Recuperando nome dos arquivos de backup] **********************************************************************************************************************************
- changed: [git-01]
- TASK [Alterando permissao do arquivo] *******************************************************************************************************************************************
- changed: [git-01] => (item=1499691583_gitlab_backup.tar)
- changed: [git-01] => (item=1499691823_gitlab_backup.tar)
- TASK [debug] ********************************************************************************************************************************************************************
- ok: [git-01] => (item=1499691823_gitlab_backup.tar) => {
- "item": "1499691823_gitlab_backup.tar",
- "msg": "src: /var/opt/gitlab/backups/1499691823_gitlab_backup.tar dest: /mnt/vmware_26/git/1499691823_gitlab_backup.tar"
- }
- ok: [git-01] => (item=1499691583_gitlab_backup.tar) => {
- "item": "1499691583_gitlab_backup.tar",
- "msg": "src: /var/opt/gitlab/backups/1499691583_gitlab_backup.tar dest: /mnt/vmware_26/git/1499691583_gitlab_backup.tar"
- }
- TASK [Transferindo o backup para o Storage] *************************************************************************************************************************************
- ok: [git-01] => (item=1499691583_gitlab_backup.tar)
- ok: [git-01] => (item=1499691823_gitlab_backup.tar)
- TASK [Removendo arquivo de backup] **********************************************************************************************************************************************
- changed: [git-01] => (item=1499691583_gitlab_backup.tar)
- changed: [git-01] => (item=1499691823_gitlab_backup.tar)
- PLAY RECAP ********************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement