[chef] RE: RE: Re: RE: Re: Idempotent IIS


Chronological Thread 
  • From: Adam Edwards < >
  • To:
  • Subject: [chef] RE: RE: Re: RE: Re: Idempotent IIS
  • Date: Fri, 21 Feb 2014 12:09:20 -0800

Seems like you can do this without powershell_out – you can coerce powershell to return an exit code using the exit command in powershell – here’s an example:

 

  not_if 'powershell -noninteractive -noprofile -command "exit [int32]((Get-ExecutionPolicy) -eq 'RemoteSigned')"'

 

The above guard will cause the resource to not execute if powershell’s execution policy is set to remotesigned.

 

Somewhat related, here is a proposal to make it easier to use powershell and other script resources in guard expressions:

 

https://github.com/opscode/chef-rfc/blob/adamed/resource-guard/rfc0001-resource-guard.md

 

-Adam

 

From: Kapil Shardha [mailto: "> ]
Sent: Friday, February 21, 2014 12:02 PM
To: ">
Subject: [chef] RE: Re: RE: Re: Idempotent IIS

 

Chef resources do not return a value (as far as I know). You will have to use “powershell_out” to check for certain condition and based on what it returns you can trigger the iis_config resource.

 

-Kapil

 

 

From: Kenneth Barry [ ">mailto: ]
Sent: Friday, February 21, 2014 2:58 PM
To: ">
Subject: [chef] Re: RE: Re: Idempotent IIS

 

Can I use powershell to check the settings, but if the powershell indicates they are different than what they should be, have the iis cookbook sections run again?

Something like

powershell_script "checking setting #1"

(check if settings are the same)

iis_config

only do this is "checking setting #1" returned false.

This is more of a capability/syntax question.

 

On Fri, Feb 21, 2014 at 11:54 AM, Kapil Shardha < " target="_blank"> > wrote:

I ran into same issue when I started using IIS cookbook. I had to write my own cookbook with powershell script in it to do the job.I used guards to ensure idempotency.

 

Kapil



-------- Original message --------
From: Stephen Nelson-Smith
Date:02/21/2014 2:37 PM (GMT-05:00)
To: " target="_blank">
Subject: [chef] Re: Idempotent IIS

Hi,

 

On 21 February 2014 19:31, Kenneth Barry < " target="_blank"> > wrote:

 

Question:

How are (those of you who are working in Windows/IIS), ensuring Idempotent Recipes for configuring IIS?

 

On occasions where the community cookbook doesn't provide idempotent resources, I call out to powershell, and add a guard where needed.

S.




--
Stephen Nelson-Smith,
Founder, Principal Consultant,
Atalanta Systems Ltd,
Web: http://agilesysadmin.net
Twitter: @lordcope
Skype: atalanta.systems
Direct: +44 (0) 1329 550203
Mobile: +44 (0) 7917 101919

Atalanta Systems: The Agile Infrastructure Enablers
http://atalanta-systems.com

 



This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

 

 



This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.




Archive powered by MHonArc 2.6.16.

§