SaltStack Interview Questions and Answers

Q1 :  Explain any two advantages of SaltStack.
A : 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.

Q2 : On the Firewall option, what port you are you supposed to open?
A : 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.

Q3 : If you find a bug in Salt, then what would you do?
A : 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.

Q4 : Why is SaltStack termed as the open-source software?
A : 1. From a standpoint of a student, Salt (or also known as SaltStack) is termed as an open-source software due to many reasons. Mentioned below are few of them which are given in a point-wise manner.
2. First and foremost, Salt or SaltStack is a standalone product which is available for customers as a free to use product.
3. Secondly, SaltStack has been developed with the contributions that are accepted from the particular community for the project’s growth.
4. The third most vital point is, Salt doesn’t have any of its own features which are responsible for restricting separate products proprietary.
5. Fourthly, due to the license of Apache 2.0, the software is able to be used as the foundation for a proprietary tool or even for a project.
6. Finally, the APIs of the software are not just documented but even open. These have been availed for everyone’s usage.

Q5 : Why the value for the Grain changed itself?
A : 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.

Q6 :  Can Salt determine the Minion’s ID?
A : The answer to this particular question is yes. Salt can definitely determine the ID of the Minion

 Q7 : Salting the Salt Master?
A : In order to configure a master server via states, the Salt master can also be “salted” in order to enforce state on the Salt master as well as the Salt minions. Salting the Salt master requires a Salt minion to be installed on the same machine as the Salt master. Once the Salt minion is installed, the minion configuration file must be pointed to the local Salt master:
master: 127.0.0.1
Once the Salt master has been “salted” with a Salt minion, it can be targeted just like any other minion. If the minion on the salted master is running, the minion can be targeted via any usual salt command. Additionally, the salt-call command can execute operations to enforce state on the salted master without requiring the minion to be running.

Q8 : Can SaltStack support the backing up of managed files?
A : Yes, SaltStack can support backing up managed files.

Q9 : Restart Using Remote Executions?
A : 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’

Q10 : How will you deploy a file to a minion with the accession of other minions?
A : Although SaltStack doesn’t support the access control, there are tricks by which you can possibly do so. With the help of Salt 2015.5.0, thefile_tree external pillar, you can proceed. The Salt 2015.5.0 version gives the allowance to file contents to load as Pillar data. One of the examples has been mentioned below by which you can definitely deploy a file to a specific minion without the interruption of other minions. Check out the command right below.

/etc/my__super/secret_file::
file.managed::
– mode:: 600
– group:: secret
– user:: secret
– contents__pillar::secret__files::my__super__secret__file

Q11 : State the finest way to restart a salt minion with Salt after the upgrade.
A : 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.

Q12 : Can you term SaltStack as open-core?
A : 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.

Q13 : What is the best way to restart a Salt Minion Daemon using Salt after upgrade?
A : 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 work around 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.

Q14 : How will you be able to restart the Salt Minion with the help of States?
A : 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

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

Q16 : Does Salt support backing up Managed Files?
A : 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!).

Q17 : How will the Salt Minion get restarted with the help of Remote Executions?
A : You will have to follow the below provided commands in order to restart the Minion by using Remote Executions.
salt– C 'not G@ekenel:Windowscmd.run-bg –call/restart the sal tminion
salt– G kenel-Windows cmd–run.bg 'C:saltsalt.bat --local-restart salt-minion'

Q18 : Why the value for the Grain changed itself?
A : 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.]

Q19 : Suppose your script is running each time you use the state.apply. What would you do?
A : If the script is running every time while using the state_apply, then you need to learn the difference between andcmd.waitcmd.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.]

Q20 : Why aren’t my Custom Modules/states/etc. Available on my Minions?
A : 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.