Skip to content
Snippets Groups Projects
Commit 002d0490 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting

parent 4020622a
Branches
No related tags found
No related merge requests found
Showing
with 125 additions and 106 deletions
drupal_install_drupal: true
drupal_contrib_subdir: ''
drupal_links_relative_root: '../../..'
drupal_contrib_subdir:
drupal_links_relative_root: ../../..
drupal_config_directories:
sync: 'sync'
sync: sync
drupal_d6_create_symbolic_links: true
drupal_post_deploy_tasks:
d6:
- 'registry-rebuild'
- 'updatedb'
- 'cache-clear all'
- 'dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}'
- registry-rebuild
- updatedb
- cache-clear all
- dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}
d7:
- 'registry-rebuild'
- 'features-revert-all'
- 'updatedb'
- 'cache-clear all'
- 'dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}'
- registry-rebuild
- features-revert-all
- updatedb
- cache-clear all
- dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}
d8:
- 'sset system.maintenance_mode 1'
- 'cache-rebuild'
- 'updatedb'
- 'entup'
- 'config-import sync'
- 'dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}'
- 'sset system.maintenance_mode 0'
- 'cache-rebuild'
- sset system.maintenance_mode 1
- cache-rebuild
- updatedb
- entup
- config-import sync
- dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }}
- sset system.maintenance_mode 0
- cache-rebuild
fstype_convert:
btrfs: 'btrfs-convert --no-progress {{ item.src }}'
ext4: 'mkfs.ext4 {{ item.src }}'
btrfs: btrfs-convert --no-progress {{ item.src }}
ext4: mkfs.ext4 {{ item.src }}
......@@ -3,7 +3,7 @@
- block:
- name: "Apache Configuration File"
- name: Apache Configuration File
template:
src='vhost.conf'
dest='/etc/apache2/sites-available/{{ drupal.id }}-{{ drupal_domain.shortname|default("default") }}{{ apache_conf_ext }}'
......@@ -13,12 +13,12 @@
notify:
- "Apache | Restart Apache"
- name: "Apache enable our new site(s)"
- name: Apache enable our new site(s)
command: a2ensite {{ drupal.id }}-{{ drupal_domain.shortname|default("default") }} creates=/etc/apache2/sites-enabled/{{ drupal.id }}-{{ drupal_domain.shortname|default("default") }}{{ apache_conf_ext }}
notify:
- "Apache | Restart Apache"
- name: "Apache install SSL certificates"
- name: Apache install SSL certificates
copy:
src='{{inventory_dir}}/files/ssl/{{ item.file }}'
dest='/etc/ssl/private'
......@@ -28,4 +28,5 @@
- include_tasks: apache_auth.yml
when: drupal_domain.apache_auth is defined and drupal_domain.apache_auth.active|default('true') == 'true'
tags: 'ApacheConfig'
tags:
- ApacheConfig
......@@ -3,7 +3,7 @@
- block:
- name: "Ensure Password Directory"
- name: Ensure Password Directory
file:
path='{{ webRoot }}/passwords'
state='directory'
......@@ -11,7 +11,7 @@
group='{{ apacheUser }}'
mode='755'
- name: "Setup AuthType Basic Credentials"
- name: Setup AuthType Basic Credentials
htpasswd:
path='{{ webRoot }}/passwords/{{ drupal_domain.apache_auth.user }}'
name='{{ drupal_domain.apache_auth.user }}'
......@@ -23,7 +23,7 @@
notify:
- "Apache | Restart Apache"
- name: "Setup AuthType Basic Credentials for extra users"
- name: Setup AuthType Basic Credentials for extra users
htpasswd:
path='{{ webRoot }}/passwords/{{ drupal_domain.apache_auth.user }}'
name='{{ item.user }}'
......@@ -35,4 +35,5 @@
notify:
- "Apache | Restart Apache"
tags: 'ApacheConfig'
tags:
- ApacheConfig
......@@ -3,37 +3,38 @@
- block:
- include_tasks: 'prepare/{{ collectConfig.mode|default("none") }}.yml'
- include_tasks: prepare/{{ collectConfig.mode|default("none") }}.yml
- name: "Move exported config to working copy"
command: 'mv {{ pathExport }} {{ pathWorking }}'
- name: Move exported config to working copy
command: mv {{ pathExport }} {{ pathWorking }}
# Note: If parallel processes are running the pathExport could be gone by now.
failed_when: false
ignore_errors: true
- name: "Ensure working directory"
- name: Ensure working directory
file:
path: '{{ pathWorking }}'
state: 'directory'
state: directory
- name: "Read file name in working copy"
shell: 'ls {{ pathWorking }} -1'
- name: Read file name in working copy
shell: ls {{ pathWorking }} -1
register: list_config_files
- name: "Copy working copy to config path"
- name: Copy working copy to config path
copy:
src: '{{ pathWorking }}/{{ item }}'
dest: '{{ pathConfig }}/{{ item }}'
remote_src: yes
with_items: '{{ list_config_files.stdout_lines }}'
- include_tasks: 'commit/{{ collectConfig.mode|default("none") }}.yml'
- include_tasks: commit/{{ collectConfig.mode|default("none") }}.yml
- include_tasks: 'finish/{{ collectConfig.mode|default("none") }}.yml'
- include_tasks: finish/{{ collectConfig.mode|default("none") }}.yml
- name: "Delete working copy"
- name: Delete working copy
file:
path: '{{ pathWorking }}'
state: absent
tags: 'deploy'
tags:
- deploy
......@@ -3,8 +3,8 @@
- block:
- name: "Check Git Status"
shell: 'git status -s'
- name: Check Git Status
shell: git status -s
args:
chdir: '{{ webRoot }}'
become: false
......@@ -12,17 +12,18 @@
- block:
- name: "Add and commit files"
shell: 'git {{ item }}'
- name: Add and commit 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"'
- 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'
tags:
- deploy
......@@ -3,8 +3,8 @@
- block:
- name: "Check Git Status"
shell: 'git status -s'
- name: Check Git Status
shell: git status -s
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
become: false
......@@ -12,17 +12,18 @@
- block:
- name: "Add and commit files"
shell: 'git {{ item }}'
- name: Add and commit files
shell: git {{ item }}
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
become: false
with_items:
- 'add *'
- 'config user.email "deployment@lakedrops.com"'
- 'config user.name "Auto Config Export"'
- 'commit -am "[ci skip] Config change on server"'
- add *
- 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'
tags:
- deploy
---
# file: roles/drupal/tasks/config_collect/commit/gitflow.yml
- include_tasks: 'git.yml'
tags: 'deploy'
- include_tasks: git.yml
tags:
- deploy
---
# file: roles/drupal/tasks/config_collect/commit/none.yml
- set_fact: dummy=yes
- set_fact:
dummy: yes
......@@ -3,16 +3,17 @@
- block:
- name: "Push"
shell: 'git push'
- name: Push
shell: git push
args:
chdir: '{{ webRoot }}/{{ collect_config_key }}'
become: false
when: git_status.stdout != ''
- name: "Delete webroot working copy"
- name: Delete webroot working copy
file:
path: '{{ webRoot }}'
state: absent
tags: 'deploy'
tags:
- deploy
......@@ -3,18 +3,19 @@
- block:
- name: "Finish Hotfix"
shell: 'git {{ item }}'
- name: Finish Hotfix
shell: git {{ item }}
args:
chdir: '{{ webRoot }}'
become: false
with_items:
- 'flow hotfix finish -F -p -m "Config export {{ version }}" {{ version }}'
- flow hotfix finish -F -p -m "Config export {{ version }}" {{ version }}
when: git_status.stdout != ''
- name: "Delete webroot working copy"
- name: Delete webroot working copy
file:
path: '{{ webRoot }}'
state: absent
tags: 'deploy'
tags:
- deploy
---
# file: roles/drupal/tasks/config_collect/finish/none.yml
- set_fact: dummy=yes
- set_fact:
dummy: yes
......@@ -13,7 +13,7 @@
pathWorking='/tmp/ansible-cae-{{ drupal.id }}-{{ version }}'
collectConfig={{ drupal.src.collectConfig|default([]) }}
- name: "Check if export path exists"
- name: Check if export path exists
stat:
path: "{{ pathExport }}"
register: path_export_stat
......@@ -21,4 +21,5 @@
- include_tasks: collect.yml
when: path_export_stat.stat.exists
tags: 'deploy'
tags:
- deploy
......@@ -3,7 +3,7 @@
- block:
- name: "Clone Git Repository"
- name: Clone Git Repository
git:
accept_hostkey: yes
repo: '{{ drupal.src.git.extrarepos[item]["repository"] }}'
......@@ -14,12 +14,13 @@
with_items: '{{ drupal.src.git.extrarepos|default([]) }}'
when: collect_config_key == item
- name: "Create Git Hook for commit message"
- 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'
mode: 0777
tags: 'deploy'
tags:
- deploy
......@@ -3,7 +3,7 @@
- block:
- name: "Clone Git Repository"
- name: Clone Git Repository
git:
accept_hostkey: yes
repo: '{{ drupal.src.git.repository }}'
......@@ -12,21 +12,22 @@
version: '{{ drupal.src.git.branch|default(omit) }}'
become: false
- name: "Create Git Hook for commit message"
- name: Create Git Hook for commit message
copy:
content: |
#!/bin/sh
echo "[ci skip]" >>$1
dest: '{{ webRoot }}/.git/hooks/prepare-commit-msg'
mode: '0777'
mode: 0777
- name: "Start Hotfix"
shell: 'git {{ item }}'
- name: Start Hotfix
shell: git {{ item }}
args:
chdir: '{{ webRoot }}'
become: false
with_items:
- 'flow init -d'
- 'flow hotfix start -F {{ version }}'
- flow init -d
- flow hotfix start -F {{ version }}
tags: 'deploy'
tags:
- deploy
---
# file: roles/drupal/tasks/config_collect/prepare/none.yml
- set_fact: dummy=yes
- set_fact:
dummy: yes
......@@ -11,7 +11,7 @@
drushAliasValidate='@{{ inventory_hostname }}{{ drushSubkey }}.{{ drupal_domain.shortname|default("default") }}'
when: drush_version_main|default('8') == '8'
- name: "Check Drush Status"
- name: Check Drush Status
shell: drush -y {{ drushAlias }} status
args:
chdir: '{{ webRoot }}'
......@@ -19,17 +19,18 @@
changed_when: false
when: drushAliasValidate in drush_aliases.stdout_lines
- name: "Dump DB"
- name: Dump DB
shell: drush -y {{ drushAlias }} sql-dump --result-file=/tmp/drupal-db-dump/{{ drushAlias }}.sql
args:
chdir: '{{ webRoot }}'
when: "drush_status is defined and ('Successful' in drush_status.stdout|default('') or 'Erfolgreich' in drush_status.stdout|default(''))"
- name: "Fetch Dump File"
- name: Fetch Dump File
fetch:
src: '/tmp/drupal-db-dump/{{ drushAlias }}.sql'
src: /tmp/drupal-db-dump/{{ drushAlias }}.sql
dest: '{{ dump_file }}'
flat: yes
when: "drush_status is defined and ('Successful' in drush_status.stdout|default('') or 'Erfolgreich' in drush_status.stdout|default(''))"
tags: 'collect_db_dump'
tags:
- collect_db_dump
......@@ -23,17 +23,18 @@
drupalRoot='{{ webRoot }}{{ drupal.root|default("") }}'
docRoot='{{ webRoot }}{{ drupal.docroot|default(drupal.root|default("")) }}'
- name: "Check available Drush Aliases"
- name: Check available Drush Aliases
shell: drush sa
args:
chdir: '{{ webRoot }}'
register: drush_aliases
changed_when: false
- name: "Post Deploy Tasks"
- name: Post Deploy Tasks
include_tasks: dump.yml
with_items: '{{ drupal.domains }}'
loop_control:
loop_var: drupal_domain
tags: 'collect_db_dump'
tags:
- collect_db_dump
---
# file: roles/drupal/tasks/deploy/d6.yml
- set_fact: dummy=yes
- set_fact:
dummy: yes
---
# file: roles/drupal/tasks/deploy/d7.yml
- set_fact: dummy=yes
- set_fact:
dummy: yes
# TODO: Let's see how we can generalize this and whether we need that for D6 as well.
#- name: "Deploy | Drush"
#- name: Deploy | Drush
# shell: "drush -y @{{ deploy.drush.alias }} {{ item }}"
# with_items:
# - "fra"
......
......@@ -3,14 +3,15 @@
- block:
- name: "Ensure extra directories"
- name: Ensure extra directories
file:
path: '{{ drupalRoot }}{{ item }}'
state: 'directory'
state: directory
with_items:
- '/modules/custom'
- '/modules/contrib'
- '/themes/custom'
- '/themes/contrib'
- /modules/custom
- /modules/contrib
- /themes/custom
- /themes/contrib
tags: 'deploy'
tags:
- deploy
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment