diff --git a/provisioning/box/config.yml b/provisioning/box/config.yml index e482756..af61486 100644 --- a/provisioning/box/config.yml +++ b/provisioning/box/config.yml @@ -272,3 +272,4 @@ hostname_fqdn: "{{ vagrant_hostname }}" ssh_home: "{{ drupal_core_path }}" post_provision_tasks_dir: ../../provisioning/tasks/*.yml +pre_provision_tasks_dir: ../../provisioning/pre-tasks/*.yml diff --git a/provisioning/pre-tasks/00-name_by_path.yml b/provisioning/pre-tasks/00-name_by_path.yml new file mode 100644 index 0000000..d7ad056 --- /dev/null +++ b/provisioning/pre-tasks/00-name_by_path.yml @@ -0,0 +1,15 @@ +--- +- name: get root folder of project + shell: pwd + register: proj_root + args: + chdir: "{{ playbook_dir }}/../../" + delegate_to: localhost + become: false + +# These values are NOT honored by Vagrant, but are still necessary for DrupalVM +# See also provisioning/box/config +- name: set vagrant hostname according to the project folder + set_fact: + vagrant_hostname: "{{ proj_root.stdout|replace("_", "-")|basename }}.local" + vagrant_machine_name: "{{ proj_root.stdout|replace("_", "-")|basename }}-coop-vm"