Skip to content

Instantly share code, notes, and snippets.

@MACscr
Created September 19, 2019 10:20
Show Gist options
  • Save MACscr/2caf0c9c6c785e8f3fc18214921d7bee to your computer and use it in GitHub Desktop.
Save MACscr/2caf0c9c6c785e8f3fc18214921d7bee to your computer and use it in GitHub Desktop.
initial php playbook attempt for apnscp's php-fpm. incomplete.
# apnscp php
- hosts: apnscp
tasks:
- name: set php-fpm to use by default with new accounts
shell: cpcmd scope:set apnscp.config httpd use_fpm true
- name: 01-imagick.ini check
file:
path: /home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc/php72.d/01-imagick.ini
state: touch
register: imagick_ini
- name: install imagick
shell: ansible-playbook --tags=php/install-pecl-module --extra-vars 'pecl_extensions="imagick"' bootstrap.yml
args:
chdir: /usr/local/apnscp/resources/playbooks/
when: imagick_ini.changed
- name: check if any sites exist
find:
paths: /home/virtual
patterns: "site*"
ignore_errors: True
register: site_check
when: imagick_ini.changed
- name: Regenerate PHP-FPM configuration for each account
shell: for i in site[0-9]* ; do EditDomain -c apache,jail=1 $i;done
args:
chdir: /home/virtual
when: site_check.matched
- name: Copy imagick.so
copy:
src: /usr/lib64/20170718-zts/imagick.so
dest: /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib64/20170718-zts/imagick.so
remote_src: yes
- name: Set 01-imagick.ini
lineinfile:
dest: /home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc/php72.d/01-imagick.ini
line: extension=imagick.so
- name: reload service fsmount
systemd:
name: fsmount
state: reloaded
when: imagick_ini.changed
- name: reload service php-fpm
systemd:
name: php-fpm
state: restarted
when: imagick_ini.changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment