Since Puppet uses the same exec resource type on both *nix and Windows systems, there are a few Windows-specific caveats to keep in mind. 0. txt –Value “Hello”’, logoutput => true, provider => powershell, } } The three parameters I use in this manifest are command, logoutput and provider. 2 Answers Sorted by: 6 test work for me at /usr/bin, so adding it to path could solve error. Create exec resources with metadata to ensure it is idempotent. require means that the the resource passed to require must be applied before the calling resource. (See the notes on refreshing below. Classes are named blocks of Puppet code that are stored in modules and applied later when they are invoked by name. Generally speaking, details of machines' current state on which Puppet is to base decisions about the contents of that machine's catalog must be communicated to the. Sequence of Execs in Puppet. Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. Running Powershell in Puppet. Machines receiving task requests must have SSH or. Modules. 163k 8 82 159. How would the watchdog service know the Puppet exec failed? I don't want to remove the dir or run the exec if the directory does exist and the first exec was completed successfully. 1', } Puppet supports if and unless statements, case statements, and selectors. supported Adds a new exec provider for executing PowerShell commands. unless. But Puppet is quite hard to learn. What is Puppet? | How Puppet Works? | Puppet Tutorial For. 1. 1. The Puppet Design Philosophy Before we begin to explore best practices with Puppet, it’s valuable to understand the reasoning behind these recommendations. Topics. 0. Puppet: Conditional exec using unless-option. 0 a new feature "relationship syntax" was introduced. 1. PUP-11199. Puppet advanced default params. 1. We explore practical examples and best practices for handling procedural requirements when we look at the exec resource type in Chapter 5. Puppet: Conditional exec using unless-option. txt ]; then echo "my_fileexists=yes" else echo "my_filexists=no" fi. Adds a new exec provider for executing PowerShell commands. The difference between platform engineering and DevOps is pretty nuanced. . This module is particularly helpful if you need to run PowerShell commands but don't know how PowerShell is executed, because you can run PowerShell commands. Puppet Resources are the building blocks that puppet uses to model system configurations. 0. Installing servers with Puppet is a real plus compared to shell (yeah captain Obvious!). The default behavior is to report the exit code only for the last command in the pipeline. Adds a new exec provider for executing PowerShell commands. Any recommendations on running. d/x exists then /bin/true is run (successfully). Like if statements, case statements choose one of several blocks of arbitrary Puppet code to execute. You can also set variables within the manifest, which can change the. Puppet uses the same exec resource type on both *nix and Windows systems, and there are a few Windows-specific best practices and tips to keep in mind. 1. Doing some research, and looking at blog posts, I know that the structure of my code should be something along the lines of (I know it's not correct): exec {'function_name': # the script that downloads/installs/activates etc. However, I strongly recommend that you do not use any kind of non-conditional exec with puppet. November 8, 2023. Sort by Year. The file will be generated in the directory you're currently in, unless you specify otherwise. Puppet Exec with no command attribute. All modules; Supported modules; Modules with tasks; Contribute. 0. Hot Network QuestionsOn this site you can find information about supported enterprise-grade puppet modules. The onlyif and unless commands of an exec are used in the process of determining whether the exec is already in sync, therefore they must be run during a noop Puppet run. 1. But either way the trailing exit statement in the command will return a non-zero exit code if that happens. 5. instances method defined) a parameter that can ensure the resource's absence; When both these conditions are met, Puppet can purge the resources it doesn't explicitly. If the query specified in the unless parameter returns one or. if exec joins the domain, it should have an unless condition that tests whether or not the machine is part of the domain. (2) it is unclear from your description whether the Exec's command is actually run (vs. Share. Puppet: exec onlyif value is not equal. Puppet exec unless doesn't appear to work how I expect. The value that represents the data type of these values is Type. 0 a new feature "relationship syntax" was introduced. 0 how to ensure puppet exec run on every event triggered? 0 Puppet: How to execute a Exec resource if another Exec resource failed. As a result, the chown in the main command always is run, and that is reported. – Note that Puppet issue 8083 should not affect you in the case that the Application-Server feature is installed, but it is unclear (to a non-initiate in Powershell) what the exit code of that 'unless' command will be in the alternative case. Visit Stack ExchangeYes, you'd put a script into your modules path under a facts. Puppet uses the same exec resource type on both *nix and Windows systems, and there are a few Windows-specific best practices and tips to keep in mind. The problem also happens to my start command which also use bundle exec: after puppet finished dea_ng::install and run dea_ng::service, the command below did not work unless I execute it manually on the client machine. Based on that documentation, a when statement was added: - name: add vhost sensu command: rabbitmqctl add_vhost /sensu when: rabbitmqctl list_vhosts | grep sensu. And, since that file will no longer exist after the first reboot, subsequent puppet runs would NOT deploy these 2 scripts unless the host was rebuilt. In this case specifying a directory is done by setting ensure to (unsurprisingly) directory. Over the years of using puppet I've noticed that people often come up with the same kind of. You can validate that a manifest's syntax is correct by using the command puppet parser validate. The CentOS/Puppet installation process should already have created a directory called /etc/puppet (If it hasn’t, create it with mkdir /etc/puppet ). You should never use this API unless you absolutely must support Puppet 3. ##Limitations. 2 or later for the pip3 provider, what is an alternative approach to installing Python packages by hand via the 'pip3' command? If I use the 'exec' approach, how do I control the package from being reinstalled all the time? (i. The onlyif parameter is defined as. This part of the series will walk you through the process of automating server provisioning using Puppet, a popular configuration management tool capable of managing complex infrastructure in a transparent way, using a master server to orchestrate the configuration of the nodes. As per the exec documentation, the onlyif/unless exec command result will override the receipt of refresh. The generic way for "manually" creating a service in Windows is to use the sc. Puppet File resource runs despite Exec unless. Thus:I only want to execute that if the hostname is not what it should be: exec { 'update hostname': command => 'sudo hostname VM01', unless =>. I am trying to use code like this: exec { 'example':. However, when I clean my /tmp and apply the manifest again, it fails because the first exec doesn't executed. I do not account that a bug, however, as (1) it's probably more useful behavior, and (2) it's consistent with the example in the docs. The synchronization of an out-of-sync Exec resource involves only running the command given by its 'command' property, so that's the only part that --noop prevents. The 'onlyif' and 'unless' commands of an Exec are used in the process of determining whether the Exec is already in sync, therefore they must be run during a --noop Puppet run. If executed as root, the lxc-info checks for the name among the root containers. Only supported on Windows Server 2003 and above, and Windows 7 and above. From the puppet i get the error:The solution is to invoke bash with the command as an argument, i. -- Peter Bukowinski. I was hoping to use onlyif in my class, but it seems a little confusing when trying to check for an absent registry value that contains my route. Puppet Development Kit. Puppet has two main ways to declare classes: include-like and resource-like. 1. To do this in Puppet you would have to use an Exec and invoke setfacl (if you were on Linux, for example) directly. Q&A for work. All groups and messages. Puppet running exec. refreshonly => true on an Exec resource requests that its command be run only in the event that the resource is refreshed. 2. Puppet strange behaviour of execs. Autorequires: If Puppet is managing an exec’s cwd or the executable file used in an exec’s command, the exec resource will autorequire those files. The second one unzips it. Hot Network Questions tcpdump -vvv is not verbose enough In which situations or societies do people not take turns to. 1 Answer. This runs the first-exec, and unless /var/exists it runs the second-exec. ps1 script. You might want to use the refreshonly parameter on your exec. When using cmd. The problem is that the exec command is running before the group command. So the "cwd" now impacts the path of the "onlyif". In a particular project, I have a lot of Puppet exec resources with pipes. Adds a new exec provider for executing PowerShell commands. 5. If none of the cases match, Puppet will do nothing and move on. JULY . Default: Undefined. 0. h ), and the sub-processes it spawns. Hiera supports booleans, and always has done so -- or at least, it is so documented. 6. So for your example, it would probably be better to extend the exec to add an unless or onlyif parameter, so the command only runs if the database doesn't already exist. For example, the value String represents the data type of strings. onlyif => "/sbin/swapon -s | /bin/grep file > /dev/null" - This step works only if there is no swap in place, but if the swap file is already created, then the step fails. puppet exec returned 1 instead of [0] 1. This module adds a powershell and pwsh provider to the exec type, which enables exec parameters, listed below. An exec resource, which starts a powershell script, which starts a PowerShell process, which starts a CMD process, which runs a batch file (with an invalid path), which runs another batch file, which processes some kind of response file. Puppet - Check if package is installed, but do not require it. Platform Engineering. Aside from being good. This is a textbook case where you should write the test first, and the code after. It would be better to explicitly "exit 0" whenever you do not "exit 1". However currently I am struggling to figure out how to do this. exec { 'chkconfig': command => "/sbin/chkconfig --add $ {shutdown_script}", require => File ['shutdown-script'] } This is actually your root cause here. Executables, zips and or tar. From the puppetlabs docs: The noop metaparameter allows you to apply individual resources in noop mode, and will override the global value of the noop setting. ” There is also a set of values whose data type is “data type. NOTE: This page was generated from the Puppet source code on 2019-09-06 09:16:04 -0700 exec Attributes Providers Description Executes external commands. The exec has an onlyif, unless, or creates attribute, which prevents Puppet from running the command unless some condition is met. if statement, with in expression. <%= EXPRESSION %> — Inserts the value of a single expression. Here is the service file springboot. Is there a way to tell puppet to only execute command if one of the files does not exist? 1. Puppet can take an existing PowerShell Module and build a Puppet module out of it. The 'unless' and/or 'ifonly' commands must run every time, though. If a manifest has no syntax errors, the tool outputs nothing. Sequence of Execs in Puppet. execute update-grub, which would look for avaliable kernels and would add related configs to the menu. The setuid/setgid/sticky digit is also a. Expressions are statements that resolve to values. 0 and above would look like this: exec { "apt-update": command => "/usr/bin/apt-get update" } Exec["apt-update"] -> Package <| |> Every time a package command is executed, the dependency (in our case 'apt-update') will be triggered fist. Manage local groups . fail when a file exist in puppet. code. This module is particularly helpful if you need to run PowerShell commands but don't know how PowerShell is executed, because you can run PowerShell commands. Conditional statements allow you to write Puppet code that will return different values or execute different blocks of code depending on conditions you specify. command => '/path/to/script. refreshonly => true on an Exec resource requests that its command be run only in the event that the resource is refreshed. escape. Puppet provides a built-in exec type that is capable of executing commands. I need puppet to execute a script that is inside an installed app. Their exit codes convey whether to proceed with running the main command. Puppet reboot in stages. , are rigorously tested, will be maintained for the same lifecycle as Puppet Enterprise, and are compatible with multiple. An example in Puppet 2. How to set Powershell ExecutionPolicy via Puppet exec command with unless property on Windows? 1. The Forge is an online community of Puppet modules submitted by Puppet and community members. I think this is due to how the PowerShell module calls PowerShell - it passes -ExecutionPolicy Bypass as part of the powershell. onlyif => "/sbin/swapon -s | /bin/grep file > /dev/null" - This step works only if there is no swap in place, but if the swap file is already created, then the step fails. The command specified causes the exec to be triggered unless the command specified returns a success (zero) exit status. Default: Undefined. g. Adds a new exec provider for executing PowerShell commands. Project. exe; Backslashes only. exe"", path. The statement itself is simple but the class doesn't contain any built-in conditional checks (similar to "unless =>" in exec class). This module adds a powershell and pwsh provider to the exec type, which enables exec parameters, listed below. jar file is actually an update for an application which is running as a service. However, I only want to apply the 'netsh advfirewall reset' exec if firewall rules other than what I have specified in Hiera exist. Apart from all that, it is good practice with Puppet to actually deploy wrapper scripts that your exec resources. Publish a module; Topics. Adds a new exec provider for executing PowerShell commands. The exec has an onlyif, unless, or creates attribute, which prevents Puppet from running the command unless some condition is met. 2. exec { ‘SETHELLO’: command => ‘Add-Content -Path c:\test. asked Apr 1, 2022 at 20:47. Creating a directory is another task that is handled by the powerful and flexible file type. Here's an example: @user { 'foo': groups => ['somegroup'], membership => minimum, } Then realize that virtual user with then collection syntax: User <| title == foo |>. This page is about the legacy API, which uses the Puppet::Parser::Functions namespace. The 'onlyif' and 'unless' commands of an Exec are used in the process of determining whether the Exec is already in sync, therefore they must be run during a --noop Puppet run. Doing some research, and looking at blog posts, I know that the structure of my code should be something along the lines of (I know it's not correct): exec {'function_name': # the script that downloads/installs/activates etc. I will show how these work in the example below. The service will detect it is not running and start itself if required. , are rigorously tested, will be maintained for the same lifecycle as Puppet Enterprise, and are compatible with multiple platformsTechnically, in fact, you cannot do so: Puppet will interpolate the variable's value into the Exec resource's catalog representation, so there is no variable left by the time the catalog is applied, only a literal. The Win32 APIs define exit. txt ]; then echo "my_fileexists=yes" else echo "my_filexists=no" fi. puppet exec command issue. The synchronization of an out-of-sync Exec resource involves only running the command given by its 'command' property, so that's the only part that --noop prevents. The exec has an onlyif, unless, or creates attribute, which prevents Puppet from running the command unless some condition is met. 0. 0 Puppet strange behaviour of execs. . The exit status when you run it directly and the exit status you expect it to return are irrelevant. txt 2>&1. When you share a folder on your computer, other users on the same network can access the files and folders inside it. Expressions can be compounded with other expressions, and the entire combined expression resolves to a single value. To run an exec task, use the task command, specifying the command to be executed. One thing that you can do (and I don't recommend) and that is not "puppet way" is following:If you want to specify to take a given action if file exists, if file doesn't exist etc. Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. And elsewhere you can add to the parameters for. Writing some classes for cassandra, one of them is to align clustering settings using puppet exec etc. The Puppet “exec” resource allows users to run commands and scripts on nodes. exec { "Test": command => "/bin. The documentation referenced is about something different: the 'unless' statement. It will package up all of its DSC resources and then wrap the Puppet Resource API around it so you can invoke it just like any other module. refreshonly: Only run the command if the resource is refreshed due to a notify or subscribe metaparameter; cwd: Sets the working directory. Learn to use Bolt to execute commands on remote systems, distribute and execute scripts, and run Puppet tasks or task plans on remote systems that don’t have Puppet installed. The logic looks a little confusing but basically, the way I understand unless is that if the command returns a 0, then the whole exec wont be run. This module adds a powershell and pwsh provider to the exec type, which enables exec parameters, listed below. Puppet is about describing state and making sure things only have to run once. txt –Value “Hello”’, logoutput => true, provider => powershell, } } The three parameters I use in this manifest are command, logoutput and provider. In addition I need to run only if it detects an older version of the and is not on a certain server and then install the new version. 0. 5. Case statement. 17 also improves the way typed class parameters are checked. 1. ps1', } Puppet uses the same. It's one that can change your daily work flow for the better once you start using it, but like all open ended tools, it can take a little while to become familiar with. Improve this answer. Adding a / to the end of a file name isn't enough to tell puppet to. When I apply the manifest for the first time, it works correctly. when i do it manually ("CREATE ROLE replica ENCRYPTED PASSWORD '123';") it does work, but for some reason it does not work from the puppet. exec. See “Case Matching” below for details on how Puppet matches different kinds of cases. 2. exec { 'mysql post cmd1': command => 'whatever', require => Mysql::Db['cosmed'], unless => 'command to check that this exec has been applied. The notifying arrow is a tilde and a greater-than sign ( ~> ). config/autostart ]' is not qualified and no path was specified. 9]: FAILED! => {"failed": true, "msg": "The conditional check 'rabbitmqctl. I have a script that really only needs to be run one time on a server, i. 2. But it is certainly worth verifying the type and value of your variable. 1st - 2nd Smithers Midsummer Festival Smithers BC. Sep 13, 2012 at 15:51. Explanation Sometimes a simple creates isn't enough to determine if an exec should run or not. As far as I know, the basic file type in Puppet only handles discretionary permissions that only allow for one group and one owner. These are command. if reason variable null or empty, halt with an explanatory message; Bash's -z conditional operator can catch both null and empty cases, including when the value is null on account of the variable not being set at all, but remember that it is evaluated after the command is fully expanded. Note: PowerShell variables (such as $_) must be escaped in Puppet manifests either using backslashes or single quotes. Need to copy a file via puppet only if a Windows MSI package is not installed. Puppet File resource runs despite Exec unless. indicates that the shell tried to execute '3' as a command, and, unsurprisingly, did not find it. 12 behavior got changed to match the intention. The Puppet exec resource has OnlyIf and Unless attributes which can be used to limit when the command is invoked; e. How do you configure a Puppet exec to execute another command as part of onlyif. 0. EPP has two tags for Puppet code, optional tags for parameters and comments, and a way to escape tag delimiters. The way I check this is if the gopher user has the default uid of 13. An 'unless' statement could be used to avoid declaring the package at all in the event that a custom fact. As a result, notifications are shown as a change on every Puppet run. Yet when I run puppet agent -td I see that the puppet agent IS executing pkill -SIGQUIT mysqld; sleep 5; systemctl restart mysqld. Yet when I run puppet agent -td I see that the puppet agent IS executing pkill -SIGQUIT mysqld; sleep 5; systemctl restart mysqld. Maybe. You may need to reboot the system after enabling if SELinux was. To ensure the resource is idempotent, specify one of the creates, onlyif, or unless attributes. 1. I was hoping to use onlyif in my class, but it seems a little confusing when trying to check for an absent registry value that contains my route. This can be used with bash on Linux,. Background: I am upgrading our lxc puppet module to support the emerging unprivileged LXC technology. Follow answered Jan 12, 2015 at 6:48. All groups and messagesCreate A Puppet Configuration File. Puppet FuturePuppet is a configuration management tool which helps you to build the infrastructure and maintain its state. For. Note also that Exec has other parameters that can lead to instances being applied successfully without their commands being run. Windows puppet exec command file path. 1. But because a dependency failed, Exec['Y'] will be skipped during this transaction. – tom. The Puppet “exec” resource allows users to run commands and scripts on nodes. exec command unless directory exists in puppet. 2. The script remaps several legacy user id's that conflict with local system users. Modules that are supported by Puppet, Inc. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any. Sorted by: 18. 12, but from 5. 2 or later for the pip3 provider, what is an alternative approach to installing Python packages by hand via the 'pip3' command? If I use the 'exec' approach, how do I control the package from being reinstalled all the time? (i. This style guide applies to Puppet 4 and later. The second one unzips it. 1. In your case, it sounds like you want the exec to run only when your file changes. There are a number of parameters you can set. Hot Network QuestionsPuppet avoids destroying directories unless the force attribute is set to true. There are three main ways for an exec to be idempotent:Conversations. Mar 25, 2015 at 21:56 @Fr3edom21 if this answer is acceptable, please accept it as the answer. When a lambda requires extra information, pass it to a function that provides the information and to evaluate the code, possibly multiple times. jar', } Should this be part of the manifest which could look like this?Each value in the Puppet language has a data type, like “string. The Puppet “exec” resource allows users to run commands and scripts on nodes. You can use not filter to get unless like behavior. But I think the correct way is to use creates: The exec has an onlyif, unless, or creates attribute, which prevents Puppet from running the command unless some condition is met. how do I tell 'puppet apply' that the package is already installed) But you really need something like an onlyif or unless or this is going to execute every 30 minutes and that breaks the idempotent rule we try and apply with Puppet code where things only change if they need correcting. Alternatively, if that is valid, call the prior script through the latter's onlyif or unless parameter, instead of as its own exec resource. Unless you are sharing with the world, you don’t need most. Right now I have: exec { 'first command': command => "some command" path => '/usr/bin', notify => Exec ["second command"], } exec {. If invoked by a. 2. Share. I want to check if the file exists in the client. The exec has an onlyif, unless, or creates attribute, which prevents Puppet from running the command unless some condition is met. The cis_security_hardening module has a parameter enforce for each rule. , are rigorously tested, will be maintained for the same lifecycle as Puppet Enterprise, and are compatible with multiple platforms. exec command unless directory exists in puppet. Re-writing scripts into manifests is time-consModules that are compatible with Puppet Development Kit (PDK) validation and testing tools. 2. However; I would like promote these into our production branch. Taking the baseline time away, the old module took 20 seconds (32 - 12) and the new module took 10 seconds (22 - 12). Is there a way to tell puppet to only execute command if one of the files does not exist? 0. In this blog post, we'll make it simple with definitions and examples to explain the basics of platform engineering vs. The onlyif and unless commands of an exec are used in the process of determining whether the exec is already in sync, therefore they must be run during a noop Puppet run. Puppet seems to be behaving exactly as I would expect, with the only potentially surprising thing being that even the 'posix' provider runs the 'unless' and 'onlyif' commands via the shell. Puppet strange behaviour of execs. If you declare users as virtual resources , you can then use 'realize' or the collection syntax ( User <|. or use the 'resolvconf --disable-updates' exec resource's 'unless' parameter to test for a running unbound daemon prior to installing the package. 🔩 Tip: Unless your module also includes tests for manifest code, add the BoltSpec helpers and configure Puppet and Bolt in spec_helper. When you use any of the four so-called metaparameters for relationships in Puppet - those being: require , before , subscribe & notify - you tell Puppet that you want the application. exec { "Change status and start-up of Win service": command => 'C:WindowsSystem32WindowsPowerShellv1. Puppet File resource runs despite Exec unless. Since I don't have Puppet 4. 1. Hot Network Questions To find rate of change of area of triangle when rate of change and value of length of base and height are 3cm/min, 5cm/min and 8cm,10cm respectively. execs will always run. This can be used with bash on Linux, but with the PowerShell provider, it can run PowerShell on Windows and Linux nodes as well. I read the message you ask about as saying that the Exec was not refreshed, so the command will not be run. newtype (:yumgroup) do @doc = "Manage Yum groups A typical rule will look like this: yumgroup { 'Development tools': ensure => present, } " ensurable newparam (:name) do isnamevar desc 'The name of the group' end end. service. Because the same concept underlies these different forms of conditional logic available in Puppet, we'll only cover the if statement in the tasks for this quest. password is not getting changed to the default password and also chage. I can do something like: file { '/tmp/wehavepostfix': ensure => file, content => "foobar", require => Package ['postfix'], } However, this requires something like:With PE, run puppet task run exec command="df -h" --nodes neptune. The Forge makes it easier for you to manage Puppet and can save you time by using pre-written modules, rather than writing. Modules that are compatible with Puppet Development Kit (PDK) validation and testing tools. This will not work because the Package resource type does not have an 'unless' parameter -- that's a feature specific to Exec resources. The onlyif and unless commands of an exec are used in the process of determining whether the exec is already in sync, therefore they must be run during a noop Puppet run. The onlyif and unless commands of an exec are used in the process of determining whether the exec is already in sync, therefore they must be run during a noop Puppet run. Puppet exec unless doesn't appear to work how I expect. Scripts file serving mount. 2. I would like to add a number of control gates into my manifest via onlyif and unless. Resource default for the exec type A resource default statement set default attribute values for a given resource type. exec { 'chage': path => '/usr/bin/', command => 'chage -d 0 askar', subscribe => File ['askar'], refreshonly => true, } } I then verified that after applying the refreshonly parameter , the. They take a control expression and a list of cases and code. Puppet - How to purge a directory. Puppet: how to remove a directory and everything in it. 7. How can I tell Puppet to stop a service on shutdown without keeping it running? 0. It looks like you're having Puppet execute a shell script to perform the installation. The ensure (see ensurable. } @choover Unfortunately that won't work. g. Using virtual box and a vagrant bas. For example, to view the free disk space of a host, run: With. Description. In the Puppet language, nearly everything is an expression, including. 1. log. 1. properties. notify is set on the user, and refreshonly is set on the exec. This release documents the noop behavior of the onlyif and unless parameters of the exec resource. Exec ['get-chocolatey'] -> Package<| provider == 'chocolatey' |>. Default: Undefined. 00 GiB'and $::facts['processorcount'] >= 2 and Exec['port_connectivity'] condition was successful. If you remove the parameter it will also fail if the regular execution policy is set to Restricted. sh', onlyif => systemctl service_trendmicro, # which system should return. exe /c C:/test. '". They take a Boolean condition and an arbitrary block of Puppet code, evaluate the condition, and if it is false,. Running Powershell command directly using Puppet exec resource. e. How to pass multiple values in exec command resource in puppet? 0. 4 Answers Sorted by: 24 Have you tried this? onlyif => "test ! -f /usr/local/bin/papply" Not sure if Puppet can use the '!' character Perhaps a better. But if you want specifically to use the unless or onlyif property of an Exec resource to control whether to run that Exec's command, then you have to understand that those properties specify operating system commands to run to perform the evaluation. 0, to 5. One way is to use custom fact but that gets a bit too complicated as it requires ruby knowledge and custom facts execute on each and every server. I have a requirement where one exec notifies another exec which notifies a defined resource type (which sets some variables and runs an internal exec). Execute installers from shared (samba) folder instead of copy it first to agent system does not solve the issue. Share Puppet can execute binaries (exe, com, bat, etc.