Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions drupal/provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

pre_tasks:
- name: Update apt cache if needed.
apt: update_cache=yes cache_valid_time=3600
apt: update_cache=yes cache_valid_time=10

handlers:
- name: restart apache
Expand All @@ -21,8 +21,6 @@
- python3-apt
- python3-pycurl

- 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:
Expand All @@ -34,25 +32,22 @@
- unzip
- sendmail
- apache2
- php8.2-common
- php8.2-cli
- php8.2-dev
- php8.2-gd
- php8.2-curl
- php8.2-opcache
- php8.2-xml
- php8.2-mbstring
- php8.2-pdo
- php8.2-mysql
- php8.2-apcu
- php8.3
- php8.3-cli
- php8.3-dev
- php8.3-gd
- php8.3-curl
- php8.3-opcache
- php8.3-xml
- php8.3-mbstring
- php8.3-pdo
- php8.3-mysql
- php8.3-apcu
- libpcre3-dev
- libapache2-mod-php8.2
- libapache2-mod-php8.3
- python3-mysqldb
- mysql-server

- name: Disable the firewall (since this is for local dev only).
service: name=ufw state=stopped

- name: "Start Apache, MySQL, and PHP."
service: "name={{ item }} state=started enabled=yes"
with_items:
Expand Down Expand Up @@ -86,21 +81,24 @@

- name: Adjust OpCache memory setting.
lineinfile:
dest: "/etc/php/8.2/apache2/conf.d/10-opcache.ini"
dest: "/etc/php/8.3/apache2/conf.d/10-opcache.ini"
regexp: "^opcache.memory_consumption"
line: "opcache.memory_consumption = 96"
state: present
notify: restart apache

- name: Create a MySQL database for Drupal.
mysql_db: "db={{ domain }} state=present"
community.mysql.mysql_db:
name: "{{ domain }}"
state: present

- name: Create a MySQL user for Drupal.
mysql_user:
community.mysql.mysql_user:
name: "{{ domain }}"
password: "1234"
priv: "{{ domain }}.*:ALL"
host: localhost
column_case_sensitive: true
state: present

- name: Download Composer installer.
Expand All @@ -127,6 +125,14 @@
owner: www-data
group: www-data

- name: Set file ownership
file:
path: /var/www
owner: www-data
group: www-data
mode: "0774"
recurse: yes

- name: Check if Drupal project already exists.
stat:
path: "{{ drupal_core_path }}/composer.json"
Expand All @@ -144,14 +150,14 @@
- name: Add drush to the Drupal site with Composer.
composer:
command: require
arguments: drush/drush:11.*
arguments: drush/drush:13.* -W
working_dir: "{{ drupal_core_path }}"
become_user: www-data
when: not drupal_composer_json.stat.exists

- name: Install Drupal.
command: >
vendor/bin/drush si -y --site-name="{{ drupal_site_name }}"
"{{ drupal_core_path }}/vendor/bin/drush" si -y --site-name="{{ drupal_site_name }}"
--account-name=admin
--account-pass=admin
--db-url=mysql://{{ domain }}:1234@localhost/{{ domain }}
Expand Down
Loading