diff --git a/.ansible/roles/hanxhx.php b/.ansible/roles/hanxhx.php deleted file mode 120000 index 7b0554b..0000000 --- a/.ansible/roles/hanxhx.php +++ /dev/null @@ -1 +0,0 @@ -/home/triplestack/dev/PERSO/ansible-php \ No newline at end of file diff --git a/.gitignore b/.gitignore index e5ba8ab..9865f61 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /.idea /.venv /venv +/.ansible diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1fa6342..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- - -env: - global: - - VAGRANT_VERSION='2.2.18' - jobs: - - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-debian-stretch-php74' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-debian-bullseye-php74' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-debian-bullseye-php80' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-debian-buster-php74' ANSIBLE_VERSION='>=2.11,<2.12' - - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='>=2.11,<2.12' - -os: - - linux -dist: focal - -language: python -python: - - 3.8 - -services: - - docker - -before_install: - - sudo apt-get -q update - - sudo apt-get install -y yamllint - - sudo wget -nv https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb - - sudo dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb - -install: - - sudo pip install "ansible-core$ANSIBLE_VERSION" - - sudo pip install ansible-lint - - ansible-galaxy collection install community.general - -script: - - VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM - - > - VAGRANT_DEFAULT_PROVIDER=docker vagrant provision $PLATFORM - | grep -q 'changed=0.*failed=0' - && (echo 'Idempotence test: pass' && exit 0) - || (echo 'Idempotence test: fail' && exit 1) - - VAGRANT_DEFAULT_PROVIDER=docker vagrant status - - > - yamllint . - && (echo 'YAML lint test: pass' && exit 0) - || (echo 'YAML lint test: fail' && exit 1) - - > - ansible-lint -v tests/test.yml - && (echo 'Ansible lint test: pass' && exit 0) - || (echo 'Ansible lint test: fail' && exit 1) - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 49e1dc4..29fa6b2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Ansible PHP (+FPM) role for Debian / Ubuntu =========================================== -[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-HanXHX.php-blue.svg)](https://galaxy.ansible.com/HanXHX/php) [![Build Status](https://app.travis-ci.com/HanXHX/ansible-php.svg?branch=master)](https://app.travis-ci.com/HanXHX/ansible-php) +[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-hanxhx.php-blue.svg)](https://galaxy.ansible.com/hanxhx.php) ![GitHub Workflow Status (master)](https://img.shields.io/github/actions/workflow/status/hanxhx/ansible-php/molecule.yml?branch=master) Install PHP on Debian / Ubuntu. Manage PHP-FPM, APCu, Opcache and Xdebug. diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml new file mode 100644 index 0000000..2687667 --- /dev/null +++ b/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- + +argument_specs: + main: + short_description: Main entry point + options: {} diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..f212a67 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,4 @@ +--- + +collections: + - community.general diff --git a/tasks/main.yml b/tasks/main.yml index a8f20b0..bf8f5b0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -34,10 +34,11 @@ listen: "{{ p.listen | default(php_version | php_socket(p.name | default(p.pool_name))) }}", user: "{{ p.user | default(php_default_user_group) }}", group: "{% if p.user is defined %}{{ p.group | default(p.user) }}{% else %}{{ p.group | default(php_default_user_group) }}{% endif %}", + php_env: {% if p.php_env is defined %}{{ p.php_env | to_nice_json }}{% else %}{}{% endif %}, php_value: {% if p.php_value is defined %}{{ p.php_value | to_nice_json }}{% else %}{}{% endif %}, php_admin_value: {% if p.php_admin_value is defined %}{{ p.php_admin_value | to_nice_json }}{% else %}{}{% endif %}, {% for k, v in p.items() | list %} - {% if k not in ['name', 'pool_name', 'listen', 'user', 'group', 'php_value', 'php_admin_value'] %} + {% if k not in ['name', 'pool_name', 'listen', 'user', 'group', 'php_env', 'php_value', 'php_admin_value'] %} {{ k }}: "{{ v }}"{% if not loop.last %},{% endif %} {% endif %} {% endfor %} @@ -65,6 +66,8 @@ group: root mode: 0644 register: f + tags: + - skip_ansible_lint - name: SETUP | Gathers new facts ansible.builtin.setup: diff --git a/templates/etc/__php__/fpm/pool.d/pool.conf.j2 b/templates/etc/__php__/fpm/pool.d/pool.conf.j2 index 7128181..7744d23 100644 --- a/templates/etc/__php__/fpm/pool.d/pool.conf.j2 +++ b/templates/etc/__php__/fpm/pool.d/pool.conf.j2 @@ -421,10 +421,19 @@ catch_workers_output = {{ item.catch_workers_output | default('no') }} ;php_admin_value[error_log] = /var/log/fpm-php.www.log ;php_admin_flag[log_errors] = on ;php_admin_value[memory_limit] = 32M +{% if item.php_env is defined %} +{% for k, v in item.php_env.items() | list %} +env[{{ k }}] = {{ v }} +{% endfor %} +{% endif %} +{% if item.php_value is defined %} {% for k, v in item.php_value.items() | list %} php_value[{{ k }}] = {{ v }} {% endfor %} +{% endif %} +{% if item.php_admin_value is defined %} {% for k, v in item.php_admin_value.items() | list %} php_admin_value[{{ k }}] = {{ v }} {% endfor %} +{% endif %} ; vim:filetype=dosini