Hello and welcome to the lab. First off, if you are not familiar with what Ansible is:
Ansible is a powerful automation and orchestration engine, powerful enough to automate everything from IoT lightbulbs to cloud infrastructure - yet, simple enough for everyone to use. Even those who are not a programmer.
The reason why Ansible has become so popular is because it's simple. No coding skills are required. Even a lot of non-technical staff in your organization can read and understand Ansible playbooks. This simplicity means that you get started in minutes. Ansible is clientless, using SSH, WinRM or application specific APIs. Ansible also works as you think, tasks are executed in order, top to bottom - much adding to the simplicity. While simple, it's powerful enough to model the most complex workflows in IT.
Ansible's catch phrase is "automate all things" and this reflects fairly on what it can do. People use Ansible to automate all things. This differentiates it from the other automation frameworks or systems, which only automates parts of your IT landscape - adding fragmentation and lock-in while making collaboration more difficult.
In this lab, we use some basic graphics to make the lab easier to understand. Such as:
💥 This is something which you have to do. ⭐ If you have time, you can also do this. ❗ Take careful notice of this, or you may fall on your face. 👍 This text contains information about a best practice.
Here is some code that you need to run
Here is an example of expected output when running commands
If by some reason you get stuck in a lab - then here's what you should do. Follow below steps 1-5. Do not skip any steps if not told to.
- If you do not understand what to do in a lab, or do not understand what you are doing, skip immediately to step 5. Also, the authors of this lab apologize for that. The purpose of this lab is so that everyone can do it and understand it.
- This lab has seen plenty of use, so chances are that you have simply not followed the lab instructions. Start by reading the lab instructions again, carefully.
- If you are sure that you are doing things as described in the labs, perhaps you typed something wrong or had a copy-paste accident. Double checking your files content and comparing them with the content described here in the lab. If you typed things manually, try doing a clean copy-paste from the lab page instead.
- Ask the person beside you if that person also had an issue with what you are doing. If so, that may indicate there is actually something wrong.
- Raise your hand and someone will come and help you :)
❗ To get started with the labs, you first need to get your assigned username and servers. This will be provided to you by the people who operate this lab.
💥 Go here: https://www.ansible.com/workshop-license and download a free Ansible Tower subscription. You will use it later on in the lab.
❗ Do not skip any labs, the labs depend on the previous ones to be completed. You need to do them in order, 0-10.
❗ On purpose, security in this lab has not been made a priority, that is so you as a student get more freedom to learn. You have passwordless admin access via sudo on all systems. With that said, if you do something which is outside of the labs and break your systems, you get to keep all the pieces ;)
💥 Make sure you have the required tools to do the lab. The tools are listed below:
- An SSH client. On Linux and Mac, use the native ssh client in a terminal. On Windows, you can use PuTTy https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) if nothing else is available.
- A web browser. Ansible Tower officially supports latest version of Firefox and Chrome, so if you bump into any issues, try one of those web browsers.
💥 Review the overview of the lab environment. Most importantly, the Ansible Tower server is from where all the labs are done.
❗ PLEASE NOTE. DO NOT execute any of the labs from your local laptop.
The Ansible Tower server will have the responsibility of provisioning the managed systems in later labs. For now, you will spend time in the Ansible Tower server.
❗ It's not possible to ping your managed systems. If you need to troubleshoot connectivity to your managed systems, use the ping playbook you will create in Lab 2.
❗ The systems you will be working on runs Red Hat Enterprise Linux (7.5), if you are new to Linux, see below for a simple guide for common commands:
- Linux cheat sheet: https://files.fosswire.com/2007/08/fwunixref.pdf
❗ Once in the system, you have to use one of the text based text editors (nano, vim, emacs, joe) available. Use below links as reference when needed. For now, continue on:
- nano: https://wiki.gentoo.org/wiki/Nano/Basics_Guide
- vi/vim: https://vim.rtorr.com/
- emacs Congratulations, you obviously know what you are doing already
💥 Using your SSH client, log in as the student user on your assigned Ansible Tower server. On Linux/Mac/Windows with shell:
$ ssh student@IP-ADDRESS-OF-TOWER-SERVER
On Windows with PuTTy, see this link:
https://mediatemple.net/community/products/dv/204404604/using-ssh-in-putty-
If you are to setup setup key authentication (instead of using a password), view this link: https://support.rackspace.com/how-to/log-into-a-linux-server-with-an-ssh-private-key-on-windows/ and use the key from here: https://raw.githubusercontent.com/mglantz/ansible-roadshow/master/content/id_rsa
💥 Once logged in, run the below commands to pull this repository to your system:
cd
git clone https://github.com/RedHatNordicsSA/ansible-roadshow.git
💥 The variable $LAB_DIR will refer to the root of the cloned repository and make it persistant, export it as an variable using below command:
echo "export LAB_DIR=/home/student/ansible-roadshow" >>~/.bashrc && . ~/.bashrc
Now run the below commands and verify that you end up in the intended directory. If the first command returns with an error stating "No such file or directory", you should correct the path in ~/.bashrc or ask for help if you don't know how to.
cd $LAB_DIR
pwd
💥 In the student user's home directory create an empty dir named work, where you will do your assignments. This dir will be referred to as $WORK_DIR, export $WORK_DIR as a variable in your shell. To do this, run:
cd
mkdir work
echo "export WORK_DIR=/home/student/work" >>~/.bashrc && . ~/.bashrc
Now run the below commands and verify that you end up in the intended directory. If the first command returns with an error stating "No such file or directory", you should correct the path in ~/.bashrc or ask for help if you don't know how to.
cd $WORK_DIR
pwd
Great! You're now ready to continue.
End of lab