Running Vagrant vm.provision shell script for molecule test VM

456 views
Skip to first unread message

mwi...@gmail.com

unread,
Aug 9, 2018, 3:19:05 PM8/9/18
to molecule-users
I am relatively new to molecule so apologies if this is an ignorant question, but I am trying to run a shell script that we normally run as a provisioning step in a Vagrantfile. So far I am not finding a way to do this in all my googling or reading the molecule documentation.


The issue here is that I need to run this .ps1 script against any Windows box that I need to run molecule tests against before Ansible can connect to it. I tried doing this by adding a line under instance_raw_config_args like the example at the bottom of this post, but I get an error saying:

"### 2018-08-09 14:15:51 ###
There are errors in the configuration of this machine. Please fix
the following errors and try again:

shell provisioner:
* `path` for shell provisioner does not exist on the host system: /tmp/molecule/windows-iis/default/ConfigureRemotingForAnsible.ps1"

platforms:
  - name: win2012r2
    box: win2012r2
    memory: 2048
    instance_raw_config_args:
      - "vm.network 'forwarded_port', guest: 5985, host: 5985"
      - "vm.provision :shell, path: 'ConfigureRemotingForAnsible.ps1'"

cacam...@ucdavis.edu

unread,
Oct 25, 2018, 3:14:32 PM10/25/18
to molecule-users
Try hosting the script as a gist and using the URL (if you need it to be private)

Since this is the configure script that we all know and love, you can use the publicly hosted one from the official ansible repo:

 "vm.provision :shell, path: 'https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1', args: ' -EnableCredSSP -ForceNewSSLCert'"
Reply all
Reply to author
Forward
0 new messages