diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..dd59c73 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,3 @@ +--- +php_sapi: fpm +php_modules: [] diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..6a37cd1 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart php-fpm + systemd_service: + name: php{{ php_version }}-fpm + state: restarted diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..b5054da --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,20 @@ +--- +- name: php | installing php and modules + apt: + name: + - php{{ php_version }}-fpm + - php{{ php_version }}-common + - php{{ php_version }}-cli + - php{{ php_version }}-curl + - php{{ php_version }}-opcache + state: present + notify: + - restart php-fpm + +- name: php | install extra modules + apt: + name: '{{ php_modules | list }}' + state: present + force: yes + notify: + - restart php-fpm diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..d7c04e9 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: php | requirements + include_tasks: requirements.yml + +- name: php | installation + include_tasks: install.yml diff --git a/tasks/requirements.yml b/tasks/requirements.yml new file mode 100644 index 0000000..4768733 --- /dev/null +++ b/tasks/requirements.yml @@ -0,0 +1,26 @@ +--- +- name: php | apt update cache + apt: + update_cache: yes + cache_valid_time: 86400 + +- name: php | install requirements + apt: + name: + - apt-transport-https + - lsb-release + - ca-certificates + - curl + state: present + +- name: php | add sury key + apt_key: + url: https://packages.sury.org/php/apt.gpg + keyring: /etc/apt/trusted.gpg.d/php.gpg + state: present + +- name: php | add sury repository + apt_repository: + repo: deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main + state: present + filename: php-sury