Skip to content
Snippets Groups Projects
Commit ebdc7b6a authored by marcoemi.poleggi's avatar marcoemi.poleggi
Browse files

Update README.md

parent 84ebed20
No related branches found
No related tags found
No related merge requests found
......@@ -3,18 +3,9 @@
Lab template for a CM/deployment exercise with Ansible and ngonx on any
Cloud. Originally written by Marcel Graf (HEIG-VD).
## Pedagogical objectives ##
* Become familiar with a configuration management tool
* Deploy a web application in an automated fashion
* Become familiar with Desired State Configuration
## Tasks ##
In this lab you will perform a number of tasks and document your progress in a
lab report. Each task specifies one or more deliverables to be
produced. Collect all the deliverables in your lab report.
**N.B.** Some tasks require interacting with your local machine's OS: any
related commands are supposed to be run into a terminal with the following
conventions about the *command line prompt*:
......@@ -40,8 +31,9 @@ lcl$ ansible --version
### Task #2: Create a VM on a Cloud of your choice ###
**Goal:** create a VM that will be managed by Ansible. Chose any Cloud you are
familiar with, then:
**Goal:** create a VM that will be managed by Ansible.
:bulb: If you followed the [Terraform exercise](https://gitedu.hesge.ch/lsds/teaching/bachelor/cloud-and-deployment/lab-terraform/-/blob/main/SwitchEngines/README.md), use your TF plan to bring up your assigned sandbox instance and **skip** the rest of this task. Otherwise Chose any Cloud you are familiar with, then:
1. Import or create an RSA key pair for SSH access to the VM.
......@@ -60,12 +52,12 @@ After launching make sure you can SSH into the VM using your
`<your-private-key>` (must be a full path):
``` shell
lcl$ ssh -i <your-private-key> ubuntu@<VM-DNS-name-or-IP-address>
lcl$ ssh -i <your-private-key> <your-vm-user>@<VM-DNS-name-or-IP-address>
```
### Task #3: Configure Ansible to connect to the managed VM ###
**Goal:** intruct Ansible about the machines (hosts) it shall manage.
**Goal:** instruct Ansible about the machines (hosts) it shall manage.
Create a "sandbox" directory on your local machine `~/ansible/`. Inside
it, create a file called `hosts.yml` which will serve as the *inventory* file
......@@ -84,7 +76,7 @@ all:
and check its validity:
``` shell
ansible-inventory -i ~/ansible/hosts.yml --list
lcl$ ansible-inventory -i ~/ansible/hosts.yml --list
```
Verify that you can use Ansible to connect to the testserver:
......@@ -95,7 +87,7 @@ lcl$ ansible -i ~/ansible/hosts.yml testserver -m ping
You should see output similar to the following:
`
```
testserver | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
......@@ -103,7 +95,7 @@ testserver | SUCCESS => {
"changed": false,
"ping": "pong"
}
`
```
Let's simplify the configuration of Ansible by using a user default
configuration file `~/.ansible.cfg` with contents (`.ini` style):
......@@ -248,10 +240,10 @@ server {
}
```
As per the aboveconfiguration file, nginx will serve the Web app's homepage
As per the above configuration file, nginx will serve the Web app's homepage
from `index.html`. This will be generated via Ansible's templating engine from
a template, which has to be created as
`~/ansible/playbooks/templates/index.html.j2` and should hold the following:
`~/ansible/playbooks/templates/index.html.j2` and shall hold the following:
``` html
<html>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment