Hi Greg, I get the following output: 10.x.x.x [2014-06-05T11:24:50+01:00] ERROR: Running exception handlers 10.x.x.x [2014-06-05T11:24:50+01:00] ERROR: Exception handlers complete 10.x.x.x [2014-06-05T11:24:50+01:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out 10.x.x.x [2014-06-05T11:24:50+01:00] FATAL: NoMethodError: undefined method `ip_address' for Chef::Resource::PowershellScript New-NetIPAddress –InterfaceAlias "Local Area Connection" –IPv4Address #{node[ip_address]} Does it have to be in quotes? “#{node[ip_address]}” Cheers, Simon. From: Greg Zapp [mailto:
Hi Simon, I have updated that gist to show two examples. The second block there will run the action immediately. You might need that if the rest of your Chef run requires the IP address being changed to what you've passed in. -Greg On Thu, Jun 5, 2014 at 1:44 AM, Greg Zapp <
" target="_blank">
> wrote: Hi Simon, -j would be correct but it takes a JSON string: '{ "ip_address" : "10.x.x.x", "prefix" : 24, "gateway" : "10.x.x.x" }' After that, assuming you have knife bootstrap working with Windows, you should be able to use string interpolation inside a HEREDOC to craft your powershell command/script with the attributes:
https://gist.github.com/ProTip/a2301025cfc4d8b9500f Cheers, -Greg On Thu, Jun 5, 2014 at 1:20 AM, Greg Zapp <
" target="_blank">
> wrote: Hi Simon, Is your difficulty with getting the attributes into Chef or using them once they are there? -Greg On Wed, Jun 4, 2014 at 9:36 PM, <
" target="_blank">
> wrote: Hi, Disclaimer This message is intended only for the use of the person(s) ("Intended Recipient") to whom it is addressed. It may contain information which is privileged and confidential. Accordingly any dissemination, distribution, copying or other use of this message or any of its content by any person other than the Intended Recipient may constitute a breach of civil or criminal law and is strictly prohibited. If you are not the Intended Recipient, please contact the sender as soon as possible. Totaljobs Group Limited Registered Office: Holden House, 57 Rathbone Place, London, W1T 1JU, UK Registered in England and Wales under company no. 4269861 |
Archive powered by MHonArc 2.6.16.