The how to use Salt centos 8 system is a Python-based, open-source remote execution framework for configuration management, automation, provisioning, and orchestration. Salt delivers a dynamic communication bus for infrastructure to leverage in:
- Remote execution.
- Configuration management.
- Automation and orchestration.
Salt supports the Infrastructure as Code approach to deployment and data center management.
Remote management Salt usage
Running commands on remote systems is the core function of Salt. Salt can execute multiple commands across thousands of systems in seconds with a single execution.
The Salt configuration management system is based on storing all configuration or “state” data inside an easily understood data structure. The concept behind the State system is:
- Simple – easy to administer and manage.
- Extensible – easy to add custom modules or extend existing states.
- Deterministic – executes, in the same way, every time.
- Layerable – provides layers of data abstraction (such as states calling execution modules).
Automation and orchestration Salt usage
Executing remote management and configuration on a system is perfect when you want to ensure that it is configured and running the way you want. Sometimes, however, you want to configure several systems at once. For example, if you’re going to set up a load balancer in front of a cluster of web servers, you can ensure the load balancer is set up first. You can then consistently apply the same matching configuration across the whole group, known as orchestration.
Salt Project repository configuration Salt usage
Salt Project provides a public repository for packages at the Salt Project Package Repo.
The preferred method for installing Salt is via distribution packages, which ensures that all dependencies are met and that Salt is installed in a tested and distribution-aligned way. Salt is often distributed in split packages, but only salt-master and salt-minion are required for Salt to function.
We will perform both the push and the pull mechanisms for applying states to minions
Check if the minion has got automatically signed by the master:
[root@master8 ~]# salt-key accepted Accepted Keys: master8.unixcop.com worker1.unixcop.com worker2.unixcop.com Denied Keys: Unaccepted Keys: Rejected Keys: [root@master8 ~]#
The communication between the master and the minion can be checked with a couple of commands:
[root@master8 ~]# salt '*' test.ping worker1.unixcop.com: True worker2.unixcop.com: True master8.unixcop.com: True
[root@master8 ~]# salt 'worker*' grains.items worker2.unixcop.com: ---------- biosreleasedate: 12/01/2006 biosversion: VirtualBox cpu_flags: - fpu - vme - de - pse - tsc - msr - pae - mce - cx8 - apic - sep - mtrr - pge - mca - cmov - pat ....................... - arch_capabilities cpu_model: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz cpuarch: x86_64 cwd: / disks: - sda dns: ---------- domain: ip4_nameservers: - 10.0.2.3 ip6_nameservers: nameservers: - 10.0.2.3 options: search: - unixcop.com sortlist: domain: unixcop.com efi: False efi-secure-boot: False environment: development fqdn: worker28.unixcop.com fqdn_ip4: - 192.168.56.203
Applying states using the push mechanism from master to minion
States can be applied from master to minion as follows:
[root@master8 ~]# salt 'salt-minion' state.sls user \ saltenv=development salt-minion: ---------- ID: generic_user Function: user.present Function: user.present Name: neil Result: True Comment: New user neil created Changes: ---------- fullname: gid: 1001 groups: - neil home: /home/neil homephone: name: neil passwd: x password: $1$PG1inys0$kB2I83KzEVzVs9G7xLHjA1 roomnumber: shell: /bin/bash uid: 1001 workphone: Summary ------------ Succeeded: 1 Failed: 0 ------------ Total: 1
So, you know how to use Salt on Centos