๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-playbooks/roles/php/tasks/main.yml

62 lines
1.4 KiB

2 years ago
- name: set php configuration
set_fact:
php_cfg: "{{ php_default_config | d({}) | combine(php_config | d({}), recursive=true) }}"
php_fpm_cfg: "{{ php_fpm_default_config | d({}) | combine(php_fpm_config | d({}), recursive=true) }}"
- name: install php
include_tasks: tasks/install_packages.yml
vars:
package: "{{ 'php' ~ php_version }}"
- name: template php config
template:
src: php.j2
dest: "/etc/php{{ php_version }}/conf.d/50_override.ini"
force: yes
mode: 0640
lstrip_blocks: yes
- block:
- name: install php-fpm
include_tasks: tasks/install_packages.yml
vars:
package: "php{{ php_version }}-fpm"
notify: restart php fpm
- name: template php-fpm config
template:
src: fpm.j2
dest: "/etc/php{{ php_version }}/php-fpm.d/{{ php_fpm_listener }}.conf"
force: yes
mode: 0640
lstrip_blocks: yes
notify: restart php fpm
- name: delete www fpm config
file:
path: "/etc/php{{ php_version }}/php-fpm.d/www.conf"
state: absent
- name: flush handlers
meta: flush_handlers
- name: enable and start php-fpm
service:
name: "php-fpm{{ php_version }}"
state: started
enabled: yes
when: php_install_fpm | d(false) == true
- name: add directories to backup plan
include_role:
name: backup
vars:
function: add
backup_items:
- "/etc/php{{ php_version }}"