Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: Check for existing APCu config files.
|
||||
find:
|
||||
paths: "{{ item }}"
|
||||
contains: 'extension(\s+)?=(\s+)?apc[u]?\.so'
|
||||
register: php_installed_apc_confs
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
|
||||
- name: Remove any non-role-supplied APCu config files.
|
||||
file:
|
||||
path: "{{ item.1.path }}"
|
||||
state: absent
|
||||
when: php_apc_conf_filename != (item.1.path.split('/') | last)
|
||||
with_subelements:
|
||||
- "{{ php_installed_apc_confs.results }}"
|
||||
- files
|
||||
notify: restart webserver
|
||||
|
||||
- name: Ensure APCu config file is present.
|
||||
template:
|
||||
src: apc.ini.j2
|
||||
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||
owner: root
|
||||
group: root
|
||||
force: yes
|
||||
mode: 0644
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_enable_apc
|
||||
notify: restart webserver
|
||||
|
||||
- name: Remove APCu config file if APC is disabled.
|
||||
file:
|
||||
path: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: not php_enable_apc
|
||||
notify: restart webserver
|
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
- name: Define php_fpm_daemon.
|
||||
set_fact:
|
||||
php_fpm_daemon: "{{ __php_fpm_daemon }}"
|
||||
when: php_fpm_daemon is not defined
|
||||
|
||||
- name: Define php_fpm_pool_conf_path.
|
||||
set_fact:
|
||||
php_fpm_pool_conf_path: "{{ __php_fpm_pool_conf_path }}"
|
||||
when: php_fpm_pool_conf_path is not defined
|
||||
|
||||
- name: Define php_fpm_pool_user.
|
||||
set_fact:
|
||||
php_fpm_pool_user: "{{ __php_fpm_pool_user }}"
|
||||
when: php_fpm_pool_user is not defined
|
||||
|
||||
- name: Define php_fpm_pool_group.
|
||||
set_fact:
|
||||
php_fpm_pool_group: "{{ __php_fpm_pool_group }}"
|
||||
when: php_fpm_pool_group is not defined
|
||||
|
||||
- name: Stat php_fpm_pool_conf_path
|
||||
stat:
|
||||
path: "{{ php_fpm_pool_conf_path | dirname }}"
|
||||
register: php_fpm_pool_conf_path_dir_stat
|
||||
|
||||
- name: Ensure the default pool directory exists.
|
||||
file:
|
||||
path: "{{ php_fpm_pool_conf_path | dirname }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined
|
||||
|
||||
- name: Ensure the default pool exists.
|
||||
template:
|
||||
src: www.conf.j2
|
||||
dest: "{{ php_fpm_pool_conf_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: no
|
||||
when: php_enable_php_fpm
|
||||
|
||||
- name: Configure php-fpm pool (if enabled).
|
||||
lineinfile:
|
||||
dest: "{{ php_fpm_pool_conf_path }}"
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: "^user.?=.+$"
|
||||
line: "user = {{ php_fpm_pool_user }}"
|
||||
- regexp: "^group.?=.+$"
|
||||
line: "group = {{ php_fpm_pool_group }}"
|
||||
- regexp: "^listen.?=.+$"
|
||||
line: "listen = {{ php_fpm_listen }}"
|
||||
- regexp: '^listen\.allowed_clients.?=.+$'
|
||||
line: "listen.allowed_clients = {{ php_fpm_listen_allowed_clients }}"
|
||||
- regexp: '^pm\.max_children.?=.+$'
|
||||
line: "pm.max_children = {{ php_fpm_pm_max_children }}"
|
||||
- regexp: '^pm\.start_servers.?=.+$'
|
||||
line: "pm.start_servers = {{ php_fpm_pm_start_servers }}"
|
||||
- regexp: '^pm\.min_spare_servers.?=.+$'
|
||||
line: "pm.min_spare_servers = {{ php_fpm_pm_min_spare_servers }}"
|
||||
- regexp: '^pm\.max_spare_servers.?=.+$'
|
||||
line: "pm.max_spare_servers = {{ php_fpm_pm_max_spare_servers }}"
|
||||
when: php_enable_php_fpm
|
||||
notify: restart php-fpm
|
||||
|
||||
- name: Ensure php-fpm is started and enabled at boot (if configured).
|
||||
service:
|
||||
name: "{{ php_fpm_daemon }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
when: php_enable_php_fpm and ansible_distribution != "Debian"
|
||||
|
||||
# See: https://github.com/ansible/ansible/issues/22303
|
||||
- name: Ensure php-fpm is started and enabled at boot (if configured, Debian).
|
||||
service:
|
||||
name: "{{ php_fpm_daemon }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
use: service
|
||||
when: php_enable_php_fpm and ansible_distribution == "Debian"
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: Check for existing OpCache config files.
|
||||
find:
|
||||
paths: "{{ item }}"
|
||||
contains: 'zend_extension(\s+)?=(\s+)?opcache\.so'
|
||||
register: php_installed_opcache_confs
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
|
||||
- name: Remove any non-role-supplied OpCache config files.
|
||||
file:
|
||||
path: "{{ item.1.path }}"
|
||||
state: absent
|
||||
when: php_opcache_conf_filename != (item.1.path.split('/') | last)
|
||||
with_subelements:
|
||||
- "{{ php_installed_opcache_confs.results }}"
|
||||
- files
|
||||
notify: restart webserver
|
||||
|
||||
- name: Ensure OpCache config file is present.
|
||||
template:
|
||||
src: opcache.ini.j2
|
||||
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||
owner: root
|
||||
group: root
|
||||
force: yes
|
||||
mode: 0644
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_opcache_enable
|
||||
notify: restart webserver
|
||||
|
||||
- name: Remove OpCache config file if OpCache is disabled.
|
||||
file:
|
||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: not php_opcache_enable
|
||||
notify: restart webserver
|
20
box/provisioning/roles/geerlingguy.php/tasks/configure.yml
Normal file
20
box/provisioning/roles/geerlingguy.php/tasks/configure.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- name: Ensure configuration directories exist.
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
follow: true
|
||||
with_flattened:
|
||||
- "{{ php_conf_paths }}"
|
||||
- "{{ php_extension_conf_paths }}"
|
||||
|
||||
- name: Place PHP configuration file in place.
|
||||
template:
|
||||
src: php.ini.j2
|
||||
dest: "{{ item }}/php.ini"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
with_items: "{{ php_conf_paths }}"
|
||||
notify: restart webserver
|
||||
when: php_use_managed_ini
|
|
@ -0,0 +1,150 @@
|
|||
---
|
||||
- name: Ensure dependencies for building from source are installed (RedHat).
|
||||
package: "name={{ item }} state=installed"
|
||||
with_items:
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- bison
|
||||
- make
|
||||
- curl-devel
|
||||
- recode-devel
|
||||
- aspell-devel
|
||||
- libxml2-devel
|
||||
- pkgconfig
|
||||
- libmcrypt-devel
|
||||
- t1lib-devel
|
||||
- libXpm-devel
|
||||
- libpng-devel
|
||||
- libjpeg-turbo-devel
|
||||
- bzip2-devel
|
||||
- openssl-devel
|
||||
- freetype-devel
|
||||
- libicu-devel
|
||||
- mariadb-devel
|
||||
- gmp-devel
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Update apt cache (Debian).
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure dependencies for building from source are installed (Debian).
|
||||
apt: "pkg={{ item }} state=installed"
|
||||
with_items:
|
||||
- build-essential
|
||||
- autoconf
|
||||
- automake
|
||||
- libtool
|
||||
- bison
|
||||
- pkg-config
|
||||
- re2c
|
||||
- libxml2-dev
|
||||
- libcurl4-openssl-dev
|
||||
- libbz2-dev
|
||||
- libjpeg-dev
|
||||
- libpng12-dev
|
||||
- libxpm-dev
|
||||
- libfreetype6-dev
|
||||
- libgmp3-dev
|
||||
- libmcrypt-dev
|
||||
- libmysqlclient-dev
|
||||
- libpspell-dev
|
||||
- librecode-dev
|
||||
- libssl-dev
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Define php_fpm_daemon (if not defined already).
|
||||
set_fact:
|
||||
php_fpm_daemon: "php-fpm"
|
||||
when: php_fpm_daemon is not defined
|
||||
|
||||
- name: Check if gmp.h is already in a location accessible to gcc.
|
||||
stat: path=/usr/include/gmp.h
|
||||
register: gmp_file
|
||||
|
||||
- name: Ensure gmp.h is symlinked into a location accessible to gcc.
|
||||
file:
|
||||
src: "{{ php_source_install_gmp_path }}"
|
||||
dest: /usr/include/gmp.h
|
||||
state: link
|
||||
when: gmp_file.stat.exists == false
|
||||
|
||||
- name: Check if PHP is installed.
|
||||
command: which php
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: php_installed
|
||||
|
||||
- name: Clone the PHP repository.
|
||||
git:
|
||||
repo: "{{ php_source_repo }}"
|
||||
dest: "{{ php_source_clone_dir }}"
|
||||
version: "{{ php_source_version }}"
|
||||
accept_hostkey: yes
|
||||
depth: "{{ php_source_clone_depth }}"
|
||||
when: php_installed.rc != 0
|
||||
|
||||
- name: Ensure PHP installation path exists.
|
||||
file:
|
||||
path: "{{ php_source_install_path }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
when: php_installed.rc != 0
|
||||
|
||||
- name: Build configure script.
|
||||
shell: >
|
||||
./buildconf --force
|
||||
chdir={{ php_source_clone_dir }}
|
||||
when: php_installed.rc != 0
|
||||
|
||||
- name: Run configure script.
|
||||
shell: >
|
||||
{{ php_source_configure_command }}
|
||||
chdir={{ php_source_clone_dir }}
|
||||
when: php_installed.rc != 0
|
||||
|
||||
- name: Make and install PHP.
|
||||
shell: >
|
||||
{{ item }}
|
||||
chdir={{ php_source_clone_dir }}
|
||||
with_items:
|
||||
- "{{ php_source_make_command }}"
|
||||
- make install
|
||||
when: php_installed.rc != 0
|
||||
|
||||
- name: Ensure php executable is symlinked into a standard path.
|
||||
file:
|
||||
src: "{{ php_source_install_path }}/bin/php"
|
||||
dest: /usr/bin/php
|
||||
state: link
|
||||
|
||||
# PHP FPM configuration.
|
||||
- name: Ensure php-fpm executable is symlinked into a standard path.
|
||||
file:
|
||||
src: "{{ php_source_install_path }}/sbin/php-fpm"
|
||||
dest: "/usr/sbin/{{ php_fpm_daemon }}"
|
||||
state: link
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
|
||||
- name: Ensure php-fpm init script is installed.
|
||||
template:
|
||||
src: fpm-init.j2
|
||||
dest: "/etc/init.d/{{ php_fpm_daemon }}"
|
||||
mode: 0755
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
notify: restart php-fpm
|
||||
|
||||
- name: Ensure php-fpm config directory exists.
|
||||
file:
|
||||
path: "{{ php_fpm_conf_path }}"
|
||||
state: directory
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
|
||||
- name: Ensure php-fpm config file is installed.
|
||||
template:
|
||||
src: php-fpm.conf.j2
|
||||
dest: "{{ php_fpm_conf_path }}/php-fpm.conf"
|
||||
mode: 0644
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
notify: restart php-fpm
|
73
box/provisioning/roles/geerlingguy.php/tasks/main.yml
Normal file
73
box/provisioning/roles/geerlingguy.php/tasks/main.yml
Normal file
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
# Variable setup.
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Define php_packages.
|
||||
set_fact:
|
||||
php_packages: "{{ __php_packages | list }}"
|
||||
when: php_packages is not defined
|
||||
|
||||
- name: Define extra php_packages.
|
||||
set_fact:
|
||||
php_packages: "{{ php_packages | list + php_packages_extra | list }}"
|
||||
when: php_packages_extra is defined
|
||||
|
||||
- name: Define php_webserver_daemon.
|
||||
set_fact:
|
||||
php_webserver_daemon: "{{ __php_webserver_daemon }}"
|
||||
when: php_webserver_daemon is not defined
|
||||
|
||||
- name: Define php_conf_paths.
|
||||
set_fact:
|
||||
php_conf_paths: "{{ __php_conf_paths }}"
|
||||
when: php_conf_paths is not defined
|
||||
|
||||
- name: Define php_extension_conf_paths.
|
||||
set_fact:
|
||||
php_extension_conf_paths: "{{ __php_extension_conf_paths }}"
|
||||
when: php_extension_conf_paths is not defined
|
||||
|
||||
- name: Define php_apc_conf_filename.
|
||||
set_fact:
|
||||
php_apc_conf_filename: "{{ __php_apc_conf_filename }}"
|
||||
when: php_apc_conf_filename is not defined
|
||||
|
||||
- name: Define php_opcache_conf_filename (Ubuntu 16.04).
|
||||
set_fact:
|
||||
php_opcache_conf_filename: "10-opcache.ini"
|
||||
when: php_opcache_conf_filename is not defined and ansible_distribution_version == "16.04"
|
||||
|
||||
- name: Define php_opcache_conf_filename.
|
||||
set_fact:
|
||||
php_opcache_conf_filename: "{{ __php_opcache_conf_filename }}"
|
||||
when: php_opcache_conf_filename is not defined
|
||||
|
||||
- name: Define php_fpm_conf_path.
|
||||
set_fact:
|
||||
php_fpm_conf_path: "{{ __php_fpm_conf_path }}"
|
||||
when: php_fpm_conf_path is not defined
|
||||
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: (php_install_from_source == false) and (ansible_os_family == 'RedHat')
|
||||
static: no
|
||||
|
||||
- include: setup-Debian.yml
|
||||
when: (php_install_from_source == false) and (ansible_os_family == 'Debian')
|
||||
static: no
|
||||
|
||||
# Install PHP from source when php_install_from_source is true.
|
||||
- include: install-from-source.yml
|
||||
when: php_install_from_source == true
|
||||
static: no
|
||||
|
||||
# Configure PHP.
|
||||
- include: configure.yml
|
||||
static: no
|
||||
- include: configure-apcu.yml
|
||||
static: no
|
||||
- include: configure-opcache.yml
|
||||
static: no
|
||||
- include: configure-fpm.yml
|
||||
static: no
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
|
||||
- name: Ensure PHP packages are installed.
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: "{{ php_packages_state }}"
|
||||
install_recommends: "{{ php_install_recommends }}"
|
||||
with_items: "{{ php_packages }}"
|
||||
register: php_package_install
|
||||
notify: restart webserver
|
||||
|
||||
- name: Delete APCu configuration file if this role will provide one.
|
||||
file:
|
||||
path: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_enable_apc and php_package_install.changed
|
||||
notify: restart webserver
|
||||
|
||||
- name: Delete OpCache configuration file if this role will provide one.
|
||||
file:
|
||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_opcache_enable and php_package_install.changed
|
||||
notify: restart webserver
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- name: Ensure PHP packages are installed.
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ php_packages_state }}"
|
||||
enablerepo: "{{ php_enablerepo }}"
|
||||
with_items: "{{ php_packages }}"
|
||||
notify: restart webserver
|
Loading…
Add table
Add a link
Reference in a new issue