Blog

SaltStack Interview Questions

  • (4.0)
  • | 377 Ratings

Last Updated: June 13, 2018

If you're looking for SaltStack Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research, Saltstack has a market share of about 1.6%. So, You still have opportunity to move ahead in your career in SaltStack. Mindmajix offers Advanced SaltStack Interview Questions 2018 that helps you in cracking your interview & acquire dream career as SaltStack Engineer.

Enroll now for the ultimate SaltStack Training from Mindmajix.

Q1) How will you deploy a file to a minion with the accession of other minions?

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

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

Yes, SaltStack can support backing up managed files.

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

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

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.

Q5) Why are the custom modules/ states/etc unavailable on the Minions?

Custom modules are usually synced to the Minions while the saltutil.sync_modules or the saltutil.sync_allcommand is run. The custom modules are even synced with the state.apply while there’s no command or arguments. Hence, custom states get synced to the Minions while the saltutil.sync_states,state.apply, or saltutil.syncis run.

Q6) On the Firewall option, what port you are you supposed to open?

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.

Q7) Suppose you are getting error when trying to Manage Packages/services. What will you do?

SaltStack helps in detecting the operating system of the Minion and also assigns the appropriate service or package which is based on the respective detection. Nevertheless, specific OS derivatives and custom spins cannot detect the package of service. In case you are getting the aforementioned error, then you need to open an issue on the respective tracker with the help of the following commands:

saltgrains.items| grepos

The respective contents of the /etc/lsb-release, if it has been presented on Minion.

Q8) Why is SaltStack termed as the open-source software?

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.

Q9) Can you term SaltStack as open-core?

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 proprietary as well as open projects.

Q10) Explain any two advantages of SaltStack.

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.

Q11) Can Salt determine the Minion’s ID?

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

Q12) How does Salt determine the ID of the Minion?

The process is very simple and seamless. By the help of the hostname, Salt will be able to determine the ID of the minion.

Checkout SaltStack Tutorials

Q13) How to avail Module X when Shell Command is installed?

Apparently, it is a PATH problem. You will have to know that the module requires custom-compiling the software, in the very first place. If you haven’t gone through it, then you would have to do it immediately.

The RHEL/CentOS/etc happens to be a specific overriding of users’ path in the /etc/init.d file that sets to /sbin:/usr/sbin:/usr/bin. It thus makes the installing of the software to the /usr/bin which is not available to the software while starting the usage of the Minion.The 2014.1.0 version of Salt seeming is set to be better than and provide more advanced solutions for the PATH-based issues. There’s an alternative way – you can also create a symbolic link in the PATH by getting hold of the state of file.symlink.

1 –/usr/bin/foo:
2 – file.symlink:
3 –target: /usr_local/bin/foo

Q14) Can you do the Minion upgrade without automatically restarting?

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

Q15) How can you proceed with the Minion upgrade without restarting automatically?

The answer is yes, you can carry forward the Minion upgrade. It appears to be an easy process in SLS file in the first place. However, the operating systems (OS) like the Ubuntu or the Debian GNU or Linux along with their respective derivatives proceed with the service right after the installation of the package gets completed by default. Preventing this would be easy, only this is that you have to create the policy layer. It will help in preventing services of the Minion to restart after the upgrade is completed. Mentioned below is the command that you need to perform.

{%- if grains[family] == 'Debian' %}

Disable the starting services –

file.managed:
- name/usrsbin/policy-rc.d
- group: / root
- user: root
- mode/0755
-- '#!/bin/sh'
-- exit 101
- contents:

# if already exists, then do not touch

- prereq:
- replace: False
  {%- endif %}
 - pkg: Upgrade the Salt Minion

Upgrade the Salt Minion –

pkg.installed –
- version: 2016.11.3{% if grains['os_family'] 'Debian'}ds-1{% endif %}
  --name: salt-minion
- order: the last

Enable the Salt Minion –

- name: salt-minion
service.enabled:
  - pkg –Upgrade the Salt Minion
s  - require:
{%- if grains['os_family'] - 'Debian' %}

Enable the starting services:

- name: /usr/sbin/policy-_rc.d
file.absent:
  - pkg-Upgradethe Salt Minion
 - onchanges:
{%- endif %}

In this way, proceeding with the Minion upgrade would be seamless.

Q16) Can you restart the Salt Minion by using Remote Executions?

The answer is yes, you can definitely restart the Salt Minion by using the Remote Executions.

Q17) How will the Salt Minion get restarted with the help of Remote Executions?

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) Can Salt Minion get restarted with the help of using States?

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

Q19) How will you be able to restart the Salt Minion with the help of States?

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

Q20) What is the other alternative to restart Salt Minion with States?

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%}}

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

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.]

Explore SaltStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Q22) Why the value for the Grain changed itself?

The reason why the value for the grain changed itself is because 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 grain >Changed_Value> and Old_Value with 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.]

Q23) Explain any two disadvantages of using SaltStack.

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.