Salt: Require packages installed before executing a formula

0 votes

I have got some formulas that rely on some packages. Right now I'm doing something like this:

    - pkgs:
        - foo
        - bar
    - require_in:
      - sls: brrap
      - sls: blah

Is this the best approach or is there any other better way of doing it?

Jul 13, 2018 in Other DevOps Questions by DragonLord999
• 8,360 points

recategorized Nov 12, 2018 by Priyaj 32 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You're on the right path. Using require_in like you've shown in your example is the correct way of ensuring those packages are installed before you execute brrap.sls etc. All the _in requistites work in the similar fashion. The require_in requisite is very useful when assigning a require in a different sls file.

So far as your brrap.sls blah.sls states do not have to know the additional components required(foo and bar packages) when it is set up, what you've done is perfectly fine.

On the other hand if you brrap.sls and blah.sls do require the foo and bar package to be installed, you should instead try and create a require requisite from brrap.sls and blah.sls.

take this example

    - name: httpd
    - name: httpd

On some of your minions you might want to use the http.sls, and on others you might want to use the http.sls and the php.sls states:

  - http

    - name: php
    - require_in:
      - service: httpd   

Note that httpd server will only start if php is installed

Got through the docs here.

answered Jul 13, 2018 by DareDev
• 6,670 points

Related Questions In Other DevOps Questions

0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,220 points
0 votes
1 answer

Setting up CICD on a local server

As to how to integrate git repo ...READ MORE

answered May 31, 2018 in Other DevOps Questions by ajs3033
• 7,080 points

edited May 31, 2018 by ajs3033 23 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Using conditional to execute a command in salt

You can use unless inside your state ...READ MORE

answered Jul 23, 2018 in Other DevOps Questions by DareDev
• 6,670 points
0 votes
1 answer

How to get issues count based on rules in a sonar project?

There are API docs in the footer ...READ MORE

answered May 4, 2018 in Other DevOps Questions by DareDev
• 6,670 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.