|
Justin Vincent |
at Jul 9, 2014 at 3:42 am
|
⇧ |
| |
Just an FYI to let anyone else reading this know that creates will create
the file but it wont stop things if the file exists. However if you use
creates AND unless then you can achieve the same thing. Which is good
because it means you can create an arbitrary file and test for it.
i.e. This works...
setup-rabbit:
cmd.script:
- require:
- pkg: rabbitmq-server
- source: salt://cloud-local/scripts/setup-rabbit
- user: root
- group: root
- shell: /bin/bash
- creates: /etc/salt/state/have-setup-rabbit
- unless: test -f /etc/salt/state/have-setup-rabbit
On 8 July 2014 18:26, Joe Healy wrote:Assuming you are running 2014.1.x I would use the unless or onlyif option
with a command that checks for existence of the file.
See
http://salt.readthedocs.org/en/v2014.1.4/ref/states/all/salt.states.cmd.html#salt.states.cmd.scriptHope that helps.
Joe
On Wed, Jul 9, 2014 at 11:16 AM, Justin Vincent wrote:Ah.
In that case what is best practice to only run a command one time without
using creates?
Thx,
Justin
On 8 July 2014 18:13, Joe Healy wrote:From memory, the creates option was only added in develop and is not
in any released versions yet. Unfortunately the default docs are built from
the develop sources - you can read the relevant version for your release
from the docs site.
Joe
On Wed, Jul 9, 2014 at 10:40 AM, Justin Vincent <
justinvincent@gmail.comwrote:
Any idea why the setup-rabbit: cmd.script: continues to be run even
though I have the creates clause?
Thanks in advance for any help! :)
# ~~~
# Installs and watches rabbitmq
rabbitmq_deb:
pkgrepo.managed:
- name: deb
http://www.rabbitmq.com/debian/ testing main
- keyid: 056E8E56
- keyserver: pgp.mit.edu
- require_in:
- pkg: rabbitmq-server
rabbitmq-server:
pkg:
- installed
- name: rabbitmq-server
service:
- running
- enable: true
- watch:
- pkg: rabbitmq-server
setup-rabbit:
cmd.script:
- require:
- pkg: rabbitmq-server
- source: salt://cloud-local/scripts/setup-rabbit
- user: root
- group: root
- shell: /bin/bash
- creates: /etc/salt/state/have-setup-rabbit
--
You received this message because you are subscribed to the Google
Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.--
You received this message because you are subscribed to a topic in the
Google Groups "Salt-users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/salt-users/LBRF9Owd2Kk/unsubscribe.To unsubscribe from this group and all its topics, send an email to
salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout. --
*Justin Vincent*
CTO
direct: 818.731.2544
office: 312.357.5459
fax: 312.268.6334
justin@digedu.com | www.digedu.com
--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout. --
You received this message because you are subscribed to a topic in the
Google Groups "Salt-users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/salt-users/LBRF9Owd2Kk/unsubscribe.To unsubscribe from this group and all its topics, send an email to
salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout. --
*Justin Vincent*
CTO
direct: 818.731.2544
office: 312.357.5459
fax: 312.268.6334
justin@digedu.com | www.digedu.com
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.