Skip to content

Instantly share code, notes, and snippets.

@openfly
Created September 18, 2015 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openfly/a83486cd56acc45b6dbc to your computer and use it in GitHub Desktop.
Save openfly/a83486cd56acc45b6dbc to your computer and use it in GitHub Desktop.
example of dict iteration in salt
dict.sls
{
plugin: "http://url/path/plugin.jpi"
}
state.sls
{%- import_yaml "dict.sls" as custom_plugins %}
{% for cust_plugin,cust_plugin_url in dict.iteritems() %}
# manually downloading the plugin, because jenkins-cli.jar doesn't seem to work direct to artifactory URLs.
download-plugin-{{ cust_plugin }}:
cmd.run:
- name: curl -o {{ cust_plugin }}.jpi -O "https://{{ repo_username }}:{{ repo_password }}@{{ cust_plugin_url }}"
- unless: java -jar jenkins-cli.jar -s "http://127.0.0.1:8080" list-plugins | grep "{{ cust_plugin }}"
- cwd: /tmp
- user: jenkins
- require:
- pkg: jenkins
- service: tomcat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment