Skip to content

Commit 4d84d3d

Browse files
author
Iliyan Vutoff
committed
Add Ansible task definition and requirements
1 parent 77ecad1 commit 4d84d3d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

M1-3-Ansible/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# M1-3-1 Configuration Management
2+
3+
## Ansible Task
4+
Create an Ansible playbook that build, push and then run the Docker image for the Python application. Let your playbook has the following variables:
5+
6+
- `image_name` - contains the name of your image without the tag, i.e. `vutoff/python-app`
7+
- `image_tag` - contains the tag you tagged your image with, i.e. `v0.2`
8+
- `listen_port` - contains the listening port you're binding your app to.
9+
10+
Make sure that you set environment variable `PORT` when you define your container in the Ansible playbook that takes its value from `listen_port` variable.
11+
12+
Use Ansible modules. Do not shell out.
13+
14+
### Requirements
15+
- Make sure you have Python installed. Any version above 3.8 would suffice.
16+
- The `requirements.txt` file in this directory contains the required Ansible version. Run
17+
18+
```sh
19+
pip install -r requirements.txt
20+
```
21+
22+
- Make sure that Docker is running on your local machine.
23+
24+
### Mind the following
25+
26+
- If you're running Docker Desktop or Rancher Desktop, mind the location of the `docker.sock` file. The location of the socket file is
27+
- Docker Desktop - `${HOME}/.docker/run/docker.sock`
28+
- Rancher DEsktop - ${HOME}/.rd/run/docker.sock
29+
30+
- If you're using one of the above, when you write your Ansible playbook you must specify the path to the docker socket with the parameter `docker_host`, i.e. `docker_host: "unix://{{ ansible_env.HOME }}/.rd/docker.sock"`.

M1-3-Ansible/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ansible==8.5.0
2+
ansible-core==2.15.5

0 commit comments

Comments
 (0)