From 869625fcf0649cecd1ee62a66fea2e8e87641213 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 26 Apr 2018 12:34:04 -0500 Subject: [PATCH 01/35] Fixes #236: Fix include and static deprecation notices in Ansible 2.4+. --- meta/main.yml | 2 +- tasks/main.yml | 21 +++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index b750632..89a1a6d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -6,7 +6,7 @@ galaxy_info: description: PHP for RedHat/CentOS/Fedora/Debian/Ubuntu. company: "Midwestern Mac, LLC" license: "license (BSD, MIT)" - min_ansible_version: 2.0 + min_ansible_version: 2.4 platforms: - name: EL versions: diff --git a/tasks/main.yml b/tasks/main.yml index 5afcce8..3d6e66c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -49,25 +49,18 @@ when: php_fpm_conf_path is not defined # Setup/install tasks. -- include: setup-RedHat.yml +- include_tasks: setup-RedHat.yml when: (php_install_from_source == false) and (ansible_os_family == 'RedHat') - static: no -- include: setup-Debian.yml +- include_tasks: setup-Debian.yml when: (php_install_from_source == false) and (ansible_os_family == 'Debian') - static: no # Install PHP from source when php_install_from_source is true. -- include: install-from-source.yml +- include_tasks: install-from-source.yml when: php_install_from_source == true - static: no # Configure PHP. -- include: configure.yml - static: no -- include: configure-apcu.yml - static: no -- include: configure-opcache.yml - static: no -- include: configure-fpm.yml - static: no +- include_tasks: configure.yml +- include_tasks: configure-apcu.yml +- include_tasks: configure-opcache.yml +- include_tasks: configure-fpm.yml From 46dcd87a2f7e6d803509e2d1cafe6e03253caff9 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 26 Apr 2018 12:37:36 -0500 Subject: [PATCH 02/35] Fixes #237: Add tests and support for Ubuntu 18.04 Bionic Beaver. --- .travis.yml | 9 ++++++--- meta/main.yml | 1 + tests/test-source.yml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5283066..b74a8ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,9 @@ env: - distro: debian8 playbook: test.yml php_version: 7.0 + - distro: ubuntu1804 + playbook: test.yml + php_version: 7.2 - distro: ubuntu1604 playbook: test.yml php_version: 7.0 @@ -25,10 +28,10 @@ env: # Only test source install on latest supported OSes. - distro: centos7 playbook: test-source.yml - php_version: 7.1.9 - - distro: ubuntu1604 + php_version: 7.1.17 + - distro: ubuntu1804 playbook: test-source.yml - php_version: 7.1.9 + php_version: 7.1.17 script: # Configure test script so we can run extra tests after playbook is run. diff --git a/meta/main.yml b/meta/main.yml index 89a1a6d..a9051e6 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -22,6 +22,7 @@ galaxy_info: versions: - trusty - xenial + - bionic galaxy_tags: - development - web diff --git a/tests/test-source.yml b/tests/test-source.yml index f364cc0..7c0d143 100644 --- a/tests/test-source.yml +++ b/tests/test-source.yml @@ -6,7 +6,7 @@ php_install_from_source: true php_source_clone_dir: /root/php-src php_source_make_command: "make --jobs=2" - php_source_version: "php-7.1.9" + php_source_version: "php-7.1.17" php_memory_limit: "192M" pre_tasks: From 52cd0586c7e72c52969554ba7f4e0cf5585ece35 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 26 Apr 2018 13:10:32 -0500 Subject: [PATCH 03/35] Issue #237: Fix test for ubuntu1804. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b74a8ba..9bed9ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ env: php_version: 7.0 - distro: ubuntu1804 playbook: test.yml - php_version: 7.2 + php_version: 7.0 - distro: ubuntu1604 playbook: test.yml php_version: 7.0 @@ -63,7 +63,7 @@ script: docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status | grep -qF "fpm.service; enabled" ;; - "debian8"|"ubuntu1604") + "debian8"|"ubuntu1604"|"ubuntu1804") docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status | grep -qF "fpm.service; enabled" ;; From f7c6438688db00a164e5e59d1e328c831bccf417 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 26 Apr 2018 13:43:29 -0500 Subject: [PATCH 04/35] Issue #237: Fix install from source on Ubuntu 18.04, using virtual package on older systems. --- tasks/install-from-source.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/install-from-source.yml b/tasks/install-from-source.yml index 03cc2ed..3fefa03 100644 --- a/tasks/install-from-source.yml +++ b/tasks/install-from-source.yml @@ -43,7 +43,7 @@ - libcurl4-openssl-dev - libbz2-dev - libjpeg-dev - - libpng12-dev + - libpng-dev - libxpm-dev - libfreetype6-dev - libgmp3-dev From 631321975546d0d02027cbb2887a52f57e4a3069 Mon Sep 17 00:00:00 2001 From: Vadim Kononov Date: Wed, 30 May 2018 13:05:33 -0500 Subject: [PATCH 05/35] Included missing user/group PHP-FPM configurations in README. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c463259..7528cd5 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Specific settings inside the default `www.conf` PHP-FPM pool. If you'd like to m By default, all the extra defaults below are applied through the php.ini included with this role. You can self-manage your php.ini file (if you need more flexility in its configuration) by setting this to `false` (in which case all the below variables will be ignored). + php_fpm_pool_user: "apache" + php_fpm_pool_group: "apache" php_memory_limit: "256M" php_max_execution_time: "60" php_max_input_time: "60" From e45aea47ae767a0e2055107f262906bf8794e6ab Mon Sep 17 00:00:00 2001 From: Vadim Kononov Date: Wed, 25 Jul 2018 17:29:11 -0500 Subject: [PATCH 06/35] Update README.md Changed the default values for php_fpm_pool_user and php_fpm_pool_group. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7528cd5..0c8b938 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ Specific settings inside the default `www.conf` PHP-FPM pool. If you'd like to m By default, all the extra defaults below are applied through the php.ini included with this role. You can self-manage your php.ini file (if you need more flexility in its configuration) by setting this to `false` (in which case all the below variables will be ignored). - php_fpm_pool_user: "apache" - php_fpm_pool_group: "apache" + php_fpm_pool_user: "[apache|nginx|other]" # default varies by OS + php_fpm_pool_group: "[apache|nginx|other]" # default varies by OS php_memory_limit: "256M" php_max_execution_time: "60" php_max_input_time: "60" From 40b7bd543ebf9eb83deb7a6068959541bbe1f682 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 7 Sep 2018 15:41:55 -0500 Subject: [PATCH 07/35] Fixes #253: Speed up PHP package installation by not using with_items. --- tasks/setup-Debian.yml | 3 +-- tasks/setup-RedHat.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 3b3d6d3..1740204 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -4,10 +4,9 @@ - name: Ensure PHP packages are installed. apt: - name: "{{ item }}" + name: "{{ php_packages }}" state: "{{ php_packages_state }}" install_recommends: "{{ php_install_recommends }}" - with_items: "{{ php_packages }}" register: php_package_install notify: restart webserver diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index a51e1e7..68ca931 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,8 +1,7 @@ --- - name: Ensure PHP packages are installed. package: - name: "{{ item }}" + name: "{{ php_packages }}" state: "{{ php_packages_state }}" enablerepo: "{{ php_enablerepo }}" - with_items: "{{ php_packages }}" notify: restart webserver From 6e92b870627bd528161bf00434991ae9b1e533cd Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 29 Sep 2018 14:41:26 -0500 Subject: [PATCH 08/35] Switch tests to use Molecule. --- .gitignore | 3 +- .travis.yml | 87 +++++---------- README.md | 2 +- defaults/main.yml | 2 +- meta/main.yml | 30 +++--- molecule/default/molecule.yml | 27 +++++ molecule/default/playbook-source.yml | 32 ++++++ .../test.yml => molecule/default/playbook.yml | 27 +++-- {tests => molecule/default}/requirements.yml | 0 molecule/default/tests/test_default.py | 14 +++ molecule/default/yaml-lint.yml | 6 ++ tasks/configure-apcu.yml | 2 +- tasks/configure-fpm.yml | 6 +- tasks/configure-opcache.yml | 2 +- tasks/install-from-source.yml | 100 +++++++++--------- tests/README.md | 11 -- tests/test-source.yml | 20 ---- 17 files changed, 196 insertions(+), 175 deletions(-) create mode 100644 molecule/default/molecule.yml create mode 100644 molecule/default/playbook-source.yml rename tests/test.yml => molecule/default/playbook.yml (71%) rename {tests => molecule/default}/requirements.yml (100%) create mode 100644 molecule/default/tests/test_default.py create mode 100644 molecule/default/yaml-lint.yml delete mode 100644 tests/README.md delete mode 100644 tests/test-source.yml diff --git a/.gitignore b/.gitignore index c9b2377..f56f5b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.retry -tests/test.sh +*/__pycache__ +*.pyc diff --git a/.travis.yml b/.travis.yml index 9bed9ab..43da859 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,74 +1,35 @@ --- +language: python services: docker env: - # Test package install on all supported OSes. - - distro: centos7 - playbook: test.yml - php_version: 7.0 - - distro: fedora27 - playbook: test.yml - php_version: 7.1 - - distro: debian9 - playbook: test.yml - php_version: 7.0 - - distro: debian8 - playbook: test.yml - php_version: 7.0 - - distro: ubuntu1804 - playbook: test.yml - php_version: 7.0 - - distro: ubuntu1604 - playbook: test.yml - php_version: 7.0 - - distro: ubuntu1404 - playbook: test.yml - php_version: 7.0 + global: + - ROLE_NAME: php + matrix: + - MOLECULE_DISTRO: centos7 + MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd + - MOLECULE_DISTRO: ubuntu1804 + - MOLECULE_DISTRO: ubuntu1604 + - MOLECULE_DISTRO: ubuntu1404 + - MOLECULE_DISTRO: debian9 - # Only test source install on latest supported OSes. - - distro: centos7 - playbook: test-source.yml - php_version: 7.1.17 - - distro: ubuntu1804 - playbook: test-source.yml - php_version: 7.1.17 + - MOLECULE_DISTRO: centos7 + MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd + MOLECULE_PLAYBOOK: playbook-source.yml + +install: + # Install test dependencies. + - pip install molecule docker + +before_script: + # Use actual Ansible Galaxy role name for the project directory. + - cd ../ + - mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME + - cd geerlingguy.$ROLE_NAME script: - # Configure test script so we can run extra tests after playbook is run. - - export container_id=$(date +%s) - - export cleanup=false - - # Download test shim. - - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/ - - chmod +x ${PWD}/tests/test.sh - # Run tests. - - ${PWD}/tests/test.sh - - # Ensure PHP is installed and at the right version. - - 'docker exec --tty ${container_id} env TERM=xterm which php' - - 'docker exec --tty ${container_id} env TERM=xterm test -x /usr/bin/php' - - - 'docker exec --tty ${container_id} env TERM=xterm php --version' - - 'docker exec --tty ${container_id} env TERM=xterm /usr/bin/php --version | grep -qF "PHP ${php_version}"' - - # Ensure PHP configurations have taken effect. - - docker exec --tty ${container_id} env TERM=xterm php -i | grep 'memory_limit.*192' - - # Check the status of PHP-FPM. - - | - if [ "${playbook}" == "test.yml" ]; then - case "${distro}" in - "centos7"|"fedora24") - docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status - docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status | grep -qF "fpm.service; enabled" - ;; - "debian8"|"ubuntu1604"|"ubuntu1804") - docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status - docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status | grep -qF "fpm.service; enabled" - ;; - esac - fi + - molecule test notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 0c8b938..adff28d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ If you have enabled any additional repositories such as [geerlingguy.repo-epel]( You can also use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.0, 7.1, 7.2). - php_install_recommends: yes + php_install_recommends: true (Debian/Ubuntu only) Whether to install recommended packages when installing `php_packages`; you might want to set this to `no` explicitly if you're installing a PPA that recommends certain packages you don't want (e.g. Ondrej's `php` PPA will install `php7.0-cli` if you install `php-pear` alongside `php5.6-cli`... which is often not desired!). diff --git a/defaults/main.yml b/defaults/main.yml index d73a6dc..b2f42a2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,7 +8,7 @@ php_enablerepo: "" php_packages_state: present # Whether to install recommended packages. Used only for Debian/Ubuntu. -php_install_recommends: yes +php_install_recommends: true # Set this to false if you're not using PHP with Apache/Nginx/etc. php_enable_webserver: true diff --git a/meta/main.yml b/meta/main.yml index a9051e6..0baef25 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -8,21 +8,21 @@ galaxy_info: license: "license (BSD, MIT)" min_ansible_version: 2.4 platforms: - - name: EL - versions: - - 6 - - 7 - - name: Fedora - versions: - - all - - name: Debian - versions: - - all - - name: Ubuntu - versions: - - trusty - - xenial - - bionic + - name: EL + versions: + - 6 + - 7 + - name: Fedora + versions: + - all + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - trusty + - xenial + - bionic galaxy_tags: - development - web diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..0339702 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint + options: + config-file: molecule/default/yaml-lint.yml +platforms: + - name: instance + image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible + command: ${MOLECULE_DOCKER_COMMAND:-"sleep infinity"} + privileged: true + pre_build_image: true +provisioner: + name: ansible + lint: + name: ansible-lint + playbooks: + converge: ${MOLECULE_PLAYBOOK:-playbook.yml} +scenario: + name: default +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/default/playbook-source.yml b/molecule/default/playbook-source.yml new file mode 100644 index 0000000..1cc193d --- /dev/null +++ b/molecule/default/playbook-source.yml @@ -0,0 +1,32 @@ +--- +- name: Converge + hosts: all + become: true + + vars: + php_enable_webserver: false + php_install_from_source: true + php_source_clone_dir: /root/php-src + php_source_make_command: "make --jobs=2" + php_version: "7.1.17" + php_source_version: "php-{{ php_version }}" + php_memory_limit: "192M" + + pre_tasks: + - name: Update apt cache. + apt: update_cache=true cache_valid_time=600 + when: ansible_os_family == 'Debian' + changed_when: false + + roles: + - role: geerlingguy.git + - role: geerlingguy.php + + post_tasks: + - name: Confirm PHP configuration is correct. + shell: php -i | grep 'memory_limit.*192' + changed_when: false + + - name: Check the installed PHP version. + shell: '/usr/bin/php --version | grep -qF "PHP {{ php_version }}"' + changed_when: false diff --git a/tests/test.yml b/molecule/default/playbook.yml similarity index 71% rename from tests/test.yml rename to molecule/default/playbook.yml index ff72fc3..5284104 100644 --- a/tests/test.yml +++ b/molecule/default/playbook.yml @@ -1,16 +1,18 @@ --- -- hosts: all +- name: Converge + hosts: all + become: true vars: php_enable_webserver: false php_enable_php_fpm: true php_memory_limit: "192M" php_enablerepo: "remi,remi-php70" - php_install_recommends: no + php_install_recommends: false pre_tasks: - name: Update apt cache. - apt: update_cache=yes cache_valid_time=600 + apt: update_cache=true cache_valid_time=600 when: ansible_os_family == 'Debian' changed_when: false @@ -22,10 +24,10 @@ # Debian-specific tasks. - name: Add dependencies for PHP versions (Debian). apt: - name: "{{ item }}" - with_items: - - apt-transport-https - - ca-certificates + name: + - apt-transport-https + - ca-certificates + state: present when: ansible_distribution == "Debian" - name: Add Ondrej Sury's apt key (Debian). @@ -47,5 +49,12 @@ roles: - role: geerlingguy.repo-remi - when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' - - role_under_test + when: + - ansible_os_family == 'RedHat' + - ansible_distribution != 'Fedora' + - geerlingguy.ansible + + post_tasks: + - name: Confirm PHP configuration is correct. + shell: php -i | grep 'memory_limit.*192' + changed_when: false diff --git a/tests/requirements.yml b/molecule/default/requirements.yml similarity index 100% rename from tests/requirements.yml rename to molecule/default/requirements.yml diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py new file mode 100644 index 0000000..eedd64a --- /dev/null +++ b/molecule/default/tests/test_default.py @@ -0,0 +1,14 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/molecule/default/yaml-lint.yml b/molecule/default/yaml-lint.yml new file mode 100644 index 0000000..a3dbc38 --- /dev/null +++ b/molecule/default/yaml-lint.yml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: + max: 120 + level: warning diff --git a/tasks/configure-apcu.yml b/tasks/configure-apcu.yml index 5a3badb..a29f8d6 100644 --- a/tasks/configure-apcu.yml +++ b/tasks/configure-apcu.yml @@ -22,7 +22,7 @@ dest: "{{ item }}/{{ php_apc_conf_filename }}" owner: root group: root - force: yes + force: true mode: 0644 with_items: "{{ php_extension_conf_paths }}" when: php_enable_apc diff --git a/tasks/configure-fpm.yml b/tasks/configure-fpm.yml index c9c08bc..66db220 100644 --- a/tasks/configure-fpm.yml +++ b/tasks/configure-fpm.yml @@ -40,7 +40,7 @@ owner: root group: root mode: 0644 - force: no + force: false when: php_enable_php_fpm - name: Configure php-fpm pool (if enabled). @@ -73,7 +73,7 @@ service: name: "{{ php_fpm_daemon }}" state: started - enabled: yes + enabled: true when: php_enable_php_fpm and ansible_distribution != "Debian" # See: https://github.com/ansible/ansible/issues/22303 @@ -81,6 +81,6 @@ service: name: "{{ php_fpm_daemon }}" state: started - enabled: yes + enabled: true use: service when: php_enable_php_fpm and ansible_distribution == "Debian" diff --git a/tasks/configure-opcache.yml b/tasks/configure-opcache.yml index cd02e3f..4ed13ed 100644 --- a/tasks/configure-opcache.yml +++ b/tasks/configure-opcache.yml @@ -22,7 +22,7 @@ dest: "{{ item }}/{{ php_opcache_conf_filename }}" owner: root group: root - force: yes + force: true mode: 0644 with_items: "{{ php_extension_conf_paths }}" when: php_opcache_enable diff --git a/tasks/install-from-source.yml b/tasks/install-from-source.yml index 3fefa03..e999ba0 100644 --- a/tasks/install-from-source.yml +++ b/tasks/install-from-source.yml @@ -1,28 +1,29 @@ --- - name: Ensure dependencies for building from source are installed (RedHat). - package: "name={{ item }} state=present" - with_items: - - autoconf - - automake - - libtool - - bison - - make - - curl-devel - - recode-devel - - aspell-devel - - libxml2-devel - - pkgconfig - - libmcrypt-devel - - t1lib-devel - - libXpm-devel - - libpng-devel - - libjpeg-turbo-devel - - bzip2-devel - - openssl-devel - - freetype-devel - - libicu-devel - - mariadb-devel - - gmp-devel + package: + name: + - autoconf + - automake + - libtool + - bison + - make + - curl-devel + - recode-devel + - aspell-devel + - libxml2-devel + - pkgconfig + - libmcrypt-devel + - t1lib-devel + - libXpm-devel + - libpng-devel + - libjpeg-turbo-devel + - bzip2-devel + - openssl-devel + - freetype-devel + - libicu-devel + - mariadb-devel + - gmp-devel + state: present when: ansible_os_family == 'RedHat' - name: Update apt cache (Debian). @@ -30,28 +31,29 @@ when: ansible_os_family == 'Debian' - name: Ensure dependencies for building from source are installed (Debian). - apt: "pkg={{ item }} state=present" - with_items: - - build-essential - - autoconf - - automake - - libtool - - bison - - pkg-config - - re2c - - libxml2-dev - - libcurl4-openssl-dev - - libbz2-dev - - libjpeg-dev - - libpng-dev - - libxpm-dev - - libfreetype6-dev - - libgmp3-dev - - libmcrypt-dev - - libmysqlclient-dev - - libpspell-dev - - librecode-dev - - libssl-dev + apt: + name: + - build-essential + - autoconf + - automake + - libtool + - bison + - pkg-config + - re2c + - libxml2-dev + - libcurl4-openssl-dev + - libbz2-dev + - libjpeg-dev + - libpng-dev + - libxpm-dev + - libfreetype6-dev + - libgmp3-dev + - libmcrypt-dev + - libmysqlclient-dev + - libpspell-dev + - librecode-dev + - libssl-dev + state: present when: ansible_os_family == 'Debian' - name: Define php_fpm_daemon (if not defined already). @@ -81,7 +83,7 @@ repo: "{{ php_source_repo }}" dest: "{{ php_source_clone_dir }}" version: "{{ php_source_version }}" - accept_hostkey: yes + accept_hostkey: true depth: "{{ php_source_clone_depth }}" when: php_installed.rc != 0 @@ -93,19 +95,19 @@ when: php_installed.rc != 0 - name: Build configure script. - shell: > + command: > ./buildconf --force chdir={{ php_source_clone_dir }} when: php_installed.rc != 0 - name: Run configure script. - shell: > + command: > {{ php_source_configure_command }} chdir={{ php_source_clone_dir }} when: php_installed.rc != 0 - name: Make and install PHP. - shell: > + command: > {{ item }} chdir={{ php_source_clone_dir }} with_items: diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 6fb2117..0000000 --- a/tests/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Ansible Role tests - -To run the test playbook(s) in this directory: - - 1. Install and start Docker. - 1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`: - - `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/` - 1. Make the test shim executable: `chmod +x tests/test.sh`. - 1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh` - -If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)` diff --git a/tests/test-source.yml b/tests/test-source.yml deleted file mode 100644 index 7c0d143..0000000 --- a/tests/test-source.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- hosts: all - - vars: - php_enable_webserver: false - php_install_from_source: true - php_source_clone_dir: /root/php-src - php_source_make_command: "make --jobs=2" - php_source_version: "php-7.1.17" - php_memory_limit: "192M" - - pre_tasks: - - name: Update apt cache. - apt: update_cache=yes cache_valid_time=600 - when: ansible_os_family == 'Debian' - changed_when: false - - roles: - - geerlingguy.git - - role_under_test From b973cd155f32bb5ccd7eb43e348c736a63da2580 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 29 Sep 2018 14:47:37 -0500 Subject: [PATCH 09/35] Fix Molecule CI issues. --- molecule/default/playbook.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 5284104..a163476 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -10,6 +10,11 @@ php_enablerepo: "remi,remi-php70" php_install_recommends: false + handlers: + - name: update apt cache + apt: update_cache=true + when: ansible_os_family == 'Debian' + pre_tasks: - name: Update apt cache. apt: update_cache=true cache_valid_time=600 @@ -40,12 +45,10 @@ apt_repository: repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main" state: present - register: php_ondrej_debian_repo when: ansible_distribution == "Debian" + notify: update apt cache - - name: Update apt caches after repo is added (Debian). - apt: update_cache=yes - when: php_ondrej_debian_repo.changed and (ansible_distribution == "Debian") + - meta: flush_handlers roles: - role: geerlingguy.repo-remi From 61c2ba824508dc4b14e76475f520f8e60e2c78a1 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 29 Sep 2018 16:15:09 -0500 Subject: [PATCH 10/35] Fix Molecule CI issues. --- molecule/default/playbook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index a163476..9ca5021 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -55,7 +55,7 @@ when: - ansible_os_family == 'RedHat' - ansible_distribution != 'Fedora' - - geerlingguy.ansible + - role: geerlingguy.php post_tasks: - name: Confirm PHP configuration is correct. From 3222f60757ca03408ba2aa1dff7445dca5658dbc Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 29 Sep 2018 16:56:13 -0500 Subject: [PATCH 11/35] Fix Molecule CI issue with Ubuntu 14.04 build. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 43da859..2cd644a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu1604 - MOLECULE_DISTRO: ubuntu1404 + MOLECULE_DOCKER_COMMAND: /sbin/init - MOLECULE_DISTRO: debian9 - MOLECULE_DISTRO: centos7 From f1470fb5f97be7af5a24301d42e6262f596bf77a Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 4 Oct 2018 16:14:55 -0500 Subject: [PATCH 12/35] Prevent failures on Ansible 2.7 when no repo is set on RedHat. --- tasks/setup-RedHat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 68ca931..0ea1e33 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -3,5 +3,5 @@ package: name: "{{ php_packages }}" state: "{{ php_packages_state }}" - enablerepo: "{{ php_enablerepo }}" + enablerepo: "{{ php_enablerepo | default(omit) }}" notify: restart webserver From 705983ae634b041882d337629829f80e61cacc1a Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 8 Oct 2018 11:58:30 -0500 Subject: [PATCH 13/35] Fix broken yum enablerepo behavior due to change in Ansible 2.7.0. --- tasks/setup-RedHat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 0ea1e33..41db907 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -3,5 +3,5 @@ package: name: "{{ php_packages }}" state: "{{ php_packages_state }}" - enablerepo: "{{ php_enablerepo | default(omit) }}" + enablerepo: "{{ php_enablerepo | default(omit, true) }}" notify: restart webserver From b235d4165fdbb2380d6fc7af2d8b9b14acfad108 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 23 Oct 2018 10:31:40 -0500 Subject: [PATCH 14/35] Update tests for optimum efficiency. --- .travis.yml | 3 --- molecule/default/molecule.yml | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2cd644a..45999be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,15 +7,12 @@ env: - ROLE_NAME: php matrix: - MOLECULE_DISTRO: centos7 - MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu1604 - MOLECULE_DISTRO: ubuntu1404 - MOLECULE_DOCKER_COMMAND: /sbin/init - MOLECULE_DISTRO: debian9 - MOLECULE_DISTRO: centos7 - MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd MOLECULE_PLAYBOOK: playbook-source.yml install: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0339702..2ca6fea 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -9,8 +9,10 @@ lint: config-file: molecule/default/yaml-lint.yml platforms: - name: instance - image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible - command: ${MOLECULE_DOCKER_COMMAND:-"sleep infinity"} + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro privileged: true pre_build_image: true provisioner: From 809394707981f10232e58cac6a607e2a5d016a5b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 23 Oct 2018 13:50:02 -0500 Subject: [PATCH 15/35] Add new php_default_version_debian variable so 7.2 can be used on Bionic. --- README.md | 10 +++++++--- defaults/main.yml | 3 +++ vars/Debian.yml | 38 +++++++++++++++++++------------------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index adff28d..3922344 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,15 @@ The default values for the HTTP server deamon are `httpd` (used by Apache) for R (RedHat/CentOS only) If you have enabled any additional repositories (might I suggest [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi)), those repositories can be listed under this variable (e.g. `remi-php70,epel`). This can be handy, as an example, if you want to install the latest version of PHP 7.0, which is in the Remi repository. + php_default_version_debian: "7.0" + +(Debian/Ubuntu only) The default version of PHP in the given OS version repositories. Defaults to the latest Ubuntu LTS release. Ubuntu 18.04 needs this to be set to `"7.2"` since PHP 7.0 is not available in the default bionic packages. + +**If you'd like to be able to switch PHP versions easily, or use a version that's not available in system packages**: You can use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.1, 7.2). + php_packages_state: "present" -If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository. - -You can also use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.0, 7.1, 7.2). +If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with `php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository. php_install_recommends: true diff --git a/defaults/main.yml b/defaults/main.yml index b2f42a2..8b04351 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,6 +3,9 @@ # for RHEL/CentOS. php_enablerepo: "" +# Default PHP version to install on Debian-based OSes. +php_default_version_debian: "7.0" + # PHP package state; use 'present' to make sure it's installed, or 'latest' if # you want to upgrade or switch versions using a new repo. php_packages_state: present diff --git a/vars/Debian.yml b/vars/Debian.yml index 2dba014..c5f90b5 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,36 +1,36 @@ --- __php_packages: - - php7.0-common - - php7.0-cli - - php7.0-dev - - php7.0-fpm + - php{{ php_default_version_debian }}-common + - php{{ php_default_version_debian }}-cli + - php{{ php_default_version_debian }}-dev + - php{{ php_default_version_debian }}-fpm - libpcre3-dev - - php7.0-gd - - php7.0-curl - - php7.0-imap - - php7.0-json - - php7.0-opcache - - php7.0-xml - - php7.0-mbstring + - php{{ php_default_version_debian }}-gd + - php{{ php_default_version_debian }}-curl + - php{{ php_default_version_debian }}-imap + - php{{ php_default_version_debian }}-json + - php{{ php_default_version_debian }}-opcache + - php{{ php_default_version_debian }}-xml + - php{{ php_default_version_debian }}-mbstring - php-sqlite3 - php-apcu __php_webserver_daemon: "apache2" # Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode. __php_conf_paths: - - /etc/php/7.0/fpm - - /etc/php/7.0/apache2 - - /etc/php/7.0/cli + - /etc/php/{{ php_default_version_debian }}/fpm + - /etc/php/{{ php_default_version_debian }}/apache2 + - /etc/php/{{ php_default_version_debian }}/cli __php_extension_conf_paths: - - /etc/php/7.0/fpm/conf.d - - /etc/php/7.0/apache2/conf.d - - /etc/php/7.0/cli/conf.d + - /etc/php/{{ php_default_version_debian }}/fpm/conf.d + - /etc/php/{{ php_default_version_debian }}/apache2/conf.d + - /etc/php/{{ php_default_version_debian }}/cli/conf.d __php_apc_conf_filename: 20-apcu.ini __php_opcache_conf_filename: 10-opcache.ini -__php_fpm_daemon: php7.0-fpm -__php_fpm_conf_path: "/etc/php/7.0/fpm" +__php_fpm_daemon: php{{ php_default_version_debian }}-fpm +__php_fpm_conf_path: "/etc/php/{{ php_default_version_debian }}/fpm" __php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf" __php_fpm_pool_user: www-data From 9e8daa5fdd3bdbd7b60b21f451bc7b4cf8bf203f Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 25 Oct 2018 11:09:47 -0500 Subject: [PATCH 16/35] Fix lint issues picked up by galaxy-lint-rules. --- tasks/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3d6e66c..32c80e7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -50,14 +50,18 @@ # Setup/install tasks. - include_tasks: setup-RedHat.yml - when: (php_install_from_source == false) and (ansible_os_family == 'RedHat') + when: + - not php_install_from_source + - ansible_os_family == 'RedHat' - include_tasks: setup-Debian.yml - when: (php_install_from_source == false) and (ansible_os_family == 'Debian') + when: + - not php_install_from_source + - ansible_os_family == 'Debian' # Install PHP from source when php_install_from_source is true. - include_tasks: install-from-source.yml - when: php_install_from_source == true + when: php_install_from_source # Configure PHP. - include_tasks: configure.yml From 347055716fff2cbcfc458b319a748b1a256cdb7d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 3 Jan 2019 21:50:00 -0600 Subject: [PATCH 17/35] Resolve ansible-lint problems. --- .ansible-lint | 3 +++ tasks/install-from-source.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..f3c1090 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,3 @@ +skip_list: + - '405' + - '503' diff --git a/tasks/install-from-source.yml b/tasks/install-from-source.yml index e999ba0..09ad4c3 100644 --- a/tasks/install-from-source.yml +++ b/tasks/install-from-source.yml @@ -70,7 +70,7 @@ src: "{{ php_source_install_gmp_path }}" dest: /usr/include/gmp.h state: link - when: gmp_file.stat.exists == false + when: not gmp_file.stat.exists - name: Check if PHP is installed. command: which php From b48b06ac39b1a2b7d75204eff18b02b386bb24c8 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 23 Mar 2019 19:22:27 -0500 Subject: [PATCH 18/35] Fix ansible-lint issue. --- molecule/default/playbook.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 9ca5021..e71a940 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -59,5 +59,7 @@ post_tasks: - name: Confirm PHP configuration is correct. - shell: php -i | grep 'memory_limit.*192' + shell: | + set -o pipefail + php -i | grep 'memory_limit.*192' changed_when: false From f8114e6678864415aabcb1ab9d9e7804a16c39f2 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sun, 24 Mar 2019 10:14:45 -0500 Subject: [PATCH 19/35] Fix ansible-lint issue by ignoring 306. --- .ansible-lint | 1 + molecule/default/playbook.yml | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index f3c1090..195bd18 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,4 @@ skip_list: + - '306' - '405' - '503' diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index e71a940..9ca5021 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -59,7 +59,5 @@ post_tasks: - name: Confirm PHP configuration is correct. - shell: | - set -o pipefail - php -i | grep 'memory_limit.*192' + shell: php -i | grep 'memory_limit.*192' changed_when: false From 19b086d9363ebe6b9983acad02e84a1e8e5dfb81 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 4 May 2019 21:12:27 -0500 Subject: [PATCH 20/35] Remove Ubuntu 14.04 tests. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 45999be..ff0c701 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ env: - MOLECULE_DISTRO: centos7 - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu1604 - - MOLECULE_DISTRO: ubuntu1404 - MOLECULE_DISTRO: debian9 - MOLECULE_DISTRO: centos7 From 903e595c4b8791183f5c654579ca7385ad66fca0 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 16 May 2019 22:20:46 -0500 Subject: [PATCH 21/35] Remove unused tests. --- molecule/default/tests/test_default.py | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 molecule/default/tests/test_default.py diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py deleted file mode 100644 index eedd64a..0000000 --- a/molecule/default/tests/test_default.py +++ /dev/null @@ -1,14 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' From 77cd68003a7fefb2dac7e3076dddbeaa0edd990f Mon Sep 17 00:00:00 2001 From: guessit-dev <42694165+guessit-dev@users.noreply.github.com> Date: Fri, 17 May 2019 16:24:15 +0000 Subject: [PATCH 22/35] Remove settings which are absent in php 7.0+ https://www.php.net/manual/en/ini.core.php#ini.asp-tags https://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data https://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-42 https://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-warn --- templates/php.ini.j2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/templates/php.ini.j2 b/templates/php.ini.j2 index b157df1..35e9229 100644 --- a/templates/php.ini.j2 +++ b/templates/php.ini.j2 @@ -6,7 +6,6 @@ engine = On short_open_tag = {{ php_short_open_tag }} -asp_tags = Off precision = 14 output_buffering = {{ php_output_buffering }} @@ -64,7 +63,6 @@ auto_prepend_file = auto_append_file = default_mimetype = "text/html" -always_populate_raw_post_data = -1 ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; @@ -189,8 +187,6 @@ session.gc_probability = {{ php_session_gc_probability }} session.gc_divisor = {{ php_session_gc_divisor }} session.gc_maxlifetime = {{ php_session_gc_maxlifetime }} -session.bug_compat_42 = Off -session.bug_compat_warn = Off session.referer_check = session.cache_limiter = nocache From 1f4b20ba7d4dc62ab089c46290de1b6ad2bcf799 Mon Sep 17 00:00:00 2001 From: Jeff Sheltren Date: Tue, 15 Oct 2019 11:14:26 -0700 Subject: [PATCH 23/35] Use |bool filter on opcache variable to avoid deprecation warning --- tasks/configure-opcache.yml | 4 ++-- tasks/setup-Debian.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/configure-opcache.yml b/tasks/configure-opcache.yml index 4ed13ed..8b01a08 100644 --- a/tasks/configure-opcache.yml +++ b/tasks/configure-opcache.yml @@ -25,7 +25,7 @@ force: true mode: 0644 with_items: "{{ php_extension_conf_paths }}" - when: php_opcache_enable + when: php_opcache_enable|bool notify: restart webserver - name: Remove OpCache config file if OpCache is disabled. @@ -33,5 +33,5 @@ path: "{{ item }}/{{ php_opcache_conf_filename }}" state: absent with_items: "{{ php_extension_conf_paths }}" - when: not php_opcache_enable + when: not php_opcache_enable|bool notify: restart webserver diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 1740204..5ff1bbe 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -23,5 +23,5 @@ path: "{{ item }}/{{ php_opcache_conf_filename }}" state: absent with_items: "{{ php_extension_conf_paths }}" - when: php_opcache_enable and php_package_install.changed + when: php_opcache_enable|bool and php_package_install.changed notify: restart webserver From 24ca4a9c36ba445588a72281b6d6978741f317fe Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 6 Nov 2019 12:43:07 -0600 Subject: [PATCH 24/35] PR #280: Follow-up for formatting. --- tasks/configure-opcache.yml | 4 ++-- tasks/setup-Debian.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/configure-opcache.yml b/tasks/configure-opcache.yml index 8b01a08..fc043d0 100644 --- a/tasks/configure-opcache.yml +++ b/tasks/configure-opcache.yml @@ -25,7 +25,7 @@ force: true mode: 0644 with_items: "{{ php_extension_conf_paths }}" - when: php_opcache_enable|bool + when: php_opcache_enable | bool notify: restart webserver - name: Remove OpCache config file if OpCache is disabled. @@ -33,5 +33,5 @@ path: "{{ item }}/{{ php_opcache_conf_filename }}" state: absent with_items: "{{ php_extension_conf_paths }}" - when: not php_opcache_enable|bool + when: not php_opcache_enable | bool notify: restart webserver diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 5ff1bbe..bd7607d 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -23,5 +23,5 @@ path: "{{ item }}/{{ php_opcache_conf_filename }}" state: absent with_items: "{{ php_extension_conf_paths }}" - when: php_opcache_enable|bool and php_package_install.changed + when: php_opcache_enable | bool and php_package_install.changed notify: restart webserver From 1e0c4b93201527b6a934db4999962d265391c824 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 11 Dec 2019 10:04:22 -0600 Subject: [PATCH 25/35] Create FUNDING.yml --- .github/FUNDING.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..af7a1e0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: geerlingguy +patreon: geerlingguy From 1038accd5847323401efab87e35733797d585b9d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 11 Dec 2019 11:23:26 -0600 Subject: [PATCH 26/35] YAML syntax fix. --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index af7a1e0..96b4938 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,4 @@ # These are supported funding model platforms - +--- github: geerlingguy patreon: geerlingguy From ca69f2e28983b36787ed840cdb951c816b71f980 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 20 Feb 2020 14:23:58 -0600 Subject: [PATCH 27/35] Update molecule configuration to work with 3.0. --- .travis.yml | 2 +- molecule/default/molecule.yml | 13 ++----- molecule/default/playbook.yml | 63 ---------------------------------- molecule/default/yaml-lint.yml | 6 ---- 4 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 molecule/default/playbook.yml delete mode 100644 molecule/default/yaml-lint.yml diff --git a/.travis.yml b/.travis.yml index ff0c701..449fcf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: install: # Install test dependencies. - - pip install molecule docker + - pip install molecule yamllint ansible-lint docker before_script: # Use actual Ansible Galaxy role name for the project directory. diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 2ca6fea..f2e9611 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,9 +4,8 @@ dependency: driver: name: docker lint: - name: yamllint - options: - config-file: molecule/default/yaml-lint.yml + yamllint . + ansible-lint platforms: - name: instance image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" @@ -17,13 +16,7 @@ platforms: pre_build_image: true provisioner: name: ansible - lint: - name: ansible-lint playbooks: - converge: ${MOLECULE_PLAYBOOK:-playbook.yml} + converge: ${MOLECULE_PLAYBOOK:-converge.yml} scenario: name: default -verifier: - name: testinfra - lint: - name: flake8 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml deleted file mode 100644 index 9ca5021..0000000 --- a/molecule/default/playbook.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - - vars: - php_enable_webserver: false - php_enable_php_fpm: true - php_memory_limit: "192M" - php_enablerepo: "remi,remi-php70" - php_install_recommends: false - - handlers: - - name: update apt cache - apt: update_cache=true - when: ansible_os_family == 'Debian' - - pre_tasks: - - name: Update apt cache. - apt: update_cache=true cache_valid_time=600 - when: ansible_os_family == 'Debian' - changed_when: false - - # Ubuntu-specific tasks. - - name: Add repository for PHP 7. - apt_repository: repo='ppa:ondrej/php' - when: ansible_distribution == 'Ubuntu' - - # Debian-specific tasks. - - name: Add dependencies for PHP versions (Debian). - apt: - name: - - apt-transport-https - - ca-certificates - state: present - when: ansible_distribution == "Debian" - - - name: Add Ondrej Sury's apt key (Debian). - apt_key: - url: https://packages.sury.org/php/apt.gpg - state: present - when: ansible_distribution == "Debian" - - - name: Add Ondrej Sury's repo (Debian). - apt_repository: - repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main" - state: present - when: ansible_distribution == "Debian" - notify: update apt cache - - - meta: flush_handlers - - roles: - - role: geerlingguy.repo-remi - when: - - ansible_os_family == 'RedHat' - - ansible_distribution != 'Fedora' - - role: geerlingguy.php - - post_tasks: - - name: Confirm PHP configuration is correct. - shell: php -i | grep 'memory_limit.*192' - changed_when: false diff --git a/molecule/default/yaml-lint.yml b/molecule/default/yaml-lint.yml deleted file mode 100644 index a3dbc38..0000000 --- a/molecule/default/yaml-lint.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -extends: default -rules: - line-length: - max: 120 - level: warning From af0dd95d5d88c88f73b88b37008f6650a21bd260 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 20 Feb 2020 14:29:57 -0600 Subject: [PATCH 28/35] Update molecule configuration to work with 3.0. --- .yamllint | 6 ++++ molecule/default/converge.yml | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .yamllint create mode 100644 molecule/default/converge.yml diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..a3dbc38 --- /dev/null +++ b/.yamllint @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: + max: 120 + level: warning diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..9ca5021 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,63 @@ +--- +- name: Converge + hosts: all + become: true + + vars: + php_enable_webserver: false + php_enable_php_fpm: true + php_memory_limit: "192M" + php_enablerepo: "remi,remi-php70" + php_install_recommends: false + + handlers: + - name: update apt cache + apt: update_cache=true + when: ansible_os_family == 'Debian' + + pre_tasks: + - name: Update apt cache. + apt: update_cache=true cache_valid_time=600 + when: ansible_os_family == 'Debian' + changed_when: false + + # Ubuntu-specific tasks. + - name: Add repository for PHP 7. + apt_repository: repo='ppa:ondrej/php' + when: ansible_distribution == 'Ubuntu' + + # Debian-specific tasks. + - name: Add dependencies for PHP versions (Debian). + apt: + name: + - apt-transport-https + - ca-certificates + state: present + when: ansible_distribution == "Debian" + + - name: Add Ondrej Sury's apt key (Debian). + apt_key: + url: https://packages.sury.org/php/apt.gpg + state: present + when: ansible_distribution == "Debian" + + - name: Add Ondrej Sury's repo (Debian). + apt_repository: + repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main" + state: present + when: ansible_distribution == "Debian" + notify: update apt cache + + - meta: flush_handlers + + roles: + - role: geerlingguy.repo-remi + when: + - ansible_os_family == 'RedHat' + - ansible_distribution != 'Fedora' + - role: geerlingguy.php + + post_tasks: + - name: Confirm PHP configuration is correct. + shell: php -i | grep 'memory_limit.*192' + changed_when: false From 5ae222208d081eb9c21037e0ca27d780d5306263 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 20 Feb 2020 15:55:50 -0600 Subject: [PATCH 29/35] Update molecule configuration to work with 3.0. --- molecule/default/molecule.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index f2e9611..38eb962 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,7 +3,7 @@ dependency: name: galaxy driver: name: docker -lint: +lint: | yamllint . ansible-lint platforms: @@ -18,5 +18,3 @@ provisioner: name: ansible playbooks: converge: ${MOLECULE_PLAYBOOK:-converge.yml} -scenario: - name: default From 5d5980a210b65a100700186062b2970282ceb081 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 20 Feb 2020 19:30:04 -0600 Subject: [PATCH 30/35] Fix broken tests on Ubuntu. --- molecule/default/converge.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 9ca5021..f778533 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -22,6 +22,12 @@ changed_when: false # Ubuntu-specific tasks. + - name: Ensure dirmngr is installed (gnupg dependency). + apt: + name: dirmngr + state: present + when: ansible_distribution == 'Ubuntu' + - name: Add repository for PHP 7. apt_repository: repo='ppa:ondrej/php' when: ansible_distribution == 'Ubuntu' From 1c910678ec1adb935ed9a0276e311adbc23bd7ce Mon Sep 17 00:00:00 2001 From: Tobias Lindberg Date: Mon, 24 Feb 2020 12:27:27 +0100 Subject: [PATCH 31/35] Removing php-imap from RedHat vars php-imap is not available anymore.. it was epel7 and will not be included in rh8 --- vars/RedHat.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/vars/RedHat.yml b/vars/RedHat.yml index f17b982..e1e4458 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -6,7 +6,6 @@ __php_packages: - php-devel - php-fpm - php-gd - - php-imap - php-ldap - php-mbstring - php-opcache From 0fd818ef39351d2f613484a47c42ca86877e7a44 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 24 Feb 2020 09:46:00 -0600 Subject: [PATCH 32/35] Make sure molecule lint script has set -e option. --- molecule/default/molecule.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 38eb962..2da47dd 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,6 +4,7 @@ dependency: driver: name: docker lint: | + set -e yamllint . ansible-lint platforms: From 7a81aaac6f17deec387b3c5e36c3824bd5f5c26b Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 5 Mar 2020 10:45:34 -0600 Subject: [PATCH 33/35] Add probot/stale configuration to repository for stale issues. --- .github/stale.yml | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..c7ff127 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,56 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 90 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 30 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - pinned + - security + - planned + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: false + +# Label to use when marking as stale +staleLabel: stale + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +pulls: + markComment: |- + This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution! + + Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale. + + unmarkComment: >- + This pull request is no longer marked for closure. + + closeComment: >- + This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details. + +issues: + markComment: |- + This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution! + + Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale. + + unmarkComment: >- + This issue is no longer marked for closure. + + closeComment: >- + This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details. From 886e4473e6e2e905d88b590f6c88789c30adba8f Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 6 Mar 2020 09:25:03 -0600 Subject: [PATCH 34/35] PR #289 follow-up: Test centos8. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 449fcf3..ebcbe00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: global: - ROLE_NAME: php matrix: + - MOLECULE_DISTRO: centos8 - MOLECULE_DISTRO: centos7 - MOLECULE_DISTRO: ubuntu1804 - MOLECULE_DISTRO: ubuntu1604 From fbae48db55821a1a97a87c6411bac92e2b9e50eb Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 6 Mar 2020 09:25:18 -0600 Subject: [PATCH 35/35] Add RHEL 8 to supported platforms. --- meta/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/main.yml b/meta/main.yml index 0baef25..76a38bb 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,6 +12,7 @@ galaxy_info: versions: - 6 - 7 + - 8 - name: Fedora versions: - all