File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ # M1-3-1 Configuration Management
2+
3+ ## Ansible Task
4+
5+ Create an Ansible playbook that build, push and then run the Docker image for the Python
6+ application. Let your playbook has the following variables:
7+
8+ * ` image_name ` - contains the name of your image without the tag, i.e. ` vutoff/python-app `
9+ * ` image_tag ` - contains the tag you tagged your image with, i.e. ` v0.2 `
10+ * ` listen_port ` - contains the listening port you're binding your app to.
11+
12+ Make sure that you set environment variable ` PORT ` when you define your container
13+ in the Ansible playbook that takes its value from ` listen_port ` variable.
14+
15+ Use Ansible modules. Do not shell out.
16+
17+ ### Requirements
18+
19+ * Make sure you have Python installed. Any version above 3.8 would suffice.
20+ * The ` requirements.txt ` file in this directory contains the required Ansible version. Run
21+
22+ ``` sh
23+ pip install -r requirements.txt
24+ ```
25+
26+ * Make sure that Docker is running on your local machine.
27+
28+ ### Mind the following
29+
30+ * If you're running Docker Desktop or Rancher Desktop, mind the location of the ` docker.sock ` file. The location of the socket file is
31+ * Docker Desktop - ` ${HOME}/.docker/run/docker.sock `
32+ * Rancher DEsktop - ${HOME}/.rd/run/docker.sock
33+
34+ * If you're using one of the above, when you write your Ansible playbook you
35+ must specify the path to the docker socket with the parameter ` docker_host ` ,
36+ i.e. ` docker_host: "unix://{{ ansible_env.HOME }}/.rd/docker.sock" ` .
Original file line number Diff line number Diff line change 1+ ansible == 10.3.0
2+ ansible-compat == 24.9.1
3+ ansible-core == 2.17.5
4+ ansible-lint == 24.9.2
15blinker == 1.6.3 ; python_version >= "3.10" and python_version < "4.0"
26click == 8.1.7 ; python_version >= "3.10" and python_version < "4.0"
37colorama == 0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
You can’t perform that action at this time.
0 commit comments