Skip to content

Commit

Permalink
Added additional Vagrant Molecule Module docs
Browse files Browse the repository at this point in the history
Along with documenting the molecule vagrant module, corrected
a few bugs which were found.
  • Loading branch information
retr0h committed Jun 11, 2017
1 parent 85b4e0d commit 89083a2
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
54 changes: 53 additions & 1 deletion doc/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,18 @@ Vagrant
.. autoclass:: molecule.driver.vagrant.Vagrant
:undoc-members:

Molecule Vagrant Module
Molecule Vagrant Module
^^^^^^^^^^^^^^^^^^^^^^^

Molecule manages Vagrant via an internal Ansible module. The following belongs
in the appropriate create or destroy playbooks, and uses the default provider.

Supported Providers:

* VirtualBox (default)
* VMware (vmware_fusion, vmware_workstation and vmware_desktop)
* Parallels

Create instances.

.. code-block:: yaml
Expand Down Expand Up @@ -155,6 +164,49 @@ Create instances with interfaces.
molecule_file: "{{ molecule_file }}"
state: destroy
Create instances with additional provider options.

.. code-block:: yaml
- hosts: localhost
connection: local
tasks:
- name: Create instances
molecule_vagrant:
instance_name: "{{ item }}"
platform_box: ubuntu/trusty64
provider_name: virtualbox
provider_memory: 1024
provider_cpus: 4
provider_raw_config_args:
- "customize ['modifyvm', :id, '--cpuexecutioncap', '50']"
provider_options:
gui: true
molecule_file: "{{ molecule_file }}"
state: up
with_items:
- instance-1
- instance-2
Create instances with additional instance options.

.. code-block:: yaml
- hosts: localhost
connection: local
tasks:
- name: Create instances
molecule_vagrant:
instance_name: "{{ item }}"
platform_box: ubuntu/trusty64
instance_raw_config_args:
- "vm.network 'forwarded_port', guest: 80, host: 8080"
molecule_file: "{{ molecule_file }}"
state: up
with_items:
- instance-1
- instance-2
Lint
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
# Raw Configuration
if provider['raw_config_args']
provider['raw_config_args'].each { |raw_config_arg|
eval("virtualbox.#{raw_config_arg}")
eval("vmware.#{raw_config_arg}")
}
end
end
Expand All @@ -244,7 +244,7 @@
# Raw Configuration
if provider['raw_config_args']
provider['raw_config_args'].each { |raw_config_arg|
eval("virtualbox.#{raw_config_arg}")
eval("parallels.#{raw_config_arg}")
}
end
end
Expand All @@ -270,7 +270,7 @@
end
if instance['raw_config_args']
instance['options'].each { |raw_config_arg|
instance['raw_config_args'].each { |raw_config_arg|
eval("c.#{raw_config_arg}")
}
end
Expand Down
2 changes: 1 addition & 1 deletion test/resources/playbooks/vagrant/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
molecule_vagrant:
instance_name: "{{ item.name | molecule_instance_with_scenario_name(molecule_yml.scenario.name) }}"
instance_interfaces: "{{ item.interfaces | default([]) }}"
platform_box: debian/jessie64
platform_box: "{{ item.box }}"
molecule_file: "{{ molecule_file }}"
state: up
register: server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ lint:
name: ansible-lint
platforms:
- name: instance-1
box: debian/jessie64
interfaces:
- auto_config: true
network_name: private_network
Expand Down

0 comments on commit 89083a2

Please sign in to comment.