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

    Applying Salt States

    IT Discussion
    saltstack
    3
    8
    886
    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.
    • ObsolesceO
      Obsolesce
      last edited by Obsolesce

      I'm wondering how everyone keeps their minion states applied.

      Do you do a manual highstate on the master whenever you feel like it? Do you do it on a schedule via cron, like hourly?

      Do you do it via a cron job on the minions?

      Do you have the minions config file set to do it when salt-minion service starts?

      At reboot?

      How are you keeping your minions in their desired state according to your top.sls file, how often, why/why not?

      Emad RE 1 Reply Last reply Reply Quote 0
      • Emad RE
        Emad R @Obsolesce
        last edited by

        @tim_g

        I didn't reach this advanced topics in saltstack, but what I think I would do is create state that would chain other states perhaps, and schedule at a time where the minion is not being used like midnight

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

          We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.

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

            @emad-r said in Applying Salt States:

            @tim_g

            I didn't reach this advanced topics in saltstack, but what I think I would do is create state that would chain other states perhaps, and schedule at a time where the minion is not being used like midnight

            If you do it that infrequently, it loses the "fix it" ability that is a key value to state systems. The idea of doing it every few minutes is that the machine is verifying its own state constantly to look for something breaking, changing or whatever.

            1 Reply Last reply Reply Quote 0
            • ObsolesceO
              Obsolesce @scottalanmiller
              last edited by

              @scottalanmiller said in Applying Salt States:

              We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.

              Do you corn a Highstate on the Master every 20 minutes, or are all the minions croned to do it then?

              I was thinking about croning a Highstate on the Master every 15 minutes. And if I notice too much load I'll do your idea and up it to 20 and see how that feels.

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • ObsolesceO
                Obsolesce
                last edited by Obsolesce

                I'm testing the following:

                I created a saltmaster state. In there, is a section that includes the following:

                /etc/cron.d/salt-highstate:
                  file.managed:
                    - source: salt://saltmaster/files/salt-highstate
                    - user: root
                    - group: root
                    - mode: 644
                

                And the salt-highstate file:

                */15 * * * * root /usr/bin/salt -b 25\% '*' state.apply
                
                

                I'm using the -b 25% so that all minions don't get changes all at once. It doesn't matter if they do at this point, because I don't have a farm of webservers that will all restart the web service at the same time... I'm just practicing the concept.

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

                  @tim_g said in Applying Salt States:

                  @scottalanmiller said in Applying Salt States:

                  We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.

                  Do you corn a Highstate on the Master every 20 minutes, or are all the minions croned to do it then?

                  I was thinking about croning a Highstate on the Master every 15 minutes. And if I notice too much load I'll do your idea and up it to 20 and see how that feels.

                  We do it on the master.

                  1 Reply Last reply Reply Quote 0
                  • ObsolesceO
                    Obsolesce
                    last edited by Obsolesce

                    I just noticed I had a typo in the salt-highstate part above. Fixed now. I left out the '*', which specifies all minions.

                    Also, a \ is needed before the % symbol to escape it.

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