Chef Recipe Only If
It uses supports manage home true.
Chef recipe only if. The following example shows how to use the only if condition to create a file based on a template and using the presence of an attribute on the node to specify the condition. Template tmp somefile do mode 00644 source somefile erb only if node some. Create a file but only if an attribute has a specific value. The recipe dsl also helps ensure that recipes interact with nodes and node properties in the desired manner.
For example a single command that is run by itself. The following example shows how to use only if to ensure that chef infra client will attempt to register asp net only if the executable is installed on the system on both 32 and 64 bit systems. However this is not a normal resource but a normal method. Aspnet regiis env windir microsoft net framework v4 0 30319 aspnet regiis exe.
I have two resources in my recipe. My second resource is a bash resource. The following example shows how to use only if to only remove a recipe named recipe ntp undo. The recipe dsl is a ruby dsl that is primarily used to declare resources from within a recipe.
Alternatively i d like to prevent the notifies clause of a. Most of the methods in the recipe dsl are used to find a specific parameter and then tell chef infra client what action s to take based on. The first one is a user resource that sets the user uid gid home directory etc. I d like to create an execute block which is only run when some specific condition is met in this case if an interface wlan0 is present.
Some execute resource commands are run by themselves but often they are run in combination with other chef resources. Therefore it ignores anything passed to it including only if or not if.