alicante-infra/roles/webmin_lamp/tasks/main.yml

96 lines
2.0 KiB
YAML

---
- name: Añadir repositorio SURY para PHP multiversión
shell: |
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update
args:
creates: /etc/apt/sources.list.d/php.list
- name: Instalar Apache2
apt:
name:
- apache2
- libapache2-mod-fcgid
state: present
- name: Instalar PHP 8.1, 8.2 y 8.3
apt:
name:
- php8.1
- php8.1-fpm
- php8.1-mysql
- php8.1-pgsql
- php8.1-gd
- php8.1-mbstring
- php8.1-xml
- php8.1-zip
- php8.1-intl
- php8.1-curl
- php8.2
- php8.2-fpm
- php8.2-mysql
- php8.2-pgsql
- php8.2-gd
- php8.2-mbstring
- php8.2-xml
- php8.2-zip
- php8.2-intl
- php8.2-curl
- php8.3
- php8.3-fpm
- php8.3-mysql
- php8.3-pgsql
- php8.3-gd
- php8.3-mbstring
- php8.3-xml
- php8.3-zip
- php8.3-intl
- php8.3-curl
- php8.3-apcu
- php8.3-redis
state: present
- name: Instalar dependencias Python para Ansible
apt:
name:
- python3-psycopg2
- python3-pymysql
state: present
- name: Habilitar módulos Apache necesarios
apache2_module:
name: "{{ item }}"
state: present
loop:
- rewrite
- proxy
- proxy_fcgi
- setenvif
notify: restart apache2
- name: Instalar Redis Server
apt:
name: redis-server
state: present
- name: Configurar puertos adicionales en Apache
lineinfile:
path: /etc/apache2/ports.conf
line: "Listen {{ item }}"
create: yes
loop:
- "{{ ports.nextcloud }}"
- "{{ ports.joomla }}"
- "{{ ports.dolibarr }}"
notify: restart apache2
- name: Iniciar y habilitar servicios
service:
name: "{{ item }}"
state: started
enabled: yes
loop:
- apache2
- redis-server