Ansible introduction for RHEL8-CentOS8.pdf

(8293 KB) Pobierz
2
Trademarks
All Trademarks and Registered Trademarks acknowledged.
Where such trademarks appear in this course, and the authors are aware of the
trademark claim, the trademarks have been printed with an initial capital letter.
Such trademarks are used purely for editorial purposes and no claim is made to
any such product being the property of anyone except the holder or registered
holder.
Copyright
Limit of liability
This document is COPYRIGHT First Alternative - 2021.
Whilst every effort has been made to make these notes accurate and objective,
First Alternative cannot be held liable for any errors therein, nor for the
consequences of any such errors. Examples are provided "as is" and it is the sole
responsibility of the reader to ensure that any example used or modified for use
in their own environment is fit for the use to which the reader puts it.
2 of 134
First Alternative 2021
3
Contents List
Contents List
.................................................................................................................. 3
Course Introduction
........................................................................................................ 6
Web Link security considerations
.................................................................................... 8
Obtaining example files for this course
........................................................................... 9
Other books from Us.....................................................................................................
10
Chapter 1: Introduction to Ansible Automation
.............................................................. 11
System requirements
..................................................................................................... 12
Chapter 2: Preparing the ansible controller system and clients
...................................... 13
Installing one CentOS from the EPEL repo
................................................................... 14
Ansible installation of control node on RHEL8
............................................................. 16
Ansible - preparing name resolution..............................................................................
18
Creating SSH keys
........................................................................................................ 20
Ansible client configuration summary
........................................................................... 23
Practical Exercise - ansible prep....................................................................................
24
Practical Exercise Answers – ansible prep
..................................................................... 25
Chapter 3: Ansible Inventories
......................................................................................... 27
Possible warnings
......................................................................................................... 29
Running a quick test with ansible
.................................................................................. 30
Increasing hosts in the inventory
................................................................................... 31
Chapter 4: The Ansible configuration file
........................................................................ 34
Chapter 5: Ansible documentation
................................................................................... 36
Chapter 6: Ansible Modules CLI Examples
..................................................................... 38
Ansible Modules CLI Examples - copy and service
...................................................... 40
Practical Exercise - ansible examples
............................................................................ 41
Practical Exercise Answers
........................................................................................... 42
Ansible Inventories - specifying a different username.
.................................................. 45
Ansible Inventories and Variables
................................................................................. 46
Ansible Inventories - further study
................................................................................ 47
Chapter 7: Ansible Playbooks
........................................................................................... 48
Ansible Playbooks example
.......................................................................................... 49
Ansible Playbooks example running the playbook
........................................................ 51
Ansible Playbooks - multiple users and no passwords!
.................................................. 52
Ansible Playbooks example - enhanced with variables
.................................................. 54
3 of 134
First Alternative 2021
4
Ansible Playbooks example - your chance to create one
................................................ 56
Ansible Playbooks example - user and group removal...................................................
57
Ansible Playbooks example - enhanced with facts
........................................................ 59
Ansible Playbooks example - enhanced with debug
...................................................... 62
Ansible Summary so far
.................................................................................................... 64
Practical Exercise - playbooks
...................................................................................... 65
Practical Exercise Answers - playbooks
........................................................................ 66
Chapter 8: Ansible Roles
................................................................................................... 67
Ansible Roles for RedHat
............................................................................................. 68
Ansible Roles for RedHat - using ansible-galaxy
.......................................................... 69
Ansible Roles - using roles in a playbook......................................................................
71
Ansible Roles - gather network information
.................................................................. 73
Ansible Roles - create the playbook to use a role
.......................................................... 78
Ansible Roles - Role documentation
............................................................................. 83
Configure time servers with rhel-system-roles.timesync................................................
84
Ansible Further Study, with useful links.
....................................................................... 86
Chapter 9: Ansible Tower and AWX.................................................................................
87
Ansible AWX Installation
............................................................................................. 88
Tower installation
......................................................................................................... 92
The Tower Dashboard
................................................................................................... 96
Chapter 10. Using Ansible with Microsoft Windows
....................................................... 97
Course Conclusion
............................................................................................................ 98
Appendix 1: The Training Lab Environment...................................................................
99
RedHat free downloads and use
.................................................................................. 100
The Training Lab Environment
................................................................................... 101
Version 8 Installation - Booting to build on any system
............................................... 103
Linux Installation - Booting to build -text-based install
............................................... 104
Linux Graphical Installation - Introduction screen.......................................................
105
Main Installation Screen
............................................................................................. 106
LOCALIZATION
....................................................................................................... 108
SOFTWARE
............................................................................................................... 109
SOFTWARE from RHEL CDN
.................................................................................. 110
SOFTWARE selection
................................................................................................. 111
SYSTEM
.................................................................................................................... 113
SYSTEM - setting network details.
............................................................................. 114
4 of 134
First Alternative 2021
5
SYSTEM - example completed network details
.......................................................... 116
SYSTEM - Installation Destination
............................................................................. 117
Connect to RedHat
...................................................................................................... 119
USER SETTINGS
...................................................................................................... 121
Begin Installation
........................................................................................................ 122
Practical Exercise - Lab Installation
............................................................................ 123
Exercise Answers
........................................................................................................ 125
Linux Interactive Installation - Conclusion..................................................................
126
Appendix 2: The Graphical User Interface (GUI)
......................................................... 127
Terminal Window
....................................................................................................... 130
Other functions
........................................................................................................... 132
Practical Exercise - GUI
............................................................................................. 133
INDEX
....................................................................................................................... 134
5 of 134
First Alternative 2021
Zgłoś jeśli naruszono regulamin