Ensure that Drupal site directories are present

This commit is contained in:
Oliver Davies 2019-05-02 18:39:22 +01:00
parent 53521f0e93
commit ecb4c7a608
4 changed files with 17 additions and 8 deletions

View file

@ -1,2 +1,2 @@
---
# defaults file for opdavies.drupal-settings
drupal_settings: []

View file

@ -1,5 +1,10 @@
---
- name: Converge
hosts: all
vars:
drupal_settings:
- root: /var/www/test
sites:
- name: default
roles:
- role: opdavies.drupal-settings

View file

@ -5,10 +5,8 @@ import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_drupal_site_directory_exists(host):
directory = host.file('/var/www/test/sites/default')
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
assert directory.exists
assert directory.is_directory

View file

@ -1,2 +1,8 @@
---
# tasks file for opdavies.drupal-settings
- name: Ensure that Drupal site directories are present
file:
state: directory
path: '{{ item.0.root }}/sites/{{ item.1.name|default("default") }}'
with_subelements:
- '{{ drupal_settings }}'
- sites