CentOS installation and configuration Salt API

Source: Internet
Author: User

Installation

# yum-y Install Salt-api

Change Configuration

Vim/etc/salt/master

Drop the default comment on our side. The default profile directory is/srv/salt

DEFAULT_INCLUDE:MASTER.D/*. conf

Create a Directory

#cd/etc/salt
# mkdir Master.d/
# CD Master.d/

Create two files and add a configuration

# cat api.conf rest_cherrypy:   0.0. 0.0    8080truetrue  # cat eauch.conf   External_auth:  Pam:    saltapi:      -. *      '@wheel'      ' @runner '

Create user

123123 | passwd--stdin Saltapi

Restart Salt-api

#/etc/init.d/salt-API restartstopping Salt-API daemon:                                  [failed]starting salt-api daemon:                                  [  OK  ]
#/etc/init.d/salt-Master restartstopping Salt-Master daemon:                               [failed]starting Salt-master Daemon:                               [  OK  ]

Then test whether the installation was successful

# curl-k Http://10.20.0.100:8080/login-H "Accept:application/x-yaml"-D username= ' Saltapi '-D password= ' 123123 '  - D eauth= ' Pam ' return:-eauth:pam  expire:1474258659.0838921  perms:  -. *  -' @wheel '  -' @runner '  start:1474215459.0838921  token:69bb58e4b6bb2026369a40fc40184a88e7472054  User:saltapi

After returning the token value, the token value can be used directly after the call.

Let's try the Cmd.run module.

# Curl-k http://10.20.0.100:8080-h "Accept:application/x-yaml"-H "x-auth-token:69bb58e4b6bb2026369a40fc40184a88e7472054"-D client= ' Local '-D tgt= ' * '-D fun= ' Cmd.run '-D arg= ' free-m 'return:-salt-minion- on:'Total used free shared buffers cachedMem:980        913          the          0          -        184-/+ Buffers/cache:672        307Swap:1983          -       1963'salt-minion- Geneva:'Total used free shared buffers cachedMem:980        914          $          0          -        169-/+ Buffers/cache:696        284Swap:1983          -       1913'

Test success can return information

CentOS installation and configuration Salt API

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.