Skip to content

Commit

Permalink
feat: support suse
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed May 7, 2024
1 parent 51684c4 commit c64e2f1
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
playbook: converge.yml
- distro: debian11
playbook: converge.yml
- distro: opensuseleap15
playbook: converge.yml

# Had some trouble, might fix later.
# - distro: debian11
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*/__pycache__
*.pyc
.cache

.vscode
venv/
13 changes: 13 additions & 0 deletions tasks/configure-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
when: php_enable_php_fpm
notify: restart php-fpm

- name: Create fpm config.
template:
src: "{{ php_fpm_conf_template | default('php-fpm.conf.j2', true) }}"
dest: "{{ php_fpm_conf_path }}/php-fpm.conf"
owner: root
group: root
mode: 0644
force: true
when:
- php_enable_php_fpm
- ansible_os_family == "Suse"
notify: restart php-fpm

- name: Ensure php-fpm is started and enabled at boot (if configured).
service:
name: "{{ php_fpm_daemon }}"
Expand Down
10 changes: 10 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
php_default_version_debian: "{{ __php_default_version_debian }}"
when: php_default_version_debian is not defined and ansible_os_family == 'Debian'

- name: Set the default PHP version for Suse-based OSes.
set_fact:
php_default_version_suse: "{{ __php_default_version_suse }}"
when: php_default_version_debian is not defined and ansible_os_family == 'Suse'

- name: Define the name of the JSON extension package on Debian for PHP <8.
set_fact:
__php_json_package_debian: "{{ 'php' + php_default_version_debian + '-json' }}"
Expand Down Expand Up @@ -76,6 +81,11 @@
- not php_install_from_source
- ansible_os_family == 'Debian'

- include_tasks: setup-Suse.yml
when:
- not php_install_from_source
- ansible_os_family == 'Suse'

# Install PHP from source when php_install_from_source is true.
- include_tasks: install-from-source.yml
when: php_install_from_source
Expand Down
6 changes: 6 additions & 0 deletions tasks/setup-Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Ensure PHP packages are installed.
package:
name: "{{ php_packages + php_packages_extra }}"
state: "{{ php_packages_state }}"
notify: restart webserver
2 changes: 1 addition & 1 deletion templates/php-fpm.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

include={{ php_fpm_conf_path }}/pool.d/*.conf
include={{ __php_fpm_pool_path }}/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
Expand Down
1 change: 1 addition & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ __php_apc_conf_filename: 20-apcu.ini
__php_opcache_conf_filename: 10-opcache.ini
__php_fpm_daemon: php{{ php_default_version_debian }}-fpm
__php_fpm_conf_path: "/etc/php/{{ php_default_version_debian }}/fpm"
__php_fpm_pool_path: "{{ __php_fpm_conf_path }}/pool.d"
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf"

__php_fpm_pool_user: www-data
Expand Down
1 change: 1 addition & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ __php_apc_conf_filename: 50-apc.ini
__php_opcache_conf_filename: 10-opcache.ini
__php_fpm_daemon: php-fpm
__php_fpm_conf_path: "/etc/fpm"
__php_fpm_pool_path: "/etc/php-fpm.d"
__php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf"

__php_fpm_pool_user: apache
Expand Down
35 changes: 35 additions & 0 deletions vars/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
__php_default_version_suse: "81"

__php_packages:
- php{{ php_default_version_suse }}
- php{{ php_default_version_suse }}-APCu
- php{{ php_default_version_suse }}-cli
- php{{ php_default_version_suse }}-devel
- php{{ php_default_version_suse }}-fpm
- php{{ php_default_version_suse }}-gd
- php{{ php_default_version_suse }}-ldap
- php{{ php_default_version_suse }}-mbstring
- php{{ php_default_version_suse }}-opcache
- php{{ php_default_version_suse }}-pdo
- php{{ php_default_version_suse }}-pear
- php{{ php_default_version_suse }}-xmlreader
- php{{ php_default_version_suse }}-xmlwriter
__php_webserver_daemon: "apache2"

__php_conf_paths:
- /etc/php{{ php_default_version_suse | first }}/fpm
- /etc/php{{ php_default_version_suse | first }}/cli

__php_extension_conf_paths:
- /etc/php{{ php_default_version_suse | first }}/conf.d

__php_apc_conf_filename: 50-apc.ini
__php_opcache_conf_filename: 10-opcache.ini
__php_fpm_daemon: php-fpm
__php_fpm_conf_path: "/etc/php{{ php_default_version_suse | first }}/fpm/"
__php_fpm_pool_path: "{{ __php_fpm_conf_path }}/php-fpm.d"
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/php-fpm.d/www.conf"

__php_fpm_pool_user: wwwrun
__php_fpm_pool_group: wwwrun

0 comments on commit c64e2f1

Please sign in to comment.