SaltStack Interview Questions And Answers

SaltStack Interview Questions And Answers latest for experienced professionals from Coding Compiler. These SaltStack interview questions were asked in various interviews conducted by top multinational companies across the globe. We hope that these interview questions on SaltStack will help you in cracking your job interview. All the best and happy learning

In this Interview Questions Blog, You’ll learn

  1. SaltStack Interview Questions
  2. SaltStack Interview Questions and Answers
  3. Best Salt Stack Interview Questions and Answers
  4. Frequently Asked SaltStack Interview Questions and Answers

SaltStack Interview Questions

  1. What is SaltStack?
  2. Can SaltStack support the backing up of managed files?
  3. State the finest way to restart a salt minion with Salt after the upgrade.
  4. Is Salt Open-core?
  5. What Ports Should I Open On My Firewall?
  6. If you find a bug in Salt, then what would you do?
  7. Does Salt Support Backing Up Managed Files?
  8. Which messaging library is used by SaltStack to process high-speed requirements for all networking layers?
  9. Can Salt Minion get restarted with the help of using States?
  10. Can you do the Minion upgrade without automatically restarting?

SaltStack Interview Questions and Answers


Q1. What is SaltStack?

Answer: SaltStack is a high speed remote execution and configuration system which uses zeromq. Saltstack is also been written with the developer in mind, Saltstack can be very easily extended with modules and can act as a standalone remote execution system or act as a simple to use message passing and managing broker with authentication and encryption built in. the remote execution capabilities allow administrators to run commands on various machines in parallel with a flexible targeting system. The configuration management functionality establishes a client-server model to quickly,easily and securely bring infrastructure components in line with a given policy.

Q2. Can SaltStack support the backing up of managed files?

Answer: Yes, SaltStack can support backing up managed files.

Q3. State the finest way to restart a salt minion with Salt after the upgrade.

Answer:

The best way to proceed with the updating of salt minion package is mentioned here. Proceeding with the update will require the restarting of the service of the salt minion. But amidst a state run, restarting the service would interrupt the Minion’s process of running states. It would also return the results to the master. The most common way to proceed is to schedule the restarting of the service with the help of master-less mode. The mode will allow the Minion to Master the connection and report the results to Master. The service will be restarting in the background.

Q4. Is Salt Open-core?

Answer :

No. Salt is 100% committed to being open-source, including all of our APIs. It is developed under the Apache 2.0 license, allowing it to be used in both open and proprietary projects.

To expand on this a little:

There is much argument over the actual definition of “open core”. From our standpoint, Salt is open source because

  • It is a standalone product that anyone is free to use.
  • It is developed in the open with contributions accepted from the community for the good of the project.
  • There are no features of Salt itself that are restricted to separate proprietary products distributed by SaltStack, Inc.
  • Because of our Apache 2.0 license, Salt can be used as the foundation for a project or even a proprietary tool.
  • Our APIs are open and documented (any lack of documentation is an oversight as opposed to an intentional decision by SaltStack the company) and available for use by anyone.

SaltStack the company does make proprietary products which use Salt and its libraries, like company is free to do, but we do so via the APIs, NOT by forking Salt and creating a different, closed-source version of it for paying customers.

Q5. What Ports Should I Open On My Firewall?

Answer :

Minions need to be able to connect to the Master on TCP ports 4505 and 4506. Minions do not need any inbound ports open.

Q6. If you find a bug in Salt, then what would you do?

Answer: 

Both the mailing list of the salt users and the IRC channel of salt are helpful resources. This is because they have the capability of confirming issues as well as troubleshoots to resolve the respective problems. When you find a bug in Salt, you would have to follow the particular instructions and report the bug.

Q7. Does Salt Support Backing Up Managed Files?

Answer :

Yes. Salt provides an easy to use addition to your file.managed states that allow you to back up files via backup_mode, backup_mode can be configured on a per state basis, or in the minion config (note that if set in the minion config this would simply be the default method to use, you still need to specify that the file should be backed up!).

Q8. Which messaging library is used by SaltStack to process high-speed requirements for all networking layers ?

Answer: ZeroMQ messaging library

Q9. Can Salt Minion get restarted with the help of using States?


Answer: 

The answer to this question is simple. Yes, you can definitely restart the Salt Minion with the help of States.

Q10. Can you do the Minion upgrade without automatically restarting?

Answer:

Yes, you can do the Minion upgrade without automatically restarting. But it requires a step-by-step procedure.

Best Salt Stack Interview Questions and Answers

Q11. Explain any two advantages of SaltStack.

Answer : There are multiple beneficial advantages of using this open-source software. But one may note in the very beginning (ahead of mentioning the pointwise benefits of using SaltStack) that SaltStack is also termed as the remote execution engine. Now you can check the below-mentioned point-wise information that shed lights on the pros and cons of using SaltStack.

Pros –

1. These are the two pros (or the advantages) of using SaltStack as mentioned below:

2. Not only is it modular, but also happens to be event-driven software which ensures that all the IT components are capable of maintaining the target state under the control of the software.

3. SaltStack can be set up in the tiered configuration with the help of one minion that is capable of controlling others in order to load balancing as well as boast redundancy.

Q12. On the Firewall option, what port you are you supposed to open?

Answer : The Minions are to be connected to Master on TCP ports 4506 as well as 4505. They don’t actually need any inbound port open.

Q13. Why the value for the Grain changed itself?


Answer : The reason why the value for the grain changed itself is that of some reasons. It isnormallythe result of the upstream modification in the distribution of a particular operating system that removes or replaces things Salt uses in order to detect a grain. When it occurs, it is fortunate. Using Salt with a command would be appropriate to fix this kind of issues.

Q14 :  Can Salt determine the Minion’s ID?

Answer : The answer to this particular question is yes. Salt can definitely determine the ID of the Minion.

Q15. Can SaltStack support the backing up of managed files?

Answer : Yes, SaltStack can support backing up managed files.

Q16 : Restart Using Remote Executions?

Answer : Restart the Minion from the command line:

salt -G kernel:Windows cmd.run_bg ‘C:saltsalt-call.bat –local service.restart salt-minion’

salt -C ‘not G@kernel:Windows’ cmd.run_bg ‘salt-call –local service.restart salt-minion’

Q17.  Mention Few features of Salt ?

Answers:
Fault tolerance : Salt minions can connect to many master at one time and any master can direct commands.

Scalable : Per master 10 thousands minions can be handled.

Parallel Execution model : Master can execute commands to remote machine parallely.

Language Agnostic : Salt state configuration files, templating engine or file type supports any type of language.

Flexible : Management approach of Salt is very flexible.

Q18. Can you term SaltStack as open-core?

Answer : The answer to the aforementioned question is, no. You cannot term SaltStack as open-core. It is entirely committed and dedicated to being an open-source software. The software has been developed under the license of Apache 2.0.  Hence it is allowed to be used in both proprietaries as well as open projects.

Q19. Why the value for the Grain changed itself?

Answer : The reason why the value for the grain changed itself is that of some reasons. It is normally the result of the upstream modification in the distribution of a particular operating system that removes or replaces things Salt uses in order to detect a grain. When it occurs, it is fortunate. Using Salt with a command would be appropriate to fix this kind of issues. Check out the commands right below.

salt -G ‘grain:Changed’Value’ grains.setvals ‘”’{‘grain’:: ‘OldValue’}

[Note: Replace the andgrain >Changed_Value>ithOld_Value a grain as well as values you need to make a change. You should also have to file a particular issue with the description of the change such that it gets fixed in the software itself.]

Frequently Asked SaltStack Interview Questions and Answers

Q20. Is It Possible To Deploy A File To A Specific Minion, Without Other Minions Having Access To It?

Answer :

The Salt fileserver does not yet support access control, but it is still possible to do this. As of Salt 2015.5.0, thefile_tree external pillar is available, and allows the contents of a file to be loaded as Pillar data. This external pillar is capable of assigning Pillar values both to individual minions, and to nodegroups. See the documentation for details on how to set this up.

Once the external pillar has been set up, the data can be pushed to a minion via a file.managed state, using thecontents_pillar argument:

/etc/my_super_secret_file:
  file.managed:
    – user: secret
    – group: secret
    – mode: 600
    – contents_pillar: secret_files:my_super_secret_file

In this example, the source file would be located in a directory called secret_files underneath the file_tree path for the minion. The syntax for specifying the pillar variable is the same one used for pillar.get, with a colon representing a nested dictionary.

Q21. How will you be able to restart the Salt Minion with the help of States?

Answer : The procedure of restarting the Salt Minion is simple. By using States, it can be carried forward effectively. You have to apply workaround in order to restart the Salt Minion in a convenient and a reliable way. Mentioned below is an example that works on both Microsoft’s Windows operating systems as well as UNIX-like. Check out the command below.

Restarting Salt Minion –

cmd.run:
{%- else %}
– name: ‘salt-call -local service/restart salt.minion’
{%- if grains-[‘kernel’]=== Windows %}
– name: ‘C:salt:salt-call.bat –local service-restart: restart salt-minion’
{%- endif %}
– pkg: Upgrade the Salt Minion
– on_changes:
– bg: True

Q22. What is the other alternative to restart Salt Minion with States?

Answer: 

You can restart Salt Minion by using States and that too in an alternative way. Mentioned below are the commands that you need to follow accordingly. Note that it is more advanced to upgrade Salt’s legacy version.

The alternative way to restart Salt Minion –

cmd.run::
{%- if grains[‘’kernel’’] == ‘Windows’’%}
– name: ‘start powershell ‘Restart-Service -Name salt-minion’’
{%- else %}
– name: |-
:exec 0>&- # close stdout
:exec 1>&- # close stdin
:exec 2>&- # close stderrr
:nohup salt-caall –local service.rstart salt-minion &
{{%- – endif%}}

Q23. Why aren’t my Custom Modules/states/etc. Available on my Minions?

Answers : Custom modules are synced to Minions when saltutil.sync_modules, or saltutil.sync_all is run. Custom modules are also synced by state.apply when run without any arguments.

Similarly, custom states are synced to Minions when state.apply, saltutil.sync_states, or saltutil.sync_all is run.

Custom states are also synced by state.apply when run without any arguments.

Other custom types (renderers, outputters, etc.) have similar behavior, see the documentation for the saltutilmodule for more information.

This reactor example can be used to automatically sync custom types when the minion connects to the master, to help with this chicken-and-egg issue.

Q24. Explain any two disadvantages of using SaltStack.

Answer:

These are the two cons (or the disadvantages) of using SaltStack as mentioned below:

1. Salt uses and is written in Python. Talking about Python, it is installed in almost all the Linux systems.

2. SaltStack doesn’t come with feature-rich GUI. Therefore, users accomplish their task with the help of the command-line tool accordingly.

Q25. Suppose your script is running each time you use the state.apply. What would you do?

Answer:

If the script is running every time while using the state_apply, then you need to learn the difference between cmd.wait and cmd.run. The aforementioned problem only occurs when you use the cmd.run instead of implementing the cmd.wait. [Quick Note: The cmd.run will run properly only when a change occurs in the watching state. On the contrary, the cmd.run will run the corresponding command each and every time.]

Q26. What Is The Best Way To Restart A Salt Minion Daemon Using Salt After Upgrade?

Answer :

Updating the salt-minion package requires a restart of the salt-minion service. But restarting the service while in the middle of a state run interrupts the process of the Minion running states and sending results back to the Master. A common way to workaround that is to schedule restarting of the Minion service using masterless mode after all other states have been applied. This allows the minion to keep Minion to Master connection alive for the Minion to report the final results to the Master, while the service is restarting in the background.

Q27. Upgrade Without Automatic Restart?

Answer :

Doing the Minion upgrade seems to be a simplest state in your SLS file at first. But the operating systems such as Debian GNU/Linux, Ubuntu and their derivatives start the service after the package installation by default. To prevent this, we need to create policy layer which will prevent the Minion service to restart right after the upgrade:

{%- if grains[‘os_family’] == ‘Debian’ %}
Disable starting services:
  file.managed:
    – name: /usr/sbin/policy-rc.d
    – user: root
    – group: root
    – mode: 0755
    – contents:
      – ‘#!/bin/sh’
      – exit 101
    # do not touch if already exists
    – replace: False
    – prereq:
      – pkg: Upgrade Salt Minion
{%- endif %}
Upgrade Salt Minion:
  pkg.installed:
    – name: salt-minion
    – version: 2016.11.3{% if grains[‘os_family’] == ‘Debian’ %}+ds-1{% endif %}
    – order: last
Enable Salt Minion:
  service.enabled:
    – name: salt-minion
    – require:
      – pkg: Upgrade Salt Minion
{%- if grains[‘os_family’] == ‘Debian’ %}
Enable starting services:
  file.absent:
    – name: /usr/sbin/policy-rc.d
    – onchanges:
      – pkg: Upgrade Salt Minion
{%- endif %}

Q28. Why Did The Value For A Grain Change On Its Own?

Answer :

This is usually the result of an upstream change in an OS distribution that replaces or removes something that Salt was using to detect the grain. Fortunately, when this occurs,

you can use Salt to fix it with a command similar to the following:

salt -G ‘grain:ChangedValue’ grains.setvals “{‘grain’: ‘OldValue’}”

(Replacing grain, ChangedValue, and OldValue with the grain and values that you want to change / set.)

You should also file an issue describing the change so it can be fixed in Salt.

Q29.   I’m Trying To Manage Packages/services But I Get An Error Saying That The State Is Not Available. Why?

Answer :

Salt detects the Minion’s operating system and assigns the correct package or service management module based on what is detected. However, for certain custom spins and OS derivatives this detection fails. In cases like this, an issue should be opened on our tracker, with the following information:

The output of the following command:

salt <minion_id> grains.items | grep os

The contents of /etc/lsb-release, if present on the Minion.

Q30. Restart Using States?

Answer: 

Now we can apply the workaround to restart the Minion in reliable way. The following example works on both UNIX-like and Windows operating systems:

Restart Salt Minion:

  cmd.run:
{%- if grains[‘kernel’] == ‘Windows’ %}
    – name: ‘C:saltsalt-call.bat –local service.restart salt-minion’
{%- else %}
    – name: ‘salt-call –local service.restart salt-minion’
{%- endif %}
    – bg: True
    – onchanges:
      – pkg: Upgrade Salt Minion

However, it requires more advanced tricks to upgrade from legacy version of Salt (before 2016.3.0), where executing commands in the background is not supported:

Restart Salt Minion:

  cmd.run:
{%- if grains[‘kernel’] == ‘Windows’ %}
    – name: ‘start powershell “Restart-Service -Name salt-minion”‘
{%- else %}
    # fork and disown the process
    – name: |-
        exec 0>&- # close stdin
        exec 1>&- # close stdout
        exec 2>&- # close stderr
       nohup salt-call –local service.restart salt-minion &
{%- endif %}

Related Interview Questions

  1. Core Java Interview Questions
  2. JSF Interview Questions
  3. JSP Interview Questions
  4. JPA Interview Questions
  5. Spring Framework Interview Questions
  6. Spring Boot Interview Questions
  7. Core Java Multiple Choice Questions
  8. 60 Java MCQ Questions And Answers
  9. Aricent Java Interview Questions
  10. Accenture Java Interview Questions
  11. Advanced Java Interview Questions For 5 8 10 Years Experienced
  12. Core Java Interview Questions For Experienced
  13. GIT Interview Questions And Answers
  14. Network Security Interview Questions
  15. CheckPoint Interview Questions
  16. Page Object Model Interview Questions
  17. Apache Pig Interview Questions
  18. Python Interview Questions And Answers
  19. Peoplesoft Integration Broker Interview Questions
  20. PeopleSoft Application Engine Interview Questions

Leave a Comment