restructured ansible-office repo

This commit is contained in:
2024-12-04 10:47:12 +01:00
parent 35892aec74
commit 0bb7ecbbc0
17 changed files with 20 additions and 123 deletions

View File

@@ -0,0 +1,35 @@
- name: Set hostname
ansible.builtin.hostname:
name: "{{ hostname }}"
- name: "Enable recommended Apache Modules."
apache2_module: "name={{ item }} state=present"
with_items:
- dir
- env
- headers
- mime
- rewrite
- setenvif
notify: restart apache
- name: Add Apache virtualhost for Owncloud
template:
src: "templates/owncloud.dav.conf.j2"
dest: "/etc/apache2/sites-available/owncloud.dav.conf"
owner: root
group: root
mode: 0644
notify: restart apache
- name: Enable the ownCloud site.
command: >
a2ensite owncloud.dav
creates=/etc/apache2/sites-enabled/owncloud.dav.conf
notify: restart apache
- name: Disable the default site.
command: >
a2dissite 000-default
removes=/etc/apache2/sites-enabled/000-default.conf
notify: restart apache

View File

@@ -0,0 +1,65 @@
---
- name: Get software for apt repository management.
apt:
state: present
name:
- python3-apt
- python3-pycurl
- python3-pymysql
- name: Add ondrej repository for later versions of PHP.
apt_repository:
repo: "ppa:ondrej/php"
update_cache: yes
- name: "Install Apache, MySQL, PHP, and other dependencies."
apt:
state: present
name:
- acl
- git
- curl
- wget
- unzip
- openssl
- redis-server
- mariadb-server
- libpcre3-dev
- apache2
- libapache2-mod-php7.4
- php7.4
- php7.4-imagick
- php7.4-common
- php7.4-curl
- php7.4-gd
- php7.4-imap
- php7.4-intl
- php7.4-json
- php7.4-mbstring
- php7.4-gmp
- php7.4-bcmath
- php7.4-mysql
- php7.4-ssh2
- php7.4-xml
- php7.4-zip
- php7.4-apcu
- php7.4-redis
- php7.4-ldap
- php7.4-smbclient
- php-phpseclib
- bzip2
- rsync
- jq
- inetutils-ping
- ldap-utils
- smbclient
- cron
#- name: Disable the firewall (since this is behind a firewall)
# service: name=ufw state=stopped
- name: "Start Apache, MySQL, and PHP."
service: "name={{ item }} state=started enabled=yes"
with_items:
- apache2
- mysql

16
roles/lamp/tasks/main.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- name: Install LAMP stack dependencies
include_tasks:
file: dependencies.yml
- name: Configure Apache.
include_tasks:
file: apache.yml
- name: Configure PHP.
include_tasks:
file: php.yml
- name: Configure MySQL.
include_tasks:
file: mysql.yml

View File

@@ -0,0 +1,16 @@
- name: Create a MySQL database for ownCloud.
community.mysql.mysql_db:
name: owncloud
state: present
login_unix_socket: /run/mysqld/mysqld.sock
- name: Create a MySQL db user for ownCloud.
community.mysql.mysql_user:
name: "owncloud"
password: "{{ mysql_passwd }}"
login_user: "root"
login_password: "{{ mysql_passwd }}"
priv: "owncloud.*:ALL"
host: localhost
state: present
login_unix_socket: /run/mysqld/mysqld.sock

16
roles/lamp/tasks/php.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- name: Adjust OpCache memory setting.
lineinfile:
dest: "/etc/php/7.4/apache2/conf.d/10-opcache.ini"
regexp: "^opcache.memory_consumption"
line: "opcache.memory_consumption = 96"
state: present
notify: restart apache
- name: Adjust smbclient setting.
template:
src: "templates/smbclient.ini.j2"
dest: "/etc/php/7.4/mods-available/smbclient.ini"
owner: root
group: root
notify: restart apache