Skip to content

Commit ea680b6

Browse files
committed
mega commit
this commit - adds remainder of spanish language links to all readmes for ansible_rhel workshop_type - changes all curls from IP addresses to DNS - adds solution for 1.7
1 parent 58bf3d8 commit ea680b6

37 files changed

+157
-55
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ansible/
2121
demos/servicenow/private.yml
2222
*.html
2323
!exercises/ansible_rhel/1.3-playbook/web.html
24+
!exercises/ansible_rhel/1.7-role/roles/apache_vhost/files/web.html
2425
!exercises/ansible_rhel/1.4-variables/files/dev_web.html
2526
!exercises/ansible_rhel/1.4-variables/files/prod_web.html
2627
demos/servicenow/closed_loop_incident_mgmt/input_vars.yaml

exercises/ansible_rhel/1.4-variables/README.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,28 @@ Create a new Playbook called `deploy_index_html.yml` in the `~/ansible-files/` d
135135

136136
## Step 4 - Test the Result
137137

138-
The Playbook should copy different files as index.html to the hosts, use `curl` to test it. Check the inventory again if you forgot the IP addresses of your nodes.
138+
The Ansible Playbook copies different files as index.html to the hosts, use `curl` to test it.
139139

140-
```bash
141-
[student<X>@ansible ansible-files]$ grep node ~/lab_inventory/hosts
142-
node1 ansible_host=11.22.33.44
143-
node2 ansible_host=22.33.44.55
144-
node3 ansible_host=33.44.55.66
145-
[student<X>@ansible ansible-files]$ curl http://11.22.33.44
140+
For node1:
141+
```
142+
[student<X>@ansible ansible-files]$ curl http://node1
146143
<body>
147144
<h1>This is a development webserver, have fun!</h1>
148145
</body>
149-
[student1@ansible ansible-files]$ curl http://22.33.44.55
146+
```
147+
148+
For node2:
149+
150+
```
151+
[student1@ansible ansible-files]$ curl http://node2
150152
<body>
151153
<h1>This is a production webserver, take care!</h1>
152154
</body>
153-
[student1@ansible ansible-files]$ curl http://33.44.55.66
155+
```
156+
157+
For node3:
158+
```
159+
[student1@ansible ansible-files]$ curl http://node3
154160
<body>
155161
<h1>This is a development webserver, have fun!</h1>
156162
</body>

exercises/ansible_rhel/1.5-handlers/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ So what’s new here?
139139

140140
Run the Playbook. We didn’t change anything in the file yet so there should not be any `changed` lines in the output and of course the handler shouldn’t have fired.
141141

142-
- Now change the `Listen 80` line in `/etc/httpd/conf/httpd.conf` to:
142+
- Now change the `Listen 80` line in `~/ansible-files/files/httpd.conf` to:
143143

144144
```ini
145145
Listen 8080
@@ -154,9 +154,9 @@ Listen 8080
154154
Apache should now listen on port 8080. Easy enough to verify:
155155

156156
```bash
157-
[student1@ansible ansible-files]$ curl http://22.33.44.55
157+
[student1@ansible ansible-files]$ curl http://node1
158158
curl: (7) Failed connect to 22.33.44.55:80; Connection refused
159-
[student1@ansible ansible-files]$ curl http://22.33.44.55:8080
159+
[student1@ansible ansible-files]$ curl http://node1:8080
160160
<body>
161161
<h1>This is a production webserver, take care!</h1>
162162
</body>

exercises/ansible_rhel/1.7-role/README.es.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Ahora ya estás listo para ejecutar tu playbook:
283283
Ejecute un comando curl contra `node2` para confirmar que el role funcionó:
284284

285285
```bash
286-
[student<X>@ansible ansible-files]$ curl -s http://22.33.44.55:8080
286+
[student<X>@ansible ansible-files]$ curl -s http://node2:8080
287287
simple vhost index
288288
```
289289

exercises/ansible_rhel/1.7-role/README.fr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Vous êtes maintenant prêt à exécuter votre playbook:
284284
Exécutez une commande curl contre `node2` pour confirmer que le rôle a fonctionné:
285285

286286
```bash
287-
[student<X>@ansible ansible-files]$ curl -s http://22.33.44.55:8080
287+
[student<X>@ansible ansible-files]$ curl -s http://node2:8080
288288
simple vhost index
289289
```
290290

exercises/ansible_rhel/1.7-role/README.ja.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Playbook を実行する準備が整いましたので、実行してみまし
274274
`node2` に対して curl コマンドを実行して、 Roles が機能していることを確認します。バーチャルホストのポートは8080です。
275275

276276
```bash
277-
[student<X>@ansible ansible-files]$ curl -s http://<node2>:8080
277+
[student<X>@ansible ansible-files]$ curl -s http://node2:8080
278278
simple vhost index
279279
```
280280

exercises/ansible_rhel/1.7-role/README.md

+32-11
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ This exercise will cover:
2929

3030
## Step 1 - Understanding the Ansible Role Structure
3131

32-
Roles are basically automation built around *include* directives and really don’t contain much additional magic beyond some improvements to search path handling for referenced files.
33-
3432
Roles follow a defined directory structure; a role is named by the top level directory. Some of the subdirectories contain YAML files, named `main.yml`. The files and templates subdirectories can contain objects referenced by the YAML files.
3533

3634
An example project structure could look like this, the name of the role would be "apache":
@@ -96,6 +94,27 @@ Have a look at the role directories and their content:
9694
[student<X>@ansible ansible-files]$ tree roles
9795
```
9896

97+
```
98+
roles/
99+
└── apache_vhost
100+
├── defaults
101+
│   └── main.yml
102+
├── files
103+
├── handlers
104+
│   └── main.yml
105+
├── meta
106+
│   └── main.yml
107+
├── README.md
108+
├── tasks
109+
│   └── main.yml
110+
├── templates
111+
├── tests
112+
│   ├── inventory
113+
│   └── test.yml
114+
└── vars
115+
└── main.yml
116+
```
117+
99118
## Step 3 - Create the Tasks File
100119
101120
The `main.yml` file in the tasks subdirectory of the role should do the following:
@@ -110,9 +129,9 @@ The `main.yml` file in the tasks subdirectory of the role should do the followin
110129
111130
> **WARNING**
112131
>
113-
> **The `main.yml` (and other files possibly included by main.yml) can only contain tasks, *not* complete Playbooks!**
132+
> **The `main.yml` (and other files possibly included by main.yml) can only contain tasks, *not* complete playbooks!**
114133
115-
Change into the `roles/apache_vhost` directory. Edit the `tasks/main.yml` file:
134+
Edit the `roles/apache_vhost/tasks/main.yml` file:
116135
117136
```yaml
118137
---
@@ -193,7 +212,7 @@ The full `tasks/main.yml` file is:
193212
- name: deliver html content
194213
copy:
195214
src: web.html
196-
dest: "/var/www/vhosts/{{ ansible_hostname }}"
215+
dest: "/var/www/vhosts/{{ ansible_hostname }}/index.html"
197216
198217
- name: template vhost file
199218
template:
@@ -210,7 +229,7 @@ The full `tasks/main.yml` file is:
210229

211230
## Step 4 - Create the handler
212231

213-
Create the handler in the file `handlers/main.yml` to restart httpd when notified by the template task:
232+
Create the handler in the file `roles/apache_vhost/handlers/main.yml` to restart httpd when notified by the template task:
214233

215234
```yaml
216235
---
@@ -225,14 +244,16 @@ Create the handler in the file `handlers/main.yml` to restart httpd when notifie
225244

226245
Create the HTML content that will be served by the webserver.
227246

228-
- Create the `web.html` file in the "src" directory of the role, `files`:
247+
- Create an web.html file in the "src" directory of the role, `files`:
229248

230-
```bash
231-
[student<X>@ansible ansible-files]$ echo 'simple vhost index' > ~/ansible-files/roles/apache_vhost/files/web.html
249+
```
250+
$ echo 'simple vhost index' > ~/ansible-files/roles/apache_vhost/files/web.html
232251
```
233252
234253
- Create the `vhost.conf.j2` template file in the role's `templates` subdirectory.
235254
255+
`$ cat roles/apache_vhost/templates/vhost.conf.j2`
256+
236257
<!-- {% raw %} -->
237258
```
238259
# {{ ansible_managed }}
@@ -286,11 +307,11 @@ Now you are ready to run your playbook:
286307
Run a curl command against `node2` to confirm that the role worked:
287308

288309
```bash
289-
[student<X>@ansible ansible-files]$ curl -s http://22.33.44.55:8080
310+
[student<X>@ansible ansible-files]$ curl -s http://node2:8080
290311
simple vhost index
291312
```
292313

293-
All looking good? Congratulations! You have successfully completed the Ansible Engine Workshop Exercises!
314+
Congratulations! You have successfully completed this exercise!
294315

295316
----
296317
**Navigation**

exercises/ansible_rhel/1.7-role/README.pt-br.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ Agora você está pronto para executar seu playbook:
272272
Execute um comando curl no `node2` para confirmar que a role funcionou:
273273

274274
```bash
275-
[student<X>@ansible ansible-files]$ curl -s http://22.33.44.55:8080
275+
[student<X>@ansible ansible-files]$ curl -s http://node2:8080
276276
vhost index
277277
```
278278

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
simple vhost index
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
# handlers file for roles/apache_vhost
3+
- name: restart_httpd
4+
service:
5+
name: httpd
6+
state: restarted
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# tasks file for roles/apache_vhost
3+
- name: install httpd
4+
yum:
5+
name: httpd
6+
state: latest
7+
8+
- name: start and enable httpd service
9+
service:
10+
name: httpd
11+
state: started
12+
enabled: true
13+
14+
- name: ensure vhost directory is present
15+
file:
16+
path: "/var/www/vhosts/{{ ansible_hostname }}"
17+
state: directory
18+
19+
- name: deliver html content
20+
copy:
21+
src: web.html
22+
dest: "/var/www/vhosts/{{ ansible_hostname }}/index.html"
23+
24+
- name: template vhost file
25+
template:
26+
src: vhost.conf.j2
27+
dest: /etc/httpd/conf.d/vhost.conf
28+
owner: root
29+
group: root
30+
mode: 0644
31+
notify:
32+
- restart_httpd
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# {{ ansible_managed }}
2+
3+
<VirtualHost *:8080>
4+
ServerAdmin webmaster@{{ ansible_fqdn }}
5+
ServerName {{ ansible_fqdn }}
6+
ErrorLog logs/{{ ansible_hostname }}-error.log
7+
CustomLog logs/{{ ansible_hostname }}-common.log common
8+
DocumentRoot /var/www/vhosts/{{ ansible_hostname }}/
9+
10+
<Directory /var/www/vhosts/{{ ansible_hostname }}/>
11+
Options +Indexes +FollowSymlinks +Includes
12+
Order allow,deny
13+
Allow from all
14+
</Directory>
15+
</VirtualHost>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: use apache_vhost role playbook
3+
hosts: node2
4+
become: yes
5+
6+
pre_tasks:
7+
- debug:
8+
msg: 'Beginning web server configuration.'
9+
10+
roles:
11+
- apache_vhost
12+
13+
post_tasks:
14+
- debug:
15+
msg: 'Web server has been configured.'

exercises/ansible_rhel/2.3-projects/README.es.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Workshop - Proyectos y plantillas de trabajo
22

33
**Lee esto en otros idiomas***:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md),![Español](../../../images/col.png)[Español](README.es.md)
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
## Tabla de contenidos
77

@@ -77,7 +77,7 @@ Para configurar y utilizar este repositorio como un **Sistema de Control de Cód
7777
## Crear el proyecto
7878

7979
- Ir a **RESOURCES → Projects** en la vista de menú lateral haga clic en el botón verde **+**. Rellene el formulario
80-
80+
8181
<table>
8282
<tr>
8383
<th>Parámetro</th>

exercises/ansible_rhel/2.3-projects/README.fr.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#Atelier - Les projets & modèles
22

3-
**Lisez ceci dans d'autres langues**: <br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
3+
**Lisez ceci dans d'autres langues**:
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
45

56
## Table des matières
67

exercises/ansible_rhel/2.3-projects/README.ja.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# 演習 - プロジェクトとジョブテンプレート
22

33
**Read this in other languages**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
5+
56

67
* [Git リポジトリのセットアップ](#git-リポジトリのセットアップ)
78
* [プロジェクトの作成](#プロジェクトの作成)

exercises/ansible_rhel/2.3-projects/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Workshop Exercise - Projects & job templates
22

33
**Read this in other languages**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md),![Español](../../../images/col.png) [Español](README.es.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
## Table Contents
77

exercises/ansible_rhel/2.3-projects/README.pt-br.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Exercício - Projects & job templates
22

33
**Leia em outras linguagens**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
* [Configurando o repositório Git](#configurando-o-repositório-git)
77
* [Criando o projeto](#criando-o-projeto)

exercises/ansible_rhel/2.4-surveys/README.es.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Workshop - Encuestas
22

33
**Lee esto en otros idiomas**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md),![Español](../../../images/col.png)[Español](README.es.md)
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
## Tabla de contenidos
77

exercises/ansible_rhel/2.4-surveys/README.fr.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Atelier - Les questionnaires
22

3-
**Lisez ceci dans d'autres langues**: <br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
3+
**Lisez ceci dans d'autres langues**:
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
45

56
## Table des matières
67

exercises/ansible_rhel/2.4-surveys/README.ja.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 演習 - Survey 機能
22

33
**Read this in other languages**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
* [プロジェクトを作成する](#プロジェクトを作成する)
77
* [Survey 付きのテンプレートを作成](#survey-付きのテンプレートを作成)

exercises/ansible_rhel/2.4-surveys/README.pt-br.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Exercise - Surveys
22

33
**Leia em outras linguagens**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
* [Criando o projeto](#criando-o-projeto)
77
* [Criando um template com uma Survey](#criando-um-template-com-uma-survey)

exercises/ansible_rhel/2.5-rbac/README.es.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Workshop - Control de acceso basado en roles
22

33
**Lee esto en otros idiomas**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md),![Español](../../../images/col.png)[Español](README.es.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
## Tabla de contenidos:
77

@@ -146,7 +146,7 @@ Compruebe el resultado: ejecute `curl` de nuevo en el host de control para extra
146146
$ curl http://22.33.44.55
147147
```
148148

149-
Sólo recuerda lo que acabas de hacer: has habilitado a un usuario restringido para ejecutar un Playbook de Ansible
149+
Sólo recuerda lo que acabas de hacer: has habilitado a un usuario restringido para ejecutar un Playbook de Ansible
150150

151151
- Sin tener acceso a las credenciales
152152

exercises/ansible_rhel/2.5-rbac/README.fr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Atelier - Les contrôles d'accès
22

33
**Lisez ceci dans d'autres langues**:
4-
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png)[Française](README.fr.md).
4+
<br>![uk](../../../images/uk.png) [English](README.md), ![japan](../../../images/japan.png)[日本語](README.ja.md), ![brazil](../../../images/brazil.png) [Portugues do Brasil](README.pt-br.md), ![france](../../../images/fr.png) [Française](README.fr.md), ![Español](../../../images/col.png) [Español](README.es.md).
55

66
## Table des matières
77

0 commit comments

Comments
 (0)