This commit is contained in:
David Petric 2023-03-27 16:13:41 +02:00
parent a53d25caa9
commit 2d6606c0a4
11 changed files with 2094 additions and 0 deletions

6
TODO Normal file
View File

@ -0,0 +1,6 @@
Docker
Redis
Mysql
integration into wpconf
wordpress download and config

7
ansible.cfg Normal file
View File

@ -0,0 +1,7 @@
[defaults]
host_key_checking = False
timeout = 3000
roles_path = /roles
[ssh_connection]
retries = 2

2
inventory/target.ini Normal file
View File

@ -0,0 +1,2 @@
[main]
xyz.com ansible_connection=ssh ansible_ssh_port=22 ansible_ssh_user=user

View File

@ -0,0 +1,17 @@
---
- name: Prepare config file
copy:
src: files/web-{{ vhost_name }}.conf
dest: /etc/nginx/sites-available/web-{{ vhost_name }}.conf
- name: Create a symbolic link
file:
src: /etc/nginx/sites-available/web-{{ vhost_name }}.conf
dest: /etc/nginx/sites-enabled/web-{{ vhost_name }}.conf
- name: Restart Nginx
systemd:
name: nginx
daemon_reload: yes
enabled: yes
state: started

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
---
- name: PHP ini setup
copy:
src: files/php{{ php_version }}.ini
dest: /etc/php/{{ php_version }}/cli/php.ini
- name: Increase PHP memory limit
become: true
lineinfile:
dest: /etc/php/{{ php_version }}/cli/php.ini
regexp: "memory_limit ="
line: "memory_limit = 512M"
- name: Increase PHP upload time
become: true
lineinfile:
dest: /etc/php/{{ php_version }}/cli/php.ini
regexp: "max_input_time ="
line: "max_input_time = 120"
- name: Increase PHP post size
become: true
lineinfile:
dest: /etc/php/{{ php_version }}/cli/php.ini
regexp: "post_max_size ="
line: "post_max_size = 20M"
- name: Start PHP
systemd:
name: "{{ item }}"
daemon_reload: yes
enabled: yes
state: started

View File

@ -0,0 +1,15 @@
---
- name: Install Nginx
apt:
pkg:
- nginx
- certbot
- python3-certbot-nginx
- name: Enable Nginx service
systemd:
name: nginx
daemon_reload: yes
enabled: yes
state: started

View File

@ -0,0 +1,26 @@
---
- name: Install prerequisites
apt:
pkg:
- lsb-release
- ca-certificates
- apt-transport-https
- software-properties-common
- name: Add repository
shell: add-apt-repository ppa:ondrej/php -y
- name: Install PHP
apt:
pkg:
- php{{ php_version }}
- php{{ php_version }}-cli
- php{{ php_version }}-curl
- php{{ php_version }}-mysql
- php{{ php_version }}-fpm
- php{{ php_version }}-gd
- php{{ php_version }}-xml
- php{{ php_version }}-mbstring
- php{{ php_version }}-zip
- php{{ php_version }}-soap
- php{{ php_version }}-dev

View File

@ -0,0 +1,5 @@
---
- name: Update system packages
apt:
name: '*'
state: latest

13
setup_server.yml Normal file
View File

@ -0,0 +1,13 @@
---
- hosts: all
vars_files:
- /vars/external.yml
become: yes
become_user: root
gather_facts: true
roles:
- role: update-packages
- role: install-nginx
- role: configure-nginx
- role: install-php
- role: configure-php

4
vars/external.yml Normal file
View File

@ -0,0 +1,4 @@
---
php_version: 8.1
password: magic
vhost_name: projectwp