rendu TP TLC 2024
This commit is contained in:
commit
73835f377e
|
@ -0,0 +1 @@
|
|||
Subproject commit 0836898feca1b8aaa8aff348fe0438fde9c9f7ca
|
|
@ -0,0 +1,9 @@
|
|||
[webservers]
|
||||
148.60.11.43
|
||||
|
||||
[webservers:vars]
|
||||
ansible_connection=ssh
|
||||
ansible_ssh_user=zprojet
|
||||
ansible_ssh_pass=tp_ansible_pass
|
||||
ansible_become_pass=tp_ansible_pass
|
||||
ansible_python_interpreter=/usr/bin/python3
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
|
||||
- name: Checking if daemon.json exists
|
||||
ansible.builtin.stat:
|
||||
path: /etc/docker/daemon.json
|
||||
register: is_present
|
||||
|
||||
- block:
|
||||
- name: Adding registry to file
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/docker/daemon.json
|
||||
line: '{ "insecure-registries" : ["localhost:32000"] }'
|
||||
create: yes
|
||||
when: is_present.stat.exists == false
|
||||
|
||||
- name: Restart docker
|
||||
ansible.builtin.systemd_service:
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
name: docker
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
|
||||
- name: Add Docker GPG apt Key
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker Repository
|
||||
apt_repository:
|
||||
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
||||
state: present
|
||||
|
||||
- name: Update apt and install docker-ce
|
||||
apt:
|
||||
name: docker-ce
|
||||
state: latest
|
||||
update_cache: true
|
||||
- name: Install Docker Module for Python
|
||||
pip:
|
||||
name: docker
|
||||
- name: Start docker daemon
|
||||
systemd_service:
|
||||
name: docker
|
||||
state: restarted
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
|
||||
- name: Start microk8s
|
||||
ansible.builtin.command: microk8s start
|
||||
|
||||
- name: Wait for microk8S to be ready
|
||||
ansible.builtin.command: microk8s status --wait-ready
|
||||
|
||||
- name: Enable dns storage
|
||||
ansible.builtin.command: microk8s enable dns storage
|
||||
|
||||
- name: Enable ingress dashboard
|
||||
ansible.builtin.command: microk8s enable dashboard ingress
|
||||
|
||||
- name: Enable registry
|
||||
ansible.builtin.command: microk8s enable registry
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
- include_tasks: docker_install.yml
|
||||
|
||||
- include_tasks: microk8s_install.yml
|
||||
|
||||
- include_tasks: enable_microk8s.yml
|
||||
|
||||
- include_tasks: add_insecure_registries.yml
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
|
||||
- name: Install snapd
|
||||
apt:
|
||||
name: snapd
|
||||
state: present
|
||||
|
||||
- name: Install MicroK8s
|
||||
shell: snap install microk8s --classic
|
||||
|
||||
- name: Allow non-root access to MicroK8s
|
||||
shell: usermod -aG microk8s $USER
|
||||
|
||||
- name: Configure MicroK8s
|
||||
shell: sudo microk8s status --wait-ready
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
# This playbook deploys the whole application stack in this site.
|
||||
|
||||
- name: apply common configuration to all nodes
|
||||
hosts: all
|
||||
remote_user: zprojet
|
||||
become: yes
|
||||
|
||||
roles:
|
||||
- microk8s
|
|
@ -0,0 +1,16 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
RUN yes | apt-get update
|
||||
RUN apt-get install -y openjdk-8-jdk
|
||||
RUN apt-get install -y maven
|
||||
RUN apt-get install -y libpng-dev
|
||||
RUN apt-get install -y git
|
||||
|
||||
RUN git clone https://github.com/barais/TPDockerSampleApp
|
||||
WORKDIR TPDockerSampleApp
|
||||
RUN mvn install:install-file -Dfile=./lib/opencv-3410.jar -DgroupId=org.opencv -DartifactId=opencv -Dversion=3.4.10 -Dpackaging=jar
|
||||
|
||||
# Pour compiler
|
||||
RUN mvn package
|
||||
# Pour lancer l'application
|
||||
CMD java -Djava.library.path=lib/ubuntuupperthan18/ -jar target/fatjar-0.0.1-SNAPSHOT.jar
|
|
@ -0,0 +1,28 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
reverse-proxy:
|
||||
image: jwilder/nginx-proxy
|
||||
ports:
|
||||
- 8080:80
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock
|
||||
|
||||
nginx1:
|
||||
image: nginx
|
||||
environment:
|
||||
- HOSTNAME=m
|
||||
|
||||
nginx2:
|
||||
image: nginx
|
||||
environment:
|
||||
- HOSTNAME=m
|
||||
|
||||
nginx3:
|
||||
image: nginx
|
||||
environment:
|
||||
- HOSTNAME=m
|
||||
|
||||
nginx4:
|
||||
image: nginx
|
||||
environment:
|
||||
- HOSTNAME=m
|
Loading…
Reference in New Issue