[Feature] Shell Conditions for all plugins
See original GitHub issueI’ve seen a lot of people wanting to do things like optional tasks, or only run sets of tasks, machine specific configs, etc.
I think I might have some level of solution.
Here’s how an implementation might look:
# "Put this only on gaming machines"
- link:
~/.steam/someconfig:
path: gaming/steam/config
create: false
condition: [[ -d ~/.steam ]]
Link plugin (and perhaps shell plugin) gets additional directive: condition
,shellcond
,shellcondition
or whatever, which is a command that is executed and the return status is used as a boolean. If shell returns true (retval 0) then perform the operation, else don’t.
#96 i3 Example:
- shell:
- sudo apt install i3
condition: ! dpkg -s i3 # using ! as in https://stackoverflow.com/questions/367069/how-can-i-negate-the-return-value-of-a-process
- link:
~/.config/i3:
path: i3
condition: dpkg -s i3 # success if i3 is installed
#44 Shell vars Example:
- link:
~/.somewhere:
path: something
condition: [[ ! -z "$INSTALL_SOMETHING" ]]
Could be run as INSTALL_SOMETHING=1 ./install
What’s the feel for a solution somewhat like this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Nagios Series: Configuration Tips and Tricks (Shell Edition)
Macro Conditionals: Nagios has a feature called event handlers that allow you to execute programs after a certain check status. Our example uses ......
Read more >semantic-release/exec - GitHub
All the objects passed to the semantic-release plugins are available as template options. verifyConditionsCmd. Execute a shell command to verify ...
Read more >Converting Conditional Build Steps to Jenkins Pipeline
The Conditional BuildStep plugin lets users add conditional logic to Freestyle jobs from within the Jenkins web UI. It does this by: Adding...
Read more >Working with plugins - Ansible Documentation
Plugins are pieces of code that augment Ansible's core functionality. Ansible uses a plugin architecture to enable a rich, flexible and expandable feature...
Read more >Managing Plugins with Oracle Cloud Agent
Each Oracle Cloud Agent plugin provides functionality related to ... disable individual plugins, as well as start and stop all plugins on an ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like this is related to #88.
A version of this is implemented in #169 / merged in 1b17e8e.