You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2024/day27.md
+77-8Lines changed: 77 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This presentation will give a broad overview of Ansible and its architecture and
16
16
Participants will get first-hand insights into Ansible, its strengths, weaknesses, and the potential of event-driven automation within the DevOps world.
17
17
18
18
> [!NOTE]
19
-
> The below content is a copy of the [lab repository's] README for convenience.
19
+
> The below content is a copy of the [lab repository's](https://github.com/mocdaniel/lab-event-driven-ansible) README for convenience.
20
20
21
21
---
22
22
@@ -28,7 +28,7 @@ The setup is done with Ansible, too. It will install **Ansible, EDA, Prometheus*
28
28
29
29
## Prerequisites
30
30
31
-
To follow along with this lab in its entirety, you will need four VMs:
31
+
To follow along with this lab in its entirety, you will need three VMs:
32
32
33
33
> [!NOTE]
34
34
> If you want to skip Ansible basics and go straight to EDA, you'll need just the `eda-controller.example.com` VM and can skip the others.
@@ -37,8 +37,7 @@ To follow along with this lab in its entirety, you will need four VMs:
37
37
|--------------------|-------------|
38
38
| eda-controller.example.com | CentOS/Rocky 8.9 |
39
39
| company.example.com | CentOS/Rocky 8.9 |
40
-
| internal.example.com | Ubuntu 22.04 |
41
-
| webshop.example.com | OpenSUSE 15.5 |
40
+
| webshop.example.com | Ubuntu 22.04 |
42
41
43
42
**You'll need to be able to SSH to each of these VMs as root using SSH keys.**
> Due to a known bug with Python on MacOS, you need to run `export NO_PROXY="*"` on MacOS before running the playbook
96
+
97
+
---
98
+
99
+
## Demos
100
+
101
+
### Lab 1: Ansible Basics
102
+
103
+
<details>
104
+
105
+
<summary>Ansible from the CLI via ansible</summary>
106
+
107
+
#### Ansible from the CLI via `ansible`
108
+
109
+
The first example installs a webserver on all hosts in the `webservers` group. The installed webserver is defined as a **host variable** in the inventory file `hosts.yml` (*see above*).
110
+
111
+
```console
112
+
ansible \
113
+
webservers \
114
+
-m package \
115
+
-a 'name="{{ webserver }}"' \
116
+
--one-line
117
+
```
118
+
119
+
Afterwards, we can start the webserver on all hosts in the `webservers` group.
120
+
121
+
```console
122
+
ansible \
123
+
webservers \
124
+
-m service \
125
+
-a 'name="{{ webserver }}" state=started' \
126
+
--one-line
127
+
```
128
+
129
+
Go on and check if the web servers are running on the respective hosts.
130
+
131
+
> [!TIP]
132
+
> Ansible is **idempotent** - try running the commands again and see how the output differs.
133
+
134
+
</details>
135
+
136
+
<details>
137
+
138
+
<summary>Ansible from the CLI via ansible-playbook</summary>
139
+
140
+
#### Ansible from the CLI via `ansible-playbook`
141
+
142
+
The second example utilizes the following **playbook** to **gather** and **display information** for all hosts in the `webservers` group, utilizing the **example** role from the lab repository.
0 commit comments