ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Beginner SaltStack Question: Can minions be placed in folders or groups ? (Coming from AD perspective)

    IT Discussion
    saltstack salt ad active directory minions
    4
    7
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Emad RE
      Emad R
      last edited by

      Hi,

      To the title say its all, i am learning more and more about SS, especially for AD alternative.

      till know I love what I see, not just like.

      I wonder wondering If I have currently 3 minions, for example:

      [root@salt ~]# salt '*' test.ping
      172:
      True
      123:
      True
      vm:
      Minion did not return. [Not connected]

      Can I place minion 172 and minion 123 in certain group or folder ? like you would do with AD ?

      So when I type a command :

      salt 'GROUP X' cmd.run 'del C:\opera.exe'

      I can launch this command on 172 + 123 ?

      Many thanks in advance for continual support.

      Perhaps when I finish I will write a tutorial.

      black3dynamiteB RomoR 2 Replies Last reply Reply Quote 0
      • black3dynamiteB
        black3dynamite @Emad R
        last edited by

        @msff-amman-Itofficer
        This might help you. https://docs.saltstack.com/en/latest/topics/targeting/index.html

        1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller
          last edited by

          There are all kinds of ways to put them in groups. You can use simple regex on hostnames, you can define groups and so forth. Quite powerful and flexible.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            The simplest is hostname regex and lots of shops do this. In NTG we have a naming convention like this...

            dny-lnx-lamp1

            That tells us the datacenter, operating system family and application purpose. To use groups I could do things like...

            salt 'dny-*' ....
            salt '*-lnx-*' .....
            salt '*-lamp*' .....
            

            The first example would use the group for "any server at the dny datacenter.". The second would be "all Linux servers." The third would be "just lamp application stack machines." You can put them together, too, like this...

            salt 'dny-lnx-lamp*' ....
            

            So that it would only target Linux based LAMP stack application servers at dny but would get all of them, because there might be lots of them.

            Emad RE 1 Reply Last reply Reply Quote 3
            • RomoR
              Romo @Emad R
              last edited by Romo

              @msff-amman-Itofficer in your specific example you can easily pass a list of hosts you want to target

              salt -L '172,123' test.ping
              

              If you would like to define a more long term list of minions you can use nodegroups. Define your nodegroups in your master config file /etc/salt/master :

              nodegroups:
                group1:
                    - 172
                    - 123
                group2: L@172,123
              

              Both groups target the same minions but with a different syntax, you can use the one you prefer. Group1 is using a YAML list and group2 is using compound matchers. With your nodegroup defined you can now target it as follows:

              salt -N group1 test.ping
              

              Saltstack has lots of targeting options you should check the docs to better understand them.

              • https://docs.saltstack.com/en/latest/topics/targeting/index.html
              • https://docs.saltstack.com/en/latest/topics/targeting/index.html#advanced-targeting-methods
              1 Reply Last reply Reply Quote 4
              • Emad RE
                Emad R @scottalanmiller
                last edited by

                @scottalanmiller

                ohh shit, how did that get passed me...

                Great, thanks again.

                scottalanmillerS 1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @Emad R
                  last edited by

                  @msff-amman-Itofficer said in Beginner SaltStack Question: Can minions be placed in folders or groups ? (Coming from AD perspective):

                  @scottalanmiller

                  ohh shit, how did that get passed me...

                  Great, thanks again.

                  🙂

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post