Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
louischarnay committed Feb 9, 2024
1 parent e5e575c commit da417c0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
32 changes: 27 additions & 5 deletions TP03/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ all:
- name: Run Database
docker_container:
name: database
image: leondumestre/tp-devops-database:1.0
image: louischarnay/tp01-postgres:1.0
env:
POSTGRES_USER: usr
POSTGRES_PASSWORD: pwd
Expand All @@ -41,20 +41,18 @@ all:
- name: Run App
docker_container:
name: backend
image: leondumestre/tp-devops-backend:1.0
image: louischarnay/tp01-api:1.0
env:
DATABASE_URL: jdbc:postgresql://database:5432/db
DATABASE_USER: usr
DATABASE_PASSWORD: pwd
networks:
- name: tp03-network
ports:
- "8080:8080"

- name: Run HTTPD
docker_container:
name: httpd
image: leondumestre/tp-devops-httpd:1.0
image: louischarnay/tp01-web:1.0
networks:
- name: tp03-network
ports:
Expand All @@ -71,6 +69,30 @@ This command will ping all the hosts in the inventory file `inventories/setup.ym

This command will execute the playbook `playbook.yml` on all the hosts in the inventory file `inventories/setup.yml`.

## Roles

```yml
- hosts: all
gather_facts: false
become: true
roles:
- role: install-docker
# - role: clean-container
- role: create-network
- role: launch-database
- role: launch-app
- role: launch-front
- role: launch-proxy
vars:
ansible_user: centos
```

The role is a way to organize the playbook. It allows to define a set of tasks that can be reused in multiple playbooks. The role is defined in a directory with the following structure:

With this configuration, we can execute the playbook `playbook.yml` and it will execute all the roles in the order defined in the file.

## Load Balancing

```
Expand Down
6 changes: 3 additions & 3 deletions TP03/ansible/playbook-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: Run Database
docker_container:
name: database
image: leondumestre/tp-devops-database:1.0
image: louischarnay/tp01-postgres:1.0
env:
POSTGRES_USER: usr
POSTGRES_PASSWORD: pwd
Expand All @@ -24,7 +24,7 @@
- name: Run App
docker_container:
name: backend
image: leondumestre/tp-devops-backend:1.0
image: louischarnay/tp01-api:1.0
env:
DATABASE_URL: jdbc:postgresql://database:5432/db
DATABASE_USER: usr
Expand All @@ -37,7 +37,7 @@
- name: Run HTTPD
docker_container:
name: httpd
image: leondumestre/tp-devops-httpd:1.0
image: louischarnay/tp01-web:1.0
networks:
- name: tp03-network
ports:
Expand Down

0 comments on commit da417c0

Please sign in to comment.