cleaning and testing ok

This commit is contained in:
kinou-p 2024-04-29 05:16:30 +02:00
parent e823d1db79
commit f3af7a46d7
3 changed files with 24 additions and 45 deletions

5
clean.sh Normal file
View File

@ -0,0 +1,5 @@
docker-compose -f ./docker-compose.yml down
docker rm $(docker ps -qa)
# docker rmi -f $(docker images -qa)
docker volume rm $(docker volume ls -q)
docker network rm $(docker network ls -q)

View File

@ -1,4 +1,2 @@
[myhosts] [myhosts]
37.114.41.144 ansible_ssh_user=root 37.114.41.144 ansible_ssh_user=root
; 192.168.1.119:2222 ansible_ssh_user=server_user
; 192.168.1.119:2223 ansible_ssh_user=server_user

View File

@ -1,8 +1,6 @@
# --- # ---
- name: Deploy WordPress - name: Deploy WordPress
hosts: myhosts hosts: myhosts
# remote_user: root # Change remote user to your sudo user!
# become: true
vars: vars:
arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names
x86_64: amd64 x86_64: amd64
@ -10,6 +8,22 @@
tasks: tasks:
- name: Update and upgrade all packages to the latest version
ansible.builtin.apt:
update_cache: true
upgrade: dist
cache_valid_time: 3600
- name: Install required packages
ansible.builtin.apt:
pkg:
- rsync
- python3-pip
- apt-transport-https
- ca-certificates
- curl
- gnupg
- name: Create src directory if it does not exist - name: Create src directory if it does not exist
ansible.builtin.file: ansible.builtin.file:
path: ./src path: ./src
@ -21,21 +35,6 @@
src: ./ # Specify the source folder on the control node src: ./ # Specify the source folder on the control node
dest: src/ # Specify the destination folder on the target node dest: src/ # Specify the destination folder on the target node
- name: Update and upgrade all packages to the latest version
ansible.builtin.apt:
update_cache: true
upgrade: dist
cache_valid_time: 3600
- name: Install required packages
ansible.builtin.apt:
pkg:
- python3-pip
- apt-transport-https
- ca-certificates
- curl
- gnupg
# - software-properties-commo
- name: Create directory for Docker's GPG key - name: Create directory for Docker's GPG key
ansible.builtin.file: ansible.builtin.file:
path: /etc/apt/keyrings path: /etc/apt/keyrings
@ -60,10 +59,6 @@
https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
filename: docker filename: docker
state: present state: present
# - name: Add Docker repository
# apt_repository:
# repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
# state: present
- name: Install Docker and related packages - name: Install Docker and related packages
ansible.builtin.apt: ansible.builtin.apt:
@ -93,10 +88,6 @@
pkg: pkg:
- python3-docker - python3-docker
# - name: Install Docker Module for Python
# ansible.builtin.shell:
# cmd: pip3 install docker
- name: Enable and start Docker services - name: Enable and start Docker services
ansible.builtin.systemd: ansible.builtin.systemd:
name: "{{ item }}" name: "{{ item }}"
@ -115,20 +106,5 @@
- name: Launch Docker Compose project - name: Launch Docker Compose project
ansible.builtin.shell: ansible.builtin.shell:
cmd: docker-compose up cmd: docker-compose up -d
chdir: src/ chdir: src/
# - name: Copy Docker Compose file
# copy:
# src: ./
# dest: src/
# - name: Launch Docker Compose project
# ansible.builtin.shell:
# cmd: docker-compose up
# chdir: src/
# - name: Launch Docker Compose project
# docker_compose:
# project_src: src/
# state: present