Skip to content
Snippets Groups Projects
Commit 78f67e88 authored by jurgenhaas's avatar jurgenhaas
Browse files

Implement checks for config export to make sure it doesn't fail

parent ca3fc237
No related branches found
No related tags found
No related merge requests found
---
# file: roles/drupal/tasks/config_collect/gitcomposer.yml
- name: "File Modes and Ownership for Repository"
file:
path: '{{ webRoot }}/.git'
state: 'directory'
owner: 'root'
group: 'root'
mode: 'u+rwX,g+rwX,o+rX'
recurse: yes
- name: "Commit and push files"
shell: 'git {{ item }}'
- name: "Check Git Status"
shell: 'git status -s'
args:
chdir: '{{ webRoot }}'
become: false
with_items:
- 'add config/*'
- 'config user.email "deployment@lakedrops.com"'
- 'config user.name "Auto Config Export"'
- 'commit -am "[ci skip] Config change on server"'
- 'push'
register: git_status
- block:
- name: "File Modes and Ownership for Repository"
file:
path: '{{ webRoot }}/.git'
state: 'directory'
owner: 'root'
group: 'root'
mode: 'u+rwX,g+rwX,o+rX'
recurse: yes
- name: "Commit and push files"
shell: 'git {{ item }}'
args:
chdir: '{{ webRoot }}'
become: false
with_items:
- 'add config/*'
- 'config user.email "deployment@lakedrops.com"'
- 'config user.name "Auto Config Export"'
- 'commit -am "[ci skip] Config change on server"'
- 'push'
- name: "File Modes and Ownership for Repository"
file:
path: '{{ webRoot }}/.git'
state: 'directory'
owner: 'root'
group: '{{ drupal.src.name }}'
mode: 'ug+rw,o+r,o-w'
recurse: yes
- name: "File Modes and Ownership for Repository"
file:
path: '{{ webRoot }}/.git'
state: 'directory'
owner: 'root'
group: '{{ drupal.src.name }}'
mode: 'ug+rw,o+r,o-w'
recurse: yes
when: git_status.stdout != ''
......@@ -20,25 +20,34 @@
installSource={{ drupal.src|default([]) }}
tags: always
- name: "Move exported config to working copy"
command: 'mv {{ pathExport }} {{ pathWorking }}'
- name: "Read file name in working copy"
shell: 'ls {{ pathWorking }} -1'
register: list_config_files
- name: "Copy working copy to config path"
copy:
src: '{{ pathWorking }}/{{ item }}'
dest: '{{ pathConfig }}/{{ item }}'
remote_src: yes
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
with_items: '{{ list_config_files.stdout_lines }}'
- include_tasks: '{{ installSource.mode|default("none") }}.yml'
- name: "Delete working copy"
file:
path: '{{ pathWorking }}'
state: absent
- name: "Check if export path exists"
stat:
path: "{{ pathExport }}"
register: path_export_stat
- block:
- name: "Move exported config to working copy"
command: 'mv {{ pathExport }} {{ pathWorking }}'
- name: "Read file name in working copy"
shell: 'ls {{ pathWorking }} -1'
register: list_config_files
- name: "Copy working copy to config path"
copy:
src: '{{ pathWorking }}/{{ item }}'
dest: '{{ pathConfig }}/{{ item }}'
remote_src: yes
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
with_items: '{{ list_config_files.stdout_lines }}'
- include_tasks: '{{ installSource.mode|default("none") }}.yml'
- name: "Delete working copy"
file:
path: '{{ pathWorking }}'
state: absent
when: path_export_stat.stat.exists
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment