Learning CFEngine 3

Book description

Get up to speed on CFEngine 3, the open source configuration management software that enables you to automate everything from one-server shops to enterprise computer networks. This hands-on introduction shows you how to use CFEngine 3 to implement and manage and your IT infrastructure in a sustainable, scalable, and efficient manner.

Through numerous examples, you’ll learn how to use CFEngine to perform tasks such as user management, software installation, and security. You’ll also learn how to focus on higher-level issues of design, implementation and maintenance, knowing that CFEngine is handling the lower-level details for you automatically.

  • Discover how far you can go with system automation, using CFEngine
  • Become familiar with the software’s principles, components, and policy structure
  • Configure CFEngine step-by-step to perform routine tasks on your system
  • Specify custom machine configuration without making changes by hand
  • Get tricks and patterns that you can use in your own CFEngine policies
  • Maintain separate CFEngine environments for development, testing, production, or other uses

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
  2. Preface
    1. Who Is This Book For?
    2. Overview of the Book
    3. Online Resources
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Content Updates
      1. September 2013 (third release)
      2. November 2012 (second release)
    9. Acknowledgments
  3. 1. Introduction
    1. How to Achieve Automation
      1. Home-Grown Scripts
      2. Specialized Tools for Automation
    2. Why CFEngine?
    3. A Brief History of CFEngine
    4. Versions of CFEngine
  4. 2. Getting Started with CFEngine
    1. Installing CFEngine
      1. Which Version of CFEngine?
      2. Installing the Community Edition from Source
        1. Compiling on Linux
        2. Compiling on Mac OS X
        3. Compiling on Windows with cygwin
      3. Installing the Community Edition from Binary Packages
      4. Installing the Commercial Edition
    2. Finishing the Installation and Bootstrapping
    3. Auxiliary Files
    4. Your First CFEngine Policy
      1. Integrating Your New Policy Into Periodic CFEngine Execution
  5. 3. CFEngine Basics
    1. Basic Principles
      1. Desired-State Configuration
      2. Basic CFEngine Operations
      3. Promise Theory
      4. Convergent Configuration
    2. CFEngine Components
    3. A First Example
    4. CFEngine Policy Structure
      1. Data Types and Variables in CFEngine
        1. Variable declarations
        2. Strings
        3. Numbers
        4. Lists
        5. Arrays
      2. Classes and Decision Making
      3. Bundles, Bodies, and Namespaces
        1. Bundles
        2. Bodies
        3. Namespaces
      4. Normal Ordering
      5. Looping in CFEngine
      6. Thinking in CFEngine
    5. Clients and Servers
      1. CFEngine Server Configuration
      2. Updating Client Files from the Server
      3. CFEngine Remote Execution Using cf-runagent
    6. CFEngine Information Resources
      1. Manuals and Official Guides
      2. CFEngine Standard Library
      3. CFEngine Solutions Guide
      4. CFEngine Design Center
      5. Community Forum and IRC channel
      6. CFEngine Bug Tracker
      7. Other Community Resources
      8. Recommended Reading Order
  6. 4. Using CFEngine
    1. Initial System Configuration
      1. Running These Policies
      2. Editing /etc/sysctl.conf
      3. Editing /etc/sshd_config
      4. Editing /etc/inittab
      5. Configuration Files with Variable Content
        1. Class-based configuration
        2. System-state-based configuration
    2. User Management
    3. Software Installation
      1. Package-Based Software Management
      2. Manual Software Management
    4. Using CFEngine for Security
      1. Policy Enforcement
        1. Template-based login banners
        2. Password expiration periods
      2. Security Scanning
    5. Additional CFEngine Features and Information
  7. 5. The CFEngine Design Center
    1. Getting Started with the Design Center
      1. Installing cf-sketch
      2. Exploring cf-sketch
      3. Exploring Existing Sketches
      4. Peeking Under the Hood
    2. Contributing to the Design Center
    3. Learning More About the Design Center
  8. 6. CFEngine Tips, Tricks, and Patterns
    1. Hierarchical Copying
    2. Passing Name-Value Pairs to Bundles
    3. Setting Default Values for Bundle Parameters
    4. Using Classes as Configuration Mechanisms
    5. Generic Tasks Using Lists and Array Indices
    6. Defining Classes for Groups of Hosts
    7. Controlling Promise Execution Order
    8. Dynamic Loading and Execution
      1. Per-File Inputs
      2. Dynamic bundle execution control
  9. 7. Advanced Topics
    1. Setting Up Multiple CFEngine Environments
      1. Using a Version-Control System to Separate Environments
      2. Flow of Development and Deployment
    2. CFEngine Testing
      1. Behavioral Testing for CFEngine Policies
      2. Unit Testing for CFEngine Policies
    3. Using Vagrant with CFEngine
    4. Service Management Using CFEngine
      1. Basic Concepts of Service Management with CFEngine
      2. Defining Your Own Service Management Mechanisms
    5. Where to from Here?
  10. A. Editing CFEngine 3 Configurations in Emacs
    1. Setting Up
    2. Using the cfengine Mode
    3. Customizing Indentation in cfengine-mode
  11. B. Editing CFEngine 3 Configurations in Vim
    1. Setting Up
    2. Getting Help
    3. Using the Plugin
    4. Hacking the vim_cf3 Plugin
      1. Abbreviations
      2. Maps
    5. Installing vim_cf3 Using CFEngine
  12. C. CFEngine 3.5.2 Agent Promise Attributes
    1. Attributes of Promises Common to All CFEngine Components
      1. Attributes of “classes” Promises
      2. Attributes of “defaults” Promises
      3. Attributes of “meta” Promises
      4. Attributes of “reports” Promises
      5. Attributes of “vars” Promises
      6. Attributes that Can Be Used in Any Promise
    2. Attributes of Promises Specific to the Agent
      1. Attributes of “commands” Promises
      2. Attributes of “databases” Promises
      3. Attributes of “guest_environments” Promises
      4. Attributes of “files” Promises
      5. Attributes of Promises in edit_line Bundles
        1. Attributes of Any Promises in edit_line Bundles
        2. Attributes of “delete_lines” promises in edit_line bundles
        3. Attributes of “insert_lines” Promises in edit_line Bundles
        4. Attributes of “field_edits” Promises in edit_line Bundles
        5. Attributes of “replace_patterns” Promises in edit_line Bundles
      6. Attributes of Promises in edit_xml Bundles
        1. Attributes of any promises in edit_xml bundles
        2. Attributes of “build_xpath” Promises in edit_xml Bundles
        3. Attributes of “delete_tree” Promises in edit_xml Bundles
        4. Attributes of “insert_tree” Promises in edit_xml Bundles
        5. Attributes of “delete_attribute” Promises in edit_xml Bundles
        6. Attributes of “set_attribute” Promises in edit_xml Bundles
        7. Attributes of “delete_text” Promises in edit_xml Bundles
        8. Attributes of “set_text” Promises in edit_xml Bundles
        9. Attributes of “insert_text” Promises in edit_xml Bundles
      7. Attributes of “methods” Promises
      8. Attributes of “packages” Promises
      9. Attributes of “processes” Promises
      10. Attributes of “services” Promises
      11. Attributes of “storage” Promises
    3. Control
      1. Common Control
      2. Agent Control
      3. File Control
  13. About the Author
  14. Colophon
  15. Copyright

Product information

  • Title: Learning CFEngine 3
  • Author(s): Diego Zamboni
  • Release date: March 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449312206