Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. ---
  2. - hosts: server_git
  3. user: test
  4. become: true
  5. vars_files:
  6. - ../vars/servers.yml
  7. tasks:
  8. - name: Definindo nome do arquivo de backup
  9. set_fact:
  10. git_backup_output: "{{ inventory_hostname | regex_replace('\.','_')}}_{{lookup('pipe','date +%Y%m%d%H%M%S')}}"
  11.  
  12. - name: Gerando backup do git no servidor remoto
  13. command: gitlab-rake gitlab:backup:create
  14.  
  15. - name: Recuperando nome dos arquivos de backup
  16. shell: ls /var/opt/gitlab/backups/
  17. register: _git_backups
  18.  
  19. - name: Alterando permissao do arquivo
  20. shell: chmod 0666 /var/opt/gitlab/backups/{{ item }}
  21. with_items: "{{_git_backups.stdout_lines}}"
  22.  
  23. - debug:
  24. msg: "src: /var/opt/gitlab/backups/{{ item }} dest: /mnt/vmware_26/git/{{ item }}"
  25. with_items: "{{_git_backups.stdout_lines}}"
  26.  
  27. - name: Transferindo o backup para o Storage
  28. fetch:
  29. src: "/var/opt/gitlab/backups/{{ item }}"
  30. dest: "/mnt/vmware_26/git/{{ item }}"
  31. flat: yes
  32. become: false
  33. with_items: "{{_git_backups.stdout_lines}}"
  34.  
  35. - name: Removendo arquivo de backup
  36. file:
  37. state: absent
  38. path: "/var/opt/gitlab/backups/{{ item }}"
  39. with_items: "{{_git_backups.stdout_lines}}"
  40. become: true
  41.  
  42. SSH password:
  43.  
  44. PLAY [server_git] ***************************************************************************************************************************************************************
  45.  
  46. TASK [Gathering Facts] **********************************************************************************************************************************************************
  47. ok: [git-01]
  48.  
  49. TASK [Definindo nome do arquivo de backup] **************************************************************************************************************************************
  50. ok: [git-01]
  51.  
  52. TASK [Gerando backup do git no servidor remoto] *********************************************************************************************************************************
  53. changed: [git-01]
  54.  
  55. TASK [Recuperando nome dos arquivos de backup] **********************************************************************************************************************************
  56. changed: [git-01]
  57.  
  58. TASK [Alterando permissao do arquivo] *******************************************************************************************************************************************
  59. changed: [git-01] => (item=1499691583_gitlab_backup.tar)
  60. changed: [git-01] => (item=1499691823_gitlab_backup.tar)
  61.  
  62. TASK [debug] ********************************************************************************************************************************************************************
  63. ok: [git-01] => (item=1499691823_gitlab_backup.tar) => {
  64. "item": "1499691823_gitlab_backup.tar",
  65. "msg": "src: /var/opt/gitlab/backups/1499691823_gitlab_backup.tar dest: /mnt/vmware_26/git/1499691823_gitlab_backup.tar"
  66. }
  67. ok: [git-01] => (item=1499691583_gitlab_backup.tar) => {
  68. "item": "1499691583_gitlab_backup.tar",
  69. "msg": "src: /var/opt/gitlab/backups/1499691583_gitlab_backup.tar dest: /mnt/vmware_26/git/1499691583_gitlab_backup.tar"
  70. }
  71.  
  72. TASK [Transferindo o backup para o Storage] *************************************************************************************************************************************
  73. ok: [git-01] => (item=1499691583_gitlab_backup.tar)
  74. ok: [git-01] => (item=1499691823_gitlab_backup.tar)
  75.  
  76. TASK [Removendo arquivo de backup] **********************************************************************************************************************************************
  77. changed: [git-01] => (item=1499691583_gitlab_backup.tar)
  78. changed: [git-01] => (item=1499691823_gitlab_backup.tar)
  79.  
  80. PLAY RECAP ********************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement