initial ansible code
This commit is contained in:
29
roles/php/tasks/main.yml
Normal file
29
roles/php/tasks/main.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- name: Add Sury PHP Repository
|
||||
apt_repository:
|
||||
repo: ppa:ondrej/php
|
||||
state: present
|
||||
update_cache: true
|
||||
when: php_version is defined # add repo when version is specified, otherwise use default repo
|
||||
|
||||
- name: "Uninstall old PHP version"
|
||||
apt:
|
||||
name: "php{{ php_old_version }}*"
|
||||
state: absent
|
||||
purge: true
|
||||
when: php_old_version is defined # uninstall when old version is specified
|
||||
|
||||
- name: "Install custom PHP modules {{ php_modules }}"
|
||||
apt:
|
||||
name: "{{ ['php' + php_version] | product(php_modules) | map('join', '-') | list }}"
|
||||
state: latest
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Copy Nginx PHP-Handler
|
||||
template:
|
||||
dest: /etc/nginx/conf.d/php-handler.conf
|
||||
src: php-handler.conf.j2
|
||||
mode: 0644
|
||||
when: '"fpm" in php_modules'
|
||||
notify: reload nginx
|
||||
Reference in New Issue
Block a user