万本电子书0元读

万本电子书0元读

顶部广告

Extending SaltStack电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Joseph Hall

出  版  社:Packt Publishing

出版时间:2016-03-22

字       数:172.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Extend the power of your infrastructure and applications with Salt modules About This Book Get the most up-to-date practical resource on writing new Salt modules and extending Salt Learn through use cases and encounter both commonly-used modules as well as advanced ones Effectively troubleshoot problems and hiccups encountered while building and putting modules to work Who This Book Is For This book is for both new and existing Salt developers who are looking to build and write new Salt modules. Some prior Python development experience is expected. What You Will Learn Understand the working of Salt's Loader system Write several of the most common types of Salt modules Interact between different kinds of modules and build new ones Submit open source modules upstream to the Salt project Make Salt interact with third-party services and applications In Detail Salt already ships with a very powerful set of tools, but that doesn't mean that they all suit your needs perfectly. By adding your own modules and enhancing existing ones, you can bring the functionality that you need to increase your productivity. Extending SaltStack follows a tutorial-based approach to explain different types of modules, from fundamentals to complete and full-functioning modules. Starting with the Loader system that drives Salt, this book will guide you through the most common types of modules. First you will learn how to write execution modules. Then you will extend the configuration using the grain, pillar, and SDB modules. Next up will be state modules and then the renderers that can be used with them. This will be followed with returner and output modules, which increase your options to manage return data. After that, there will be modules for external file servers, clouds, beacons, and finally external authentication and wheel modules to manage the master. With this guide in hand, you will be prepared to create, troubleshoot, and manage the most common types of Salt modules and take your infrastructure to new heights! Style and approach This book follows a step-by-step tutorial-based approach explaining the different types of modules, from fundamentals to complete and full-functioning modules.
目录展开

Extending SaltStack

Table of Contents

Extending SaltStack

Credits

Foreword

About the Author

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. Starting with the Basics

Using plugins

Loading modules

Standard modules

Virtual modules

Lazy loading modules

Extending the loader system

Loading modules with Python

Detecting grains

Using other detection methods

Summary

2. Writing Execution Modules

Writing Salt modules

Hidden objects

The __virtual__() function

Formatting your code

Virtual modules

Using the salt.utils library

Cross-calling with the __salt__ dictionary

Getting configuration parameters

Handling imports

Reusing code

Logging messages

Using the __func_alias__ dictionary

Validating data

Formatting strings

The final module

Troubleshooting execution modules

Using salt-call

<function> is not available

Summary

3. Extending Salt Configuration

Setting grains dynamically

Setting some basic grains

(Not) cross-calling execution modules

The final grains module

Creating external pillars

Configuring external pillars

Adding an external pillar

Another external pillar

Troubleshooting grains and pillars

Dynamic grains not showing up

External pillars not showing up

Writing SDB modules

Getting SDB data

Setting SDB data

Using a descriptive docstring

Using more complex configuration

The final SDB module

Using SDB modules

Troubleshooting SDB modules

SDB data not showing up

Summary

4. Wrapping States Around Execution Modules

Forming a state module

Determining state

The __virtual__() function

Setting up defaults

Checking for truth

Checking for test mode

Attempting to configure the resource

Notifying about False

Example: checking an HTTP service

Checking credentials

The first stateful function

Another stateful function

Troubleshooting state modules

Step 1: test for truth

Step 2: test mode

Step 3: applying changes

Testing opposites

Summary

5. Rendering Data

Understanding file formats

Serializing data

Working with templates

Using render pipes

Building a serializing renderer

The basic structure

Building a templating renderer

Templating with Tenjin

Using a templating renderer

Troubleshooting renderers

Summary

6. Handling Return Data

Returning data to external destinations

Returning data to the master

Listening to event data

When returners listen to Minions

Your first returner

Using job caches

The final module

Troubleshooting returners

Testing with salt-call

Testing with the Master running

Testing with runners

Writing outputter modules

Pickling our output

Troubleshooting outputters

Summary

7. Scripting with Runners

Using Salt's local client

Scripting with the local client

Using different targets

Combining jobs to add more logic

The final module

Troubleshooting runners

Working with the salt-master service

Timeout issues

Summary

8. Adding External File Servers

How Salt uses files

Mimicking a filesystem

Looking at each function

Setting up our module

envs()

file_list() and dir_list()

find_file()

serve_file()

update()

file_hash()

The final module

Troubleshooting file servers

Start small

Test on a Minion

Summary

9. Connecting to the Cloud

Understanding cloud components

Looking at the puzzle pieces

Connection mechanism

Listing resources

Creating virtual machines

Managing other resources

Libcloud versus SDK versus direct REST API

Writing a generic cloud module

Checking for required configuration

Using http.query()

A common REST API

GET

POST

PATCH

DELETE

Setting up a _query() function

Getting profile details

Listing images

Listing sizes

Listing locations

Listing nodes

Querying standard node data

Querying full node data

Creating a VM

Destroying VMs

Using actions and functions

Using actions

Using functions

The final cloud module

Troubleshooting cloud modules

Write avail_sizes() or avail_images() first

Use shortcuts

Summary

10. Monitoring with Beacons

Watching for data

Keeping an eye on things

Validating configuration

The beacon() function

Watching for beacons

The final beacon module

Troubleshooting beacons

Summary

11. Extending the Master

Using external authentication

Authenticating credentials

Troubleshooting external authentication

Setting auth parameters

Testing with the salt command

Testing with Salt API

Managing the Master with the wheel modules

Wrapping a wheel around runners

The final wheel module

Troubleshooting wheel modules

Summary

A. Connecting Different Modules

Separating Master and Minion functionality

Working with dunders

Using the event bus

Firing events

B. Contributing Code Upstream

How the community works

Asking questions and reporting issues

Using the mailing list

Using IRC

Using the issue tracker

Using GitHub markdown

Understanding the Salt Style Guide

Using Pylint

Creating pull requests on GitHub

Using other branches

Understanding test errors in pull requests

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部