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

    Saltstack Query

    IT Discussion
    salt saltstack
    5
    29
    1.2k
    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.
    • R
      roninmage
      last edited by

      I am a Windows Network Engineer but my company has Saltmaster installed on a Linux box (Ubuntu). I am comfortable using Linux, but not as proficiently as Windows. The Saltmaster manages both Windows and Linux minions. Our Linux guy has moved on to greener pastures so I have been tasked with "querying the salt master for a list of all machines that have a specific pkg installed" Since I don't know anything about Salt, I spent hours researching installation and configuration without finding any useful information. I thought it would be stored on a SQL db where I could just build a query for what I need but the system reports no SQL installed.

      How do I get Saltmaster to give me a list of computers with a specific program (pkg) installed? Anyone here proficient with Salt?

      1 Reply Last reply Reply Quote 2
      • NerdyDadN
        NerdyDad
        last edited by

        Calling @scottalanmiller

        DashrenderD 1 Reply Last reply Reply Quote 0
        • DashrenderD
          Dashrender
          last edited by

          calling @scottalanmiller .

          1 Reply Last reply Reply Quote 0
          • DashrenderD
            Dashrender @NerdyDad
            last edited by

            @NerdyDad said in Saltstack Query:

            Calling @scottalanmiller

            LOL

            1 Reply Last reply Reply Quote 0
            • DustinB3403D
              DustinB3403
              last edited by

              Wouldn't this be salt '*' pkg.list_pkgs

              To show everything?

              So to specify you'd put the name in the single quotes?

              R 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403
                last edited by

                Actually it might be salt '*' pkg.list_pkgs pkgs='["foo"]'

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

                  Salt does not store the data about the clients in a database. If you want something like that, you have to build a database yourself and populate it with data pulled from SaltStack. SaltStack maintains, in state files, a list of how you want machines to be configured. It does not maintain a list of how they are configured. It's a tool that is meant to be combined with other things.

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

                    So to get this information, you would use SaltStack, as Dustin pointed out, to query each Minion and ask it if a package is installed or not. Then you'd use either your eyes to do it manually, or script something to process the resulting list. If you have twenty or even fifty machines, you might just look at the results. If you have hundreds or thousands, you likely want to process it. If you need to do this task all of the time, you might want to do something more.

                    1 Reply Last reply Reply Quote 0
                    • DustinB3403D
                      DustinB3403
                      last edited by

                      You could of course pipe the output of SaltStack into a csv and then just grab that CSV to do more filtering. But you need to get the data first.

                      1 Reply Last reply Reply Quote 0
                      • R
                        roninmage @DustinB3403
                        last edited by

                        @DustinB3403 Damn, I was trying too hard. I can use that and filter through grep. Thanks DustinB3403!

                        DustinB3403D 1 Reply Last reply Reply Quote 1
                        • DustinB3403D
                          DustinB3403 @roninmage
                          last edited by

                          @roninmage said in Saltstack Query:

                          @DustinB3403 Damn, I was trying too hard. I can use that and filter through grep. Thanks DustinB3403!

                          I believe if you supply the package name in place of foo that you wouldn't need to do any additional filtering.

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

                            @scottalanmiller That make more sense. So my saltmaster may be in control but it needs to pull specific information on configuration directly from the minions. That explains why I couldn't find the database. I appreciate the clarity.

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

                              @roninmage said in Saltstack Query:

                              @scottalanmiller That make more sense. So my saltmaster may be in control but it needs to pull specific information on configuration directly from the minions. That explains why I couldn't find the database. I appreciate the clarity.

                              Correct. No problem.

                              My team at SodiumSuite (currently unavailable as it is being re-written) does exactly this, making a SaltStack management system that contains that configuration data on the back end and uses SS as just part of the tooling for a more general management and monitoring solution - specifically because SaltStack lacks that visibility and monitoring on its own.

                              1 Reply Last reply Reply Quote 0
                              • R
                                roninmage @DustinB3403
                                last edited by roninmage

                                @DustinB3403 The problem is that this command pulls information on pkgs installed on the saltmaster. I would need to go to each of 200 machines and run it to get that machines software list unless there is a way to direct that command to a list of minions. Then I could produce a list of all minions and create a for loop to query each one and output results to a text file, or am I overthinking again?

                                scottalanmillerS 1 Reply Last reply Reply Quote 0
                                • DustinB3403D
                                  DustinB3403
                                  last edited by

                                  The '*' should target all of your minions by default. . .

                                  https://docs.saltstack.com/en/latest/topics/targeting/

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

                                    @roninmage said in Saltstack Query:

                                    @DustinB3403 The problem is that this command pulls information on pkgs installed on the saltmaster. I would need to go to each of 200 machines and run it to get that machines software list unless there is a way to direct that command to a list of minions. Then I could produce a list of all minions and create a for loop to query each one and output results to a text file, or am I overthinking again?

                                    Salt command run against the Minions. The master might be one of the minions, but also may not be.

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

                                      @scottalanmiller OK, I see what is happening; I have a very complete list of installed software but only a few of the minions. The last three minion names did not respond (probably turned off). Does the command abort after a certain number of failures?

                                      DustinB3403D scottalanmillerS 2 Replies Last reply Reply Quote 0
                                      • DashrenderD
                                        Dashrender
                                        last edited by

                                        Does the SaltMaster maintain a list of all the minions?

                                        scottalanmillerS 1 Reply Last reply Reply Quote 0
                                        • DustinB3403D
                                          DustinB3403 @roninmage
                                          last edited by

                                          @roninmage it shouldn't just abort, instead it tells every minion to report back.

                                          How many minions do you have?

                                          R 1 Reply Last reply Reply Quote 0
                                          • DustinB3403D
                                            DustinB3403
                                            last edited by

                                            @roninmage run this to list all minions

                                            salt-run manage.up

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