5

I have a very simple use case that I'm trying to get going:

I need to download and install a few tar.gz source packages from the master and then run a script to compile and install all of them.

I realize this is probably a basic question, but any pointers will be appreciated.

/usr/local/src/source1.tar.gz:
  file.managed:
    - source: salt://sources/source1.tar.gz
    - user: root
    - group: root
    - mode: 644

/usr/local/src/source2.tar.gz:
  file.managed:
    - source: salt://sources/source2.tar.gz
    - user: root
    - group: root
    - mode: 644

/usr/local/src/source3.tar.gz:
  file.managed:
    - source: salt://sources/source3.tar.gz
    - user: root
    - group: root
    - mode: 644

//I need something like this, but am not sure how to do it
compile_and_install:
  - require: /usr/local/src/source1.tar.gz
  - require: /usr/local/src/source2.tar.gz
  - require: /usr/local/src/source3.tar.gz
  cmd.script:
    - source: salt://scripts/compile_and_install.sh
    - user: root
    - group: root
    - shell: /bin/bash

2 Answers 2

6

Figured it out, in case it helps someone in the future:

/usr/local/src/source1.tar.gz:
  file.managed:
    - source: salt://sources/source1.tar.gz
    - user: root
    - group: root
    - mode: 644

/usr/local/src/source2.tar.gz:
  file.managed:
    - source: salt://sources/source2.tar.gz
    - user: root
    - group: root
    - mode: 644

/usr/local/src/source3.tar.gz:
  file.managed:
    - source: salt://sources/source3.tar.gz
    - user: root
    - group: root
    - mode: 644

compile_and_install:
  cmd.script:
    - require:
      - file: /usr/local/src/source1.tar.gz
      - file: /usr/local/src/source2.tar.gz
      - file: /usr/local/src/source3.tar.gz
    - source: salt://scripts/compile_and_install.sh
    - user: root
    - group: root
    - shell: /bin/bash
1

Recent versions of salt have taken much of this pain away with State Auto Ordering on by default. http://docs.saltstack.com/ref/states/ordering.html#state-auto-ordering

That said, your solution is the better one of explicitly stating the requirement.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .