Skip to content
Snippets Groups Projects
Commit 1a564ebd authored by jurgenhaas's avatar jurgenhaas
Browse files

Implement new mode gitextra for collecting config

parent 16096488
Branches
No related tags found
No related merge requests found
---
# file: roles/drupal/tasks/config_collect/commit/gitcomposer.yml
# file: roles/drupal/tasks/config_collect/commit/git.yml
- block:
......
---
# file: roles/drupal/tasks/config_collect/commit/gitextra.yml
- block:
- name: "Check Git Status"
shell: 'git status -s'
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
become: false
register: git_status
- block:
- name: "Add and commit files"
shell: 'git {{ item }}'
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
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"'
when: git_status.stdout != ''
tags: 'deploy'
---
# file: roles/drupal/tasks/config_collect/finish/gitextra.yml
- block:
- name: "Push"
shell: 'git push'
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
become: false
when: git_status.stdout != ''
- name: "Delete webroot working copy"
file:
path: '{{ webRoot }}'
state: absent
tags: 'deploy'
......@@ -6,11 +6,11 @@
- set_fact:
version='{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S') }}'
- set_fact:
webRoot='/tmp/ansible-cae-{{ drupal.jail.name }}-{{ version }}-gitflow'
webRoot='/tmp/ansible-cae-{{ drupal.id }}-{{ version }}-gitflow'
- set_fact:
pathConfig='{{ webRoot }}/config/default/sync'
pathConfig='{{ webRoot }}/{{ collect_config_key|default("config") }}/default/sync'
pathExport='{{ export_path }}'
pathWorking='/tmp/ansible-cae-{{ drupal.jail.name }}-{{ version }}'
pathWorking='/tmp/ansible-cae-{{ drupal.id }}-{{ version }}'
collectConfig={{ drupal.src.collectConfig|default([]) }}
- name: "Check if export path exists"
......
---
# file: roles/drupal/tasks/config_collect/prepare/gitextra.yml
- block:
- name: "Clone Git Repository"
git:
accept_hostkey: yes
repo: '{{ drupal.src.git.extrarepos[item] }}'
dest: '{{ webRoot }}/{{ item }}'
force: yes
version: '{{ drupal.src.git.branch|default(omit) }}'
become: false
with_items: '{{ drupal.src.git.extrarepos|default([]) }}'
when: collect_config_key == item
- name: "Create Git Hook for commit message"
copy:
content: |
#!/bin/sh
echo "[ci skip]" >>$1
dest: '{{ webRoot }}/{{ collect_config_key }}/.git/hooks/prepare-commit-msg'
mode: '0777'
tags: 'deploy'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment