Move all files to deploying-php-ansible-ansistrano/demo/

This commit is contained in:
Oliver Davies 2025-10-03 22:04:20 +01:00
parent 986ba5097d
commit ad3af7d318
214 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,24 @@
---
- hosts: webservers
become: true
roles:
- ansistrano.deploy
vars_files:
- vars/provision_vault.yml
- vars/deploy_vault.yml
- vars/vars.yml
- vars/provision_vars.yml
- vars/deploy_vars.yml
vars:
ansistrano_deploy_via: "rsync"
ansistrano_deploy_from: "{{ playbook_dir }}/../../"
ansistrano_deploy_to: "{{ project_deploy_path }}"
ansistrano_keep_releases: 5
ansistrano_after_symlink_shared_tasks_file: "{{ playbook_dir }}/deploy/after-symlink-shared.yml"
ansistrano_after_symlink_tasks_file: "{{ playbook_dir }}/deploy/after-symlink.yml"
ansistrano_after_update_code_tasks_file: "{{ playbook_dir }}/deploy/after-update-code.yml"
ansistrano_shared_paths:
- "{{ project_web_root }}/sites/default/files"

View file

@ -0,0 +1,41 @@
---
- name: Install Drupal
command: >
{{ release_drush_path }}
site-install -y
--account-pass=admin123
--existing-config
chdir={{ release_drupal_path }}
when: drupal_install|bool
- name: Post-update tasks
when: not drupal_install|bool
block:
- name: Clear Drush cache
command: >
{{ release_drush_path }}
cache-clear drush
chdir={{ release_drupal_path }}
changed_when: false
- name: Run database updates
command: >
{{ release_drush_path }}
updatedb -y
chdir={{ release_drupal_path }}
register: update_database_output
changed_when: "'No pending updates' not in update_database_output.stderr"
- name: Import configuration
command: >
{{ release_drush_path }}
config-import -y
chdir={{ release_drupal_path }}
register: config_import_output
changed_when: "'There are no changes to import' not in config_import_output.stderr"
- name: Rebuild cache
command: >
{{ release_drush_path }} cache-rebuild
chdir={{ release_drupal_path }}
changed_when: false

View file

@ -0,0 +1,22 @@
---
- name: Update directory permissions
file:
path: '{{ item.path }}'
mode: '{{ item.mode }}'
state: directory
owner: vagrant
group: www-data
recurse: true
loop:
- path: '{{ release_drupal_path }}'
mode: u=rwX,g=rX,o=
- path: '{{ ansistrano_shared_path }}/{{ project_web_root }}/sites/default/files'
mode: ug=rwX,o=
- name: Update file permissions
file:
path: '{{ release_drupal_path }}/sites/default/settings.php'
mode: ug=r,o=
state: file
owner: vagrant
group: www-data

View file

@ -0,0 +1,10 @@
---
- name: Install Composer dependencies
composer:
command: install
optimize_autoloader: true
working_dir: '{{ ansistrano_release_path.stdout }}'
- name: Generate settings.php file
include_role:
name: opdavies.drupal_settings_files

View file

@ -0,0 +1,7 @@
all:
children:
webservers:
hosts:
192.168.33.10:
vars:
ansible_ssh_port: 22

View file

@ -0,0 +1,3 @@
---
- import_playbook: provision.yml
- import_playbook: deploy.yml

View file

@ -0,0 +1,41 @@
---
- hosts: webservers
name: Provision the webserver machines
become: true
roles:
- role: geerlingguy.apache
tags: [web]
- role: geerlingguy.mysql
tags: [mysql]
- role: geerlingguy.php-versions
tags: [php]
- role: geerlingguy.php
tags: [php]
- role: geerlingguy.php-mysql
tags: [php, mysql]
- role: geerlingguy.composer
tags: [php, composer]
vars_files:
- vars/provision_vault.yml
- vars/vars.yml
- vars/provision_vars.yml
tasks:
- name: Install base packages
apt:
name: [zip]
state: present
- name: Create a database
mysql_db:
name: '{{ database_name }}'
state: present
- name: Add the database user
mysql_user:
name: '{{ database_user }}'
password: '{{ database_password }}'
priv: '*.*:ALL'
state: present

View file

@ -0,0 +1,19 @@
---
- src: ansistrano.deploy
version: 3.0.1
- src: ansistrano.rollback
version: 3.0.0
- src: geerlingguy.apache
version: 3.0.3
- src: geerlingguy.composer
version: 1.7.3
- src: geerlingguy.mysql
version: 2.9.4
- src: geerlingguy.php
version: 3.7.0
- src: geerlingguy.php-versions
version: 4.0.2
- src: geerlingguy.php-mysql
version: 2.0.2
- src: opdavies.drupal_settings_files
version: 0.1.0

View file

@ -0,0 +1,12 @@
---
- hosts: webservers
become: true
roles:
- ansistrano.rollback
vars_files:
- vars/vars.yml
vars:
ansistrano_deploy_to: "{{ project_deploy_path }}"

View file

@ -0,0 +1,33 @@
---
ansistrano_allow_anonymous_stats: false
ansistrano_keep_releases: 5
release_drupal_path: "{{ ansistrano_release_path.stdout }}/{{ project_web_root }}"
release_drush_path: "{{ ansistrano_release_path.stdout }}/vendor/bin/drush"
drupal_hash_salt: "{{ vault_drupal_hash_salt }}"
drupal_install: true
drupal_settings:
- drupal_root: '{{ release_drupal_path }}'
sites:
- name: default
settings:
databases:
default:
default:
driver: mysql
host: localhost
database: '{{ database_name }}'
username: '{{ database_user }}'
password: '{{ database_password }}'
hash_salt: '{{ drupal_hash_salt }}'
config_directories:
sync: ../config/sync
trusted_hosts:
- '^dransible$'
extra_parameters: |
$settings['config_sync_directory'] = '../config/sync';
$settings['deployment_identifier'] = '{{ ansistrano_release_version }}';
# $config['system.site']['name'] = 'oliverdavies.uk';

View file

@ -0,0 +1,8 @@
$ANSIBLE_VAULT;1.1;AES256
63363266373530336436636134303937346137343366386262323765646537383663373161323336
3065313765623837336136643331306130356536386237310a643963343462346537313136626663
66303764343130313865336466316233636466613132653733666231363533653033303132306438
3438616165386537310a646233393236643638346236356235656433656266653663333035356263
39643535633261366330643961643865623030383832653339636164646335626464343836303638
36306262303434623062643362613161313161373536313034623763373236613231373733333531
323232333963356133633064306539656465

View file

@ -0,0 +1,11 @@
---
server_document_root: '{{ project_deploy_path }}/{{ ansistrano_current_dir }}/{{ project_web_root }}'
apache_vhosts:
- servername: dransible
documentroot: '{{ server_document_root }}'
php_version: '7.4'
php_packages_extra:
- libapache2-mod-php{{ php_version }}
- libpcre3-dev

View file

@ -0,0 +1,10 @@
$ANSIBLE_VAULT;1.1;AES256
33373134393232666463613136333836646334376361306630643432373161373363306433633932
6637626266313264303734353136376439633939653837390a613631306563666663313361623136
33383463333062643331376530393964356161346164336434346366333061373166636531336436
3862316230366364630a616437356235626536376562303738653633316364353034636432666266
33346639373931396237333636656637663861386530373965323037633636373330353061666465
35313539343165643564376335303334353662346130343330343238623139386665363864386530
30633562396666633464666565626437343039636136653032323035333662666664656162326539
37363233646463363132343835656137343139613535323237346162636363396162343038303062
3132

View file

@ -0,0 +1,9 @@
---
ansistrano_current_dir: current
database_name: "{{ vault_database_name }}"
database_password: "{{ vault_database_password }}"
database_user: "{{ vault_database_user }}"
project_deploy_path: /app
project_web_root: web

View file

@ -0,0 +1 @@
dransible