From ac980b850ff8ec9a2890038f7ca9f2695c88a019 Mon Sep 17 00:00:00 2001 From: Chris Thompson Date: Thu, 23 Aug 2018 11:51:55 -0400 Subject: [PATCH] Ensure Ansible knows what Vagrant settings are --- provisioning/box/config.yml | 1 + provisioning/pre-tasks/00-name_by_path.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 provisioning/pre-tasks/00-name_by_path.yml 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"