Pages

Sunday, April 22, 2018

Ansible Getting started (Transcript version 02)

PRE-REQUISITS

1) 4 VMS RUNNING ON AS BASE MACHINE WITH MINIMUM CONFIGURATION AS BELOW,
- 512MB RAM (MIN)
- 20GB OS DISK (THIN PROVISIONED)
- OS – “CENTOS” WITH INTERNET BASED REPOSITORY USAGE OR “REDHAT” WITH INHOUSE REPOSITORY SERVER USAGE) 
- VALID CONNECTION TO OS REPOSITORIES FOR ALL 4 VMS
- VMS SHOULD BE IN SAME NETWORK OR REACHABLE TO EACH OTHER 
2) VIRTUAL BOX ON STUDENTS LAPTOP IS ALSO PREFERABLE IF ITS MINIMUM 8GB WITH ALL ABOVER POINTS WITH CENTOS AS OS OPTION ONLY

INTRODUCTION

0) ORIENTATION TO THE TRAINING ENVIRONMENT AND FLOW

0.1) CONTROL MACHINE 
0.2) TARGET MACHINES (CLIENT MACHINES)
0.3) INTERNET BASED REPOSITORY ACCESS

SECTION 1 - INTRODUCING ANSIBLE (DAY 01)

1) WHY ANSIBLE?

1.1) INFRASTRUCTURE AUTOMATION NEEDS OF INDUSTRY
1.2) CONFIGURATION MANAGEMENT NEEDS OF INDUSTRY
1.3) STRENGTHS OF ANSIBLE - CONFIGURATION MANAGEMENT AND ORCHESTRATION
1.4) CONTINUOUS INTEGRATION CAPABILITIES

2) ANSIBLE CONCEPTS AND ARCHITECTURE

2.1) USING SSH EFFECTIVELY (TRADITIONAL WAY)
2.2) AUTOMATING SSH LOGIN BASED INTERATIONS (TRADITIONAL WAY)
2.3) ANSIBLE ARCHITECTURE (SSH AGENT)

3) INDUSTRY EXAMPLES OF ANSIBLE USAGE 

3.1) USE CASE 01 – WEB SERVER DEPLOYMENT
3.2) USE CASE 02 – SERVER SECURITY PATCHING
3.3) CASE STUDIES AVAILABLE ON ANSIBLE WEBSITE
3.4) GETTING INTO AUTOMATION MENTALITY

4) INSTALLING ANSIBLE

4.1) YUM BASED INSTALLATION
4.2) COMPILED INSTALLATION
4.3) WHAT ALL THINGS PROVIDED AS PART OF INSTALLATION?

SECTION 1 - LAB WITH EXAMPLES (DAY 01)

SECTION 2 – GETTING STARTED WITH ANSIBLE (DAY 01)

5) ANSIBLE INVENTORY

5.1) WHY INVENTORY? 
5.2) DEFINING HOSTS IN INVENTORY
- SINGLE HOST 
- MULTIPLE HOSTS
- GROUP OF HOSTS 
- GROUP OF GROUPS
5.3) OVERRIDING INVENTORY LOCATION
- INVENTORY LOCATION PRECEDENCE
- USING INVENTORY FILE AT ANY LOCATION
5.4) DYNAMIC INVENTORY

6) ANSIBLE CONFIGURATION FILES 

6.1) WHY CONFIGURATION FILES?
6.2) FEW CONFIGURATION OPTIONS
- INVENTORY      = /ETC/ANSIBLE/HOSTS
- LIBRARY        = /USR/SHARE/MY_MODULES/
- MODULE_UTILS   = /USR/SHARE/MY_MODULE_UTILS/
- REMOTE_TMP     = ~/.ANSIBLE/TMP
- LOCAL_TMP      = ~/.ANSIBLE/TMP
- FORKS          = 5
- POLL_INTERVAL  = 15
- SUDO_USER      = ROOT
- ASK_SUDO_PASS  = TRUE
- REMOTE_PORT    = 22
- HOST_KEY_CHECKING = FALSE
6.3) OVERRIDING CONFIGURATION OPTIONS

7) ANSIBLE AD HOC COMMANDS

7.1) WHY ANSIBLE AD HOC COMMANDS?
7.2) WHAT IS A TASK?
7.3) HOW SUDO WORKS ON LINUX?
7.4) UNDERSTANDING STRUCTURE OF ANSIBLE AD HOC COMMANDS
- COMMAND
- HOST PATTERN
- MODULE
- ARGUMENTS
- EXTRA OPTIONS
7.5) PING MODULE
7.6) SHELL MODULE 
7.7) SCRIPT MODULE 
7.8) AD HOC COMMAND EXECUTION (FROM INVENTORY)
- SINGLE HOST 
- MULTIPLE HOSTS 
- GROUP OF HOSTS
- ALL HOSTS
7.9) AD HOC COMMAND EXECUTION (NOT IN INVENTORY)
- SINGLE HOST 
- MULTIPLE HOSTS 
- GROUP OF HOSTS
- ALL HOSTS

8) MANAGING DYNAMIC INVENTORIES 

8.1) WHY DYNAMIC INVENTORIES?
8.2) SHELL SCRIPT BASED EXAMPLE OF DYNAMIC INVENTORY

9) CONFIGURING CONNECTIONS IN AD HOC COMMANDS

9.1) UNDERSTANDING SSH CONNECTION NEEDS (TRADITIONAL WAY)
9.2) SSH KEY LOCATION 
9.3) REMOTE SSH USER 
9.4) FORK OR NUMBER OF PARALLEL CONNECTIONS
9.5) POLL INTERVAL
9.6) REMOTE SUDO (PASSWORD BASED + PASSWORDLESS)

SECTION 2 - LAB WITH EXAMPLES (DAY 01)

SECTION 3 - IMPLEMENTING PLAYBOOKS (DAY 02)

10) GETTING STARTED WITH PLAYBOOKS

10.1) WHAT IS YAML?
10.2) UNDERSTANDING PLAYBOOK STRUCTURE (YAML FORMAT)
10.3) SAMPLE AD HOC COMMANS
10.4) WRITING EQUIVALENT PLAYBOOK
10.5) EXECUTING YOUR FIRST PLAYBOOK (SYNTAX VERIFICATION/DEBUG/DRY RUN)

11) ATTRIBUTES IN PLAYBOOK

11.1) HOSTS
11.2) BECOME
11.3) BECOME_USER
11.4) REAMOTE_USER
11.5) GATHER_FACTS

12) USING ANSIBLE DOCUMENTATION

12.1) ANSIBLE-DOC
12.2) ANSIBLE
12.3) ANSIBLE-PLAYBOOK
12.4) ANSIBLE-GALAXY

13) CONFIGURING CONNECTIONS FOR ANSIBLE PLAYBOOK

13.1) UNDERSTANDING SSH CONNECTION NEEDS (TRADITIONAL WAY)
13.2) SSH KEY LOCATION 
13.3) REMOTE SSH USER 
13.4) FORK OR NUMBER OF PARALLEL CONNECTIONS
13.5) POLL INTERVAL
13.6) REMOTE SUDO (PASSWORD BASED + PASSWORDLESS)

SECTION 3 - LAB WITH EXAMPLES (DAY 02)

SECTION 4 – VARIABLES IN PLAYBOOKS (DAY 03)

14) WHY VARIABLES 

14.1) NAMING CONVENTION
14.2) SCOPE OF VARIABLES
- GLOBAL SCOPE
- PLAY SCOPE
- HOST SCOPE

15) TYPE OF VARIABLES (DEPENDING ON PLACES WHERER THOSE ARE DEFINED)

15.1) HOST VARIABLES
- INVENTORY FILE
- INVENTORY FOLDER
15.2) HOSTGROUP VARIABLES
- INVENTORY FILE
- INVENTORY FOLDER
15.3) REGISTERED VARIABLES
15.4) DYNAMIC VARIABLES
15.5) INCLUDED VARIABLES
15.6) CUSTOM VARIABLES 
15.7) SYSTEM VARIABLES (FACTS)

16) WORKING WITH FACTS (SYSTEM INFORMATION)

16.1) GATHERING SYSTEM INFORMATION (TRADITIONAL WAY)
16.2) WHEN TO USE FACTS 
16.3) FACTS FILTERS
16.4) CUSTOM FACTS

SECTION 4 - LAB WITH EXAMPLES (DAY 03) 

SECTION 5 – ANSIBLE CONTROL MECHANISMS (DAY 04) 

17) TASKS IN LOOPS

17.1) NO LOOP
17.2) SIMPLE LOOP
17.3) ITEMISED LOOP
17.4) NESTED LOOP

18) TASKS WITH CONDITION/S

18.1) SIMPLE WHEN 
18.2) WHEN WITH VARIABLES
18.3) MULTIPLE CONDITIONS IN WHEN

19) HANDLERS (TRIGGERS)

19.1) USING SINGLE HANDLER
19.2) USING MULTIPLE HANDLERS

20) TAGS (LABEL)

20.1) EXECUTING TAGGED TASKS
20.2) EXECUTING UN-TAGGED TASKS

21) WORKING WITH ERRORS 

21.1) FAILED_WHEN
21.2) IGNORE_ERRORS
21.3) FORCED_HANDLERS
21.4) BLOCK

SECTION 5 - LAB WITH EXAMPLES (DAY 04) 

SECTION 6 - JINJA (DAY 04)

22) WHAT IS TEMPLATES?

23) JINJA TEMPLATES

23.1) DELIMITERS
23.2) LOOPS
23.3) CONDITIONS

24) KNOWN ISSUES

SECTION 6 - LAB WITH EXAMPLES (DAY 04) 

SECTION 7 – ANSIBLE ROLES (DAY 05)

25) WHY ROLES NEEDED? 

26) STRUCTURE OF A ROLE 

27) ROLE WITH DEPENDENCIES

28) TYPE OF ROLES ANSIBLE GALAXY

28.1) CUSTOM ROLES
28.2) ROLES FROM ANSIBLE GALAXY 

SECTION 7 - LAB WITH EXAMPLES (DAY 05)

SECTION 8 -  ANSIBLE VAULT (DAY 05)

29) WHY VAULT NEEDED? 

30) COMMANDS USED 

31) USING VAULT WITH AD HOC COMMANDS

32) USING VAULT WITH PLAYBOOKS

SECTION 8 - LAB WITH EXAMPLES (DAY 05)

SECTION 9 – BEST PRACTICES (DAY 05)

33) APPROACH TO WRITE PLAYBOOK

34) DELEGATION

35) PARALLELISM 

36) USGIN POWER PREVILEGE 

37) INVENTORY FILE PLACEMENT

38) PASSWORD AND KEYS

39) PLAYBOOK BEST PRACTICES 

40) TROUBLESHOOTING

SECTION 9 - LAB WITH EXAMPLES (DAY 05)

ANNEXURE I – FREQUENTLY USED MODULES

PING
SHELL 
FILE 
COPY 
YUM 
SERVICE
USER 
PARTED 
FILESYSTEM
MOUNT 
STAT 
TEMPLATE 
WAIT_FOR 
FIREWALLD 
UNARCHIVE 
SETUP 
FAIL 
HAPROXY 
AWS_S3 
EC2 
EC2_AMI 
AZURE 
VMWARE 

ANNEXURE 2 - REFERENCES 

REFERENCE LINKS



No comments:

Post a Comment