Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #40 from palantirnet/fix-ansible-playbook-error
Browse files Browse the repository at this point in the history
Fix error when ansible_custom_playbook is empty.
  • Loading branch information
becw authored Sep 26, 2017
2 parents c116b4a + cf202c9 commit 4bb4466
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ $> composer require palantirnet/the-vagrant
* The project web root
* Enable Solr
* Enable HTTPS
* Make a project-specific copy of the Ansible roles
* Make a project-specific copy of the Ansible roles and a copy of the default playbook
* OR make a project-specific Ansible playbook to be run _in addition_ to the default playbook
3. Check in and commit the new Vagrantfile to git

You can re-run the install script later if you need to change your configuration.
Expand All @@ -49,14 +50,29 @@ Several things can be configured during the interactive installation:

A few more things can be customized directly in your `Vagrantfile`:

* Extra hostnames for this VM (hello, multisite)
* Extra hostnames for this VM (use this for multisite)
* Extra apt packages to install
* The PHP timezone

By default, the-vagrant references ansible roles from the package at `vendor/palantirnet/the-vagrant/conf/vagrant/provisioning`. If your project needs configuration beyond what is provided via in the `Vagrantfile`, you can:
By default, the-vagrant references ansible roles from the package at `vendor/palantirnet/the-vagrant/conf/vagrant/provisioning`. If your project needs configuration beyond what is provided via in the `Vagrantfile`, you can re-run the install script and update the provisioning.

### Run a custom playbook in addition to the defaults

1. Re-run the install script: `vendor/bin/the-vagrant-installer`
2. When you are prompted to copy the Ansible roles, reply `n`
3. When you are prompted to add an additional Ansible playbook to your project, reply `Y`

> Copy Ansible roles into your project for customization (Y,n) [n]? n
>
> OR add an additional Ansible playbook to your project (Y,n) [n]? Y
3. This will create a new `provisioning` directory in your project that contains a simple Ansible playbook and example role. Your `Vagrantfile` will refer to this playbook in addition to the one in the `vendor` directory.
4. Check in and commit this new `provisioning` directory and updated `Vagrantfile` to git
5. Add or update the roles and playbook as necessary.

### 100% custom provisioning

1. Re-run the install script: `vendor/bin/the-vagrant-installer`
2. When are prompted to copy the Ansible roles, reply `Y`:
2. When you are prompted to copy the Ansible roles, reply `Y`:

> Copy Ansible roles into your project for customization (Y,n) [n]?
3. This will create a new `provisioning` directory in your project that contains the Ansible playbook and roles. Your `Vagrantfile` will refer to this playbook instead of the one in the `vendor` directory.
Expand Down
4 changes: 2 additions & 2 deletions conf/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ Vagrant.configure(2) do |config|
}
end

config.vm.provision "@projectname@-provision", type: "ansible" do |ansible|
if (defined?(ansible_custom_playbook) && !ansible_custom_playbook.empty?)
if (defined?(ansible_custom_playbook) && !ansible_custom_playbook.empty?)
config.vm.provision "@projectname@-provision", type: "ansible" do |ansible|
ansible.playbook = ansible_custom_playbook
end
end
Expand Down

0 comments on commit 4bb4466

Please sign in to comment.