Sie sind auf Seite 1von 3

Document Conventions                                                                                                                                                                                                     ix

Introduction                                                                                                                                                                                                                                       xi
Red Hat System Administration III: Linux Automation .................................................... xi
Orientation to the Classroom Environment ................................................................ xiii
Controlling Your Systems ................................................................................ xiv
Internationalization .................................................................................................. xv

1. Introducing Ansible                                                                                                                                                                                                               1
Automating Linux Administration with Ansible .............................................................. 2
Quiz: Automating Linux Administration with Ansible ...................................................... 8
Installing Ansible ..................................................................................................... 10
Guided Exercise: Installing Ansible ............................................................................. 14
Summary ................................................................................................................ 16

2. Deploying Ansible                                                                                                                                                                                                             17
Building an Ansible Inventory .................................................................................... 18
Guided Exercise: Building an Ansible Inventory ........................................................... 23
Managing Ansible Configuration Files ....................................................................... 28
Guided Exercise: Managing Ansible Configuration Files ............................................... 35
Running Ad Hoc Commands .................................................................................... 40
Guided Exercise: Running Ad Hoc Commands ............................................................ 47
Lab: Deploying Ansible ............................................................................................ 52
Summary ................................................................................................................ 61

3. Implementing Playbooks                                                                                                                                                                                       63
Writing and Running Playbooks ................................................................................ 64
Guided Exercise: Writing and Running Playbooks ....................................................... 70
Implementing Multiple Plays .................................................................................... 75
Guided Exercise: Implementing Multiple Plays ............................................................ 85
Lab: Implementing Playbooks .................................................................................. 92
Summary ............................................................................................................... 99

4. Managing Variables and Facts                                                                                                                                                                       101


Managing Variables ............................................................................................... 102
Guided Exercise: Managing Variables ........................................................................ 110
Managing Secrets .................................................................................................. 116
Guided Exercise: Managing Secrets .......................................................................... 121
Managing Facts ..................................................................................................... 124
Guided Exercise: Managing Facts ............................................................................ 133
Lab: Managing Variables and Facts .......................................................................... 138
Summary ............................................................................................................... 151

5. Implementing Task Control                                                                                                                                                                               153


Writing Loops and Conditional Tasks ....................................................................... 154
Guided Exercise: Writing Loops and Conditional Tasks ............................................... 164
Implementing Handlers .......................................................................................... 168
Guided Exercise: Implementing Handlers ................................................................... 171
Handling Task Failure ............................................................................................. 176
Guided Exercise: Handling Task Failure .................................................................... 180
Lab: Implementing Task Control .............................................................................. 189
Summary .............................................................................................................. 197

6. Deploying Files to Managed Hosts                                                                                                                                                         199


Modifying and Copying Files to Hosts .................................................................... 200
Guided Exercise: Modifying and Copying Files to Hosts ............................................ 206
Deploying Custom Files with Jinja2 Templates .......................................................... 217
Guided Exercise: Deploying Custom Files with Jinja2 Templates ................................. 222

RH294-RHEL8.0-en-1-20190531 v
Lab: Deploying Files to Managed Hosts ................................................................... 225
Summary ............................................................................................................. 232

7. Managing Large Projects                                                                                                                                                                                   233


Selecting Hosts with Host Patterns ........................................................................ 234
Guided Exercise: Selecting Hosts with Host Patterns ................................................ 243
Managing Dynamic Inventories ............................................................................... 250
Guided Exercise: Managing Dynamic Inventories ...................................................... 256
Configuring Parallelism ......................................................................................... 260
Guided Exercise: Configuring Parallelism ................................................................. 263
Including and Importing Files ................................................................................. 269
Guided Exercise: Including and Importing Files ......................................................... 274
Lab: Managing Large Projects ............................................................................... 280
Summary ............................................................................................................. 290

8. Simplifying Playbooks with Roles                                                                                                                                                             291


Describing Role Structure ...................................................................................... 292
Quiz: Describing Role Structure .............................................................................. 297
Reusing Content with System Roles ........................................................................ 299
Guided Exercise: Reusing Content with System Roles ............................................... 306
Creating Roles ...................................................................................................... 313
Guided Exercise: Creating Roles .............................................................................. 319
Deploying Roles with Ansible Galaxy ....................................................................... 325
Guided Exercise: Deploying Roles with Ansible Galaxy ............................................... 332
Lab: Simplifying Playbooks with Roles ...................................................................... 341
Summary ............................................................................................................. 354

9. Troubleshooting Ansible                                                                                                                                                                                     355


Troubleshooting Playbooks .................................................................................... 356
Guided Exercise: Troubleshooting Playbooks ........................................................... 359
Troubleshooting Ansible Managed Hosts ................................................................. 367
Guided Exercise: Troubleshooting Ansible Managed Hosts ......................................... 372
Lab: Troubleshooting Ansible ................................................................................. 376
Summary ............................................................................................................. 386

10. Automating Linux Administration Tasks                                                                                                                                     387


Managing Software and Subscriptions .................................................................... 388
Guided Exercise: Managing Software and Subscriptions ............................................ 397
Managing Users and Authentication ....................................................................... 405
Guided Exercise: Managing Users and Authentication ............................................... 409
Managing the Boot Process and Scheduled Processes ............................................... 416
Guided Exercise: Managing the Boot Process and Scheduled Processes ...................... 420
Managing Storage ................................................................................................ 432
Guided Exercise: Managing Storage ....................................................................... 440
Managing Network Configuration ........................................................................... 455
Guided Exercise: Managing Network Configuration ................................................... 462
Lab: Automating Linux Administration Tasks ............................................................ 466
Summary ............................................................................................................. 482

11. Comprehensive Review: Automation with Ansible                                                                                                           483


Comprehensive Review ........................................................................................ 484
Lab: Deploying Ansible .......................................................................................... 487
Lab: Creating Playbooks ........................................................................................ 492
Lab: Creating Roles and Using Dynamic Inventory ..................................................... 501

A. Supplementary Topics                                                                                                                                                                                             515


Examining Ansible Configuration Options ................................................................. 516

vi RH294-RHEL8.0-en-1-20190531
B. Ansible Lightbulb Licensing                                                                                                                                                                             519
Ansible Lightbulb License ...................................................................................... 520

RH294-RHEL8.0-en-1-20190531 vii