Skip to content
Snippets Groups Projects
Commit 2beeefa3 authored by jurgenhaas's avatar jurgenhaas
Browse files

Improve handling of mountpoints

parent 9d2c1682
No related branches found
No related tags found
No related merge requests found
......@@ -28,3 +28,6 @@ drupal_post_deploy_tasks:
letsencrypt_pause_services:
- 'apache2'
fstype_convert:
btrfs: 'btrfs-convert --no-progress {{ item.src }}'
......@@ -6,29 +6,14 @@
src='{{ relativeRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}/{{ drupal_domain.1 }}'
dest='{{ drupalRoot }}/sites/{{ drupal_domain.0.shortname|default("default") }}/{{ drupal_domain.1 }}'
- block:
- name: "Ensure mounted and webroot file directory"
file:
dest='{{ item }}'
state='directory'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='755'
with_items:
- '{{ drupal_domain.0.mountpoint }}'
- '{{ webRoot }}/files'
ignore_errors: yes
- name: "Link webroot to mounted directory"
file:
src='{{ drupal_domain.0.mountpoint }}/{{ drupal_domain.0.shortname|default("default") }}'
dest='{{ webRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}'
state='link'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='755'
- name: "Link webroot to mounted directory"
file:
src='{{ drupal_domain.0.mountpoint }}/{{ drupal.id }}/{{ drupal_domain.0.shortname|default("default") }}'
dest='{{ webRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}'
state='link'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='755'
when: drupal_domain.0.mountpoint is defined
- name: "Ensure File Directories"
......
......@@ -117,6 +117,19 @@
with_items: '{{ drupal.domains }}'
when: item.install|default(true)
- name: "Ensure Files Directory"
file:
path='{{ webRoot }}/files'
state='directory'
owner='{{ apacheUser }}'
group='{{ apacheUser }}'
mode='775'
when: drupal.install_extra_dirs|default(true)
- include_tasks: mountpoints.yml
with_items: '{{ drupal.mountpoints|default[] }}'
when: drupal.install_extra_dirs|default(true)
- include_tasks: files.yml
with_nested:
- '{{ drupal.domains }}'
......
---
# file: roles/drupal/tasks/mountpoints.yml
- name: "Check File System Type"
shell: 'lsblk --noheadings --fs --output FSTYPE {{ item.src }}'
register: fstype
- name: "Convert File System Type"
shell: '{{ fstype_convert[item.fstype] }}'
when: item.fstype != fstype
- name: "Ensure directory for mountpoint"
file:
dest: '{{ item.path }}'
state: 'directory'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: '755'
- name: "Ensure directory for mountpoint in jail"
file:
dest: '{{ jailroot }}/{{ drupal.jail.name }}{{ item.path }}'
state: 'directory'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: '755'
when: drupal.jail is defined
- name: "Mount the item"
mount:
path: '{{ item.path }}'
src: '{{ item.src }}'
fstype: '{{ item.fstype }}'
opts: '{{ item.opts|default(omit) }}'
state: 'mounted'
- name: "Mount the item in jail"
mount:
path: '{{ jailroot }}/{{ drupal.jail.name }}{{ item.path }}'
src: '{{ item.src }}'
fstype: '{{ item.fstype }}'
opts: '{{ item.opts|default(omit) }}'
state: 'mounted'
when: drupal.jail is defined
- name: "Ensure file directory in mountpoint"
file:
dest: '{{ item.path }}/{{ drupal.id }}'
state: 'directory'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: '755'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment