0%

Book Description

Configure Ansible and start coding YAML playbooks using the appropriate modules

Key Features

  • Create and use Ansible Playbook to script and organise management tasks
  • Benefit from the Ansible community roles and modules to resolve complex and niche tasks
  • Write configuration management code to automate infrastructure

Book Description

Configuration Management (CM) tools help administrators reduce their workload. Ansible is one of the best Configuration Management tools, and can act as an orchestrator for managing other CMs. This book is the easiest way to learn how to use Ansible as an orchestrator and a Configuration Management tool. With this book, you will learn how to control and monitor computer and network infrastructures of any size,physical or virtual.

You will begin by learning about the Ansible client-server architecture. To get started, you will set up and configure an Ansible server. You will then go through the major features of Ansible: Playbook and Inventory. Then, we will look at Ansible systems and network modules.

You will then use Ansible to enable infrastructure automated configuration management, followed by best practices for using Ansible roles and community modules.

Finally, you will explore Ansible features such as Ansible Vault, Ansible Containers, and Ansible plugins.

What you will learn

  • Implement Playbook YAML scripts and its capacities to simplify day-to-day tasks
  • Setup Static and Dynamic Inventory
  • Use Ansible predefined modules for Linux, Windows, networking, and virtualisation administration
  • Organize and configure the host filesystem using storage and files modules
  • Implement Ansible to enable infrastructure automated configuration management
  • Simplify infrastructure administration
  • Search and install new roles and enable them within Ansible
  • Secure your data using Ansible Vault

Who this book is for

This book is targeted at System Administrators and Network Administrators who want to use Ansible to automate an infrastructure. No knowledge of Ansible is required.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Ansible Quick Start Guide
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. What is Ansible?
    1. The IT configuration management market
    2. Ansible: simple, lightweight, and powerful
    3.  Ansible orchestration and automation
      1. Orchestration
      2. Automate everything
        1. Provisioning
        2. Configuration management
        3. Application deployment
        4. Continuous delivery and continuous integration
    4. Ansible project and Ansible Tower
      1. Ansible project
      2. Ansible Tower
    5. Summary
    6. References
  7. Ansible Setup and Configuration
    1. Ansible master node installation
      1. Prerequisites
      2. Red Hat, CentOS, and Fedora package installation
      3. Debian package installation
      4. Ubuntu package installation
      5. macOS X package installation
      6. Python PyPI installation
      7. Source GitHub or tarball installation
      8. Ansible Docker container installation
      9. Ansible instance on AWS
    2. Master node essential configuration
    3. Linux client node configuration
    4. Windows client node configuration
    5. Summary
    6. References
  8. Ansible Inventory and Playbook
    1. Basic Ad hoc commands on Ansible
    2. Ansible inventory
    3. Ansible playbook
    4. Summary
    5. References
  9. Ansible Modules
    1. Ansible modules overview
    2. Ad hoc versus playbook: the ping module
    3. Ad hoc versus playbook: the win_reboot module
    4. ad-hoc versus playbook: the copy module
    5. Ansible module return values
    6. Ansible Linux modules
      1. Linux system modules
        1. The user management module
        2. The group management module
        3. The hostname module
        4. The sysctl control module
        5. The service management module
        6. The systemd module
        7. The kernel blacklist management module
        8. The cron job editing module
        9. The SSH authorized keys management module
        10. The Git usage module
        11. The SELinux control module
      2. Linux commands modules
        1. Running the raw command module
        2. The command execution module 
        3. The shell command module
        4. The script execution module
        5. The expect script module
      3. Linux package modules
        1. Apt package manager module
        2. DNF package manager module
        3. Yum package manager module
        4. Homebrew package manager
        5. PyPI Python package manager module
        6. Cpanm Perl package manager module
      4. Linux file modules
        1. File and folder management modules
        2. Data distribution modules (copy, unarchive, and get_url)
        3. Data collection module (fetch)
        4. File editing modules (lineinfile, replace, and blockinfile)
      5. Linux networking modules
        1. Network interfaces management module
        2. Firewall UFW management module
        3. HAProxy control module
        4. Wake-on-LAN trigger module
      6. Linux storage modules
        1. File system management module
        2. Device mounting module 
        3. Disk partitioning module
        4. GlusterFS control module
    7. Ansible Windows modules
      1. Windows System Modules
        1. Windows user and group management module
        2. Windows register editing module
        3. Windows service management module
        4. Windows updates and feature management modules (win_updates, win_hotfix, and win_feature)
        5. Windows Wake-on-LAN trigger module
        6. Windows firewall management module
      2. Windows package modules
        1. Chocolatey control module
        2. Windows package manager
      3. Windows command modules
        1. Windows command modules (win_shell and win_command)
        2. Windows task scheduling module
      4. Windows file modules
        1. Windows file and folder management module
        2. Windows data sharing module
        3. Windows file editing module
        4. Windows data sending modules (win_copy, win_robocopy, and win_get_url)
    8. Ansible network modules
      1. Network data transfer modules (net_get and network_put)
      2. Cisco IOS command module
      3. Cisco ISO system configuration module
      4. Cisco IOS interface management module
      5. Cisco IOS static route control module
      6. Cisco IOS VLAN management module
    9. Ansible cloud modules
      1. VMware modules
        1. VMware guest management modules (vmware_guest and vsphere_guest)
        2. VMware guest snapshot management module
        3. VMware virtual machine shell execution module
        4. VMware host power state control module
      2. Docker modules
        1. Docker container management module
        2. Docker image management module
        3. Docker login module
      3. Amazon AWS modules
        1. AWS EC2 instance management module
        2. AWS WC2 AMI management module
        3. AWS EC2 key management module
    10. Summary
    11. References
  10. Ansible Automated Infrastructure
    1. Linux infrastructure automation
      1. System management automation
        1. Use case 1 – system update automation
        2. Use case 2 – creating a new user with all its settings
        3. Use case 3 – services (systemd) management
        4. Use case 4 – automated network drive mounting (NFS, SMB)
        5. Use case 5 – automated backup of important documents
      2. Automation of applications and service
        1. Use case 1 – setting up a Linux desktop environment with some pre-installed tools
        2. Use case 2 – LAMP server setup and configuration
    2. Windows infrastructure automation
      1. System management automation
        1. Use case 1 – system update automation
        2. Use case 2 – automated Windows optimization
      2. Application and services automation
        1. Use case 1 – automating Windows application management
        2. Use case 2 – setting up an NSclient Nagios client
    3. Network automation
      1. Use case 1 – automated patching of network devices
      2. Use case 2 – adding a new configuration in network devices
    4. Automation of the cloud and container infrastructure
      1. VMware automation
        1. Use case 1 – creating virtual machines from a template
        2. Use case 2 – ESXi hosts and cluster management
    5. Summary
    6. References
  11. Ansible Coding for Configuration Management
    1. Ansible configuration management coding standards
      1. Playbook and task naming
      2. YAML syntax usage for playbooks
      3. The become feature
      4. Group organization
      5. Using handlers
      6. Password usage in playbooks
      7. Playbook version control
      8. Making Ansible roles where possible
    2. Ansible coding best practices
      1. Using comments in playbooks
      2. Playbook files and folder naming
      3. Avoiding the use of command modules
      4. Avoiding ignoring module errors
      5. Using Ansible conditions
      6. Using Ansible loops
      7. Using template files
      8. Stating task status
      9. Shared storage space for data tasks
    3. Ansible roles
      1. What are Ansible roles?
        1. The tasks folder
        2. The handlers folder
        3. The vars folder
        4. The templates folder
        5. The defaults folder
        6. The files folder
        7. The meta folder
        8. The test folder
        9. The README folder/file
      2. Creating Ansible roles
      3. Using Ansible roles
    4. Summary
    5. References
  12. Ansible Galaxy and Community Roles
    1. Ansible Galaxy
      1. The Ansible Galaxy hub
      2. The Ansible Galaxy command line
    2. Galaxy contribution – role importation
      1. What to do before role submission
      2. Role repository
    3. Ansible Galaxy role management
      1. Ansible Galaxy role search
      2. Ansible Galaxy role installation 
      3. Ansible Galaxy role troubleshooting
    4. Summary
    5. References
  13. Ansible Advanced Features
    1. Ansible Vault
      1. What is Ansible Vault?
      2. Using Ansible Vault
      3. Best practices when using Ansible Vault
    2. Ansible Container
      1. What is Ansible Container?
      2. Using Ansible Container
      3. Example Ansible container
    3. Ansible plugins
      1. What are Ansible plugins?
      2. Developing Ansible plugins
    4. Summary
    5. References
  14. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
44.195.47.227