Compare commits

...

55 Commits

Author SHA1 Message Date
Jeff Geerling bf9bf9de00 A wee bit of modernization. 2024-01-24 22:05:15 -06:00
Jeff Geerling bac5cdbe9b Make local dev with molecule a little easier. 2024-01-24 21:58:48 -06:00
Jeff Geerling e66e110c5d Stale bot is now Stale GitHub Action. 2023-07-10 17:48:36 -05:00
Jeff Geerling f26da32537 Remove official support for RHEL. Rocky/Alma/Stream support is best-effort. 2023-06-23 10:57:17 -05:00
Jeff Geerling 67c11836d4 Fix lint issue with latest version of yamllint. 2023-06-14 21:22:55 -05:00
Jeff Geerling f296994c76 Fix Molecule CI workflow since docker plugin has moved. 2023-04-20 17:28:08 -05:00
Jeff Geerling d241f91947 Add PHP 8.2 support and set it as default. 2023-02-02 21:58:02 -06:00
Jeff Geerling 3c0a24606f Fix Molecule CI workflow for Ubuntu 22.04 GitHub Actions. 2022-12-06 18:24:29 -06:00
Jeff Geerling bae936d2dc Remove deprecated warn arg from command and shell module invocations. 2022-11-26 22:53:59 -06:00
Jeff Geerling c942861308 Fix up whitespace. 2022-09-09 10:37:50 -05:00
Jeff Geerling 574b060aa4 Bump default PHP version to 8.1. 2022-09-09 10:35:11 -05:00
Jeff Geerling 090b3d759a
Merge pull request #73 from chrisdeeming/patch-1
Add support for PHP 8.1
2022-09-09 10:33:20 -05:00
Jeff Geerling a42d3d4807 Bump to Rocky Linux. 2022-06-30 01:49:29 -05:00
Jeff Geerling 421ce96755 Add role_name_check skipping to all molecule test suites. 2022-06-01 22:21:26 -05:00
Jeff Geerling 9bb3dc95b8 Update release workflow for more consistency. 2021-12-27 11:35:53 -06:00
Chris Deeming 4db29a4139
Add support for PHP 8.1
Tested and verified working.
2021-11-27 14:08:33 +00:00
Jeff Geerling 7c820847fe Make sure bugs aren't automatically closed. 2021-08-23 08:54:05 -05:00
Jeff Geerling 7ea6036859 Deprecate PHP 7.2 support and add warnings about using it. 2021-03-18 16:33:55 -05:00
Jeff Geerling 6a9b4b66ad
Merge pull request #64 from wells/feature/php-8
Add support for PHP 8.0
2021-03-18 16:29:34 -05:00
Brian Wells cab8a097c7 Fix set_fact. 2021-03-18 16:21:27 -05:00
Brian Wells 6afb5eef00 Use the version compare filter. 2021-03-18 15:16:05 -05:00
Brian Wells 24cff502be Remove php8.0-json for Debian builds. 2021-03-18 15:10:27 -05:00
Brian Wells e82190e1b0 Update ci.yml 2021-03-18 12:18:38 -05:00
Brian Wells ea9ee71842 Create 8.0.yml 2021-03-18 12:18:35 -05:00
Brian Wells 4203e796e6 Update setup-RedHat.yml 2021-03-18 12:17:42 -05:00
Brian Wells 0974f94c37 Update Debian.yml 2021-03-18 12:17:39 -05:00
Jeff Geerling d1fea7f256 Remove ansible-lint from roles. 2021-03-15 09:29:04 -05:00
Jeff Geerling bcb4a12a5e
Merge pull request #63 from gotmax23/patch-1
Fix error in ##Example Playbook
2021-03-07 00:28:23 -06:00
Maxwell Gottlieb 3562ade131
Fix error in ##Example Playbook 2021-03-06 22:09:55 -06:00
Jeff Geerling dbbc5421c1 Add role_name back in. 2021-02-22 17:18:53 -06:00
Jeff Geerling 38f6713816 Make ansible-lint work again. 2021-02-22 16:16:06 -06:00
Jeff Geerling 7460ff2c19
Merge pull request #55 from webarchitect609/bugfix/Unusable_php_packages_variable
fix: Unusable php_packages variable
2021-02-22 15:42:32 -06:00
Jeff Geerling 8d456ca374
Merge pull request #59 from luminouw/master
Added Ondřej Surý GPG key ID for Debian repo
2021-02-22 15:41:25 -06:00
luminouw 93f3fd3c34 Added Ondřej Surý GPG key ID for Debian repo
This commit adds the new key ID for the Debian repo of Ondřej Surý
to ensure the GPG key won't be downloaded by the apt_key module if
it's already installed on the system.

This modification is made for systems behind several firewalls or
filtering proxies on which the key is pre-deployed and when the
Ansible module doesn't work well with proxy env vars (eg. apt_key)
2021-02-22 16:43:14 +01:00
Jeff Geerling 055cfd201b
Merge pull request #58 from steinbrueckri/FixPowerTools
Yum repoid of Power Tools has changed from PowerTools to powertools
2021-02-18 08:58:17 -06:00
Richard Steinbrück 2c59b536e9 Yum repoid of Power Tools has changed from PowerTools to powertools 2021-02-16 21:35:34 +01:00
Sergey Gripinskiy 5b3cf3f760
fix: Unusable php_packages variable
It was impossible to set php_packages variable from a playbook when
using geerlingguy.php with geerlingguy.php-versions roles.
2020-11-22 14:26:08 +03:00
Jeff Geerling aa60a3d85a Dump Travis CI and move to GitHub Actions. 2020-11-05 15:47:41 -06:00
Jeff Geerling 5a1d694eb0 Switch to travis-ci.com. 2020-10-26 20:11:44 -05:00
Jeff Geerling d32913924e Make sure docker driver is installed with molecule. 2020-10-15 17:05:27 -05:00
Jeff Geerling 731382cbdd
Merge pull request #51 from oxyc/patch-1
Fix php 7.4 not purged on debian
2020-09-29 18:03:22 -05:00
Oskar Schöldström 8567f16e49
Fix php 7.4 not purged on debian 2020-09-08 12:47:04 -03:00
Jeff Geerling 19e545bcc5 Ignore the tyranny of ansible-lint rule 106. 2020-08-20 19:23:29 -05:00
Jeff Geerling 726185130a Upgrade Travis CI docker version to fix Molecule tests. 2020-08-12 14:56:25 -05:00
Jeff Geerling 2cba30273f Don't use galaxy role_name on roles with dashes in names. 2020-05-26 12:06:38 -05:00
Jeff Geerling 0eaa53f176 Ensure galaxy meta information is consistent on all my roles. 2020-05-26 09:47:12 -05:00
Jeff Geerling 7cd9b506ad Add probot/stale configuration to repository for stale issues. 2020-03-05 10:45:23 -06:00
Jeff Geerling ab0d295661 Make sure molecule lint script has set -e option. 2020-02-24 09:45:49 -06:00
Jeff Geerling 0d83161e8e Fix Ubuntu installation issue if dirmngr isn't present. 2020-02-20 16:44:42 -06:00
Jeff Geerling 405bdd4a7a Update molecule configuration to work with 3.0. 2020-02-20 15:55:38 -06:00
Jeff Geerling 3f24ae2d4e Update molecule configuration to work with 3.0. 2020-02-20 14:29:46 -06:00
Jeff Geerling 62a339bdb5 Update molecule configuration to work with 3.0. 2020-02-20 14:23:45 -06:00
Jeff Geerling d3870f3242 YAML syntax fix. 2019-12-11 10:50:35 -06:00
Jeff Geerling 5c5ec43ffc
Create FUNDING.yml 2019-12-11 09:51:58 -06:00
Jeff Geerling fe85f7a5b2 Fix completely broken config from previous commit on CentOS 7. 2019-12-03 14:18:30 -06:00
18 changed files with 242 additions and 88 deletions

View File

@ -1,3 +1,5 @@
skip_list:
- '306'
- '503'
- 'yaml'
- 'risky-shell-pipe'
- 'no-handler'
- 'role-name'

4
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,4 @@
# These are supported funding model platforms
---
github: geerlingguy
patreon: geerlingguy

90
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,90 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: "30 6 * * 4"
defaults:
run:
working-directory: 'geerlingguy.php-versions'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
path: 'geerlingguy.php-versions'
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install yamllint
- name: Lint code.
run: |
yamllint .
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Default PHP version.
- distro: rockylinux9
playbook: converge.yml
- distro: centos7
playbook: converge.yml
- distro: ubuntu2204
playbook: converge.yml
- distro: debian10
playbook: converge.yml
# PHP 8.1.
- distro: rockylinux8
playbook: 8.1.yml
- distro: ubuntu2004
playbook: 8.1.yml
- distro: debian10
playbook: 8.1.yml
# PHP 7.4.
- distro: rockylinux8
playbook: 7.4.yml
- distro: ubuntu2004
playbook: 7.4.yml
- distro: debian11
playbook: 7.4.yml
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
path: 'geerlingguy.php-versions'
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker
- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}

40
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,40 @@
---
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
# repository or organization.
#
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
# See: https://github.com/ansible/galaxy/issues/46
name: Release
'on':
push:
tags:
- '*'
defaults:
run:
working-directory: 'geerlingguy.php-versions'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
path: 'geerlingguy.php-versions'
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Ansible.
run: pip3 install ansible-core
- name: Trigger a new import on Galaxy.
run: >-
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)

34
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,34 @@
---
name: Close inactive issues
'on':
schedule:
- cron: "55 2 * * 6" # semi-random time
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
days-before-stale: 120
days-before-close: 60
exempt-issue-labels: bug,pinned,security,planned
exempt-pr-labels: bug,pinned,security,planned
stale-issue-label: "stale"
stale-pr-label: "stale"
stale-issue-message: |
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.
close-issue-message: |
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.
stale-pr-message: |
This pr 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.
close-pr-message: |
This pr 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.
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,46 +0,0 @@
---
language: python
services: docker
env:
global:
- ROLE_NAME: php-versions
matrix:
# Default PHP version (7.3).
- MOLECULE_DISTRO: centos8
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: ubuntu1604
- MOLECULE_DISTRO: debian10
# PHP 7.4.
- MOLECULE_DISTRO: centos8
MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd
MOLECULE_PLAYBOOK: playbook-7.4.yml
- MOLECULE_DISTRO: ubuntu1804
MOLECULE_PLAYBOOK: playbook-7.4.yml
- MOLECULE_DISTRO: debian10
MOLECULE_PLAYBOOK: playbook-7.4.yml
# PHP 7.2.
- MOLECULE_DISTRO: centos8
MOLECULE_PLAYBOOK: playbook-7.2.yml
- MOLECULE_DISTRO: ubuntu1804
MOLECULE_PLAYBOOK: playbook-7.2.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:
# Run tests.
- molecule test
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,6 +1,10 @@
---
extends: default
rules:
line-length:
max: 120
level: warning
ignore: |
.github/workflows/stale.yml

View File

@ -1,6 +1,6 @@
# Ansible Role: PHP Versions
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php-versions.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php-versions)
[![CI](https://github.com/geerlingguy/ansible-role-php-versions/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-php-versions/actions?query=workflow%3ACI)
Allows different PHP versions to be installed when using the `geerlingguy.php` role (or a similar role). This role was originally built for [Drupal VM](https://www.drupalvm.com) but was released more generically so others could use an easier mechanism for switching PHP versions.
@ -12,9 +12,9 @@ N/A
Available variables are listed below, along with default values (see `defaults/main.yml`):
php_version: '7.3'
php_version: '8.2'
The PHP version to be installed. Any [currently-supported PHP major version](http://php.net/supported-versions.php) is a valid option (e.g. `7.2`, `7.3`, `7.4` etc.).
The PHP version to be installed. Any [currently-supported PHP major version](http://php.net/supported-versions.php) is a valid option (e.g. `7.4`, `8.0`, `8.1`, or `8.2`).
php_versions_install_recommends: false
@ -28,12 +28,13 @@ The PHP version to be installed. Any [currently-supported PHP major version](htt
## Example Playbook
- hosts: webservers
become: true
vars:
php_version: '7.3'
php_version: '8.2'
roles:
- role: geerlingguy.repo-remi
- name: geerlingguy.repo-remi
when: ansible_os_family == 'RedHat'
- geerlingguy.php-versions
- geerlingguy.php

View File

@ -1,6 +1,6 @@
---
# The PHP version to be installed.
php_version: '7.3'
php_version: '8.2'
# For Debian OSes only.
php_versions_install_recommends: false

View File

@ -2,16 +2,14 @@
dependencies: []
galaxy_info:
role_name: php-versions
author: geerlingguy
description: Allows different PHP versions to be installed.
company: "Midwestern Mac, LLC"
license: "MIT"
issue_tracker_url: https://github.com/geerlingguy/ansible-role-php-versions/issues
min_ansible_version: 2.4
min_ansible_version: 2.10
platforms:
- name: EL
versions:
- all
- name: Debian
versions:
- all
@ -20,6 +18,7 @@ galaxy_info:
- trusty
- xenial
- bionic
- jammy
galaxy_tags:
- php
- web

View File

@ -5,7 +5,7 @@
vars:
php_enable_webserver: false
php_version: '7.2'
php_version: '8.1'
pre_tasks:
- name: Update apt cache.

View File

@ -1,29 +1,21 @@
---
role_name_check: 1
dependency:
name: galaxy
options:
ignore-errors: true
driver:
name: docker
lint:
name: yamllint
options:
config-file: molecule/default/yaml-lint.yml
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
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
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

View File

@ -5,11 +5,18 @@
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}-php{{ php_version }}.yml"
- name: Remove missing JSON extension for PHP 8.0 (included by default)
set_fact:
__php_packages: "{{ __php_packages | reject('search','php' + php_version + '-json') | list }}"
when:
- __php_packages is defined
- php_version is version('8.0', '>=')
- name: Define PHP variables.
set_fact: "{{ item.key }}={{ lookup('vars', item.value) }}"
when:
- hostvars[inventory_hostname][item.key] is undefined
- hostvars[inventory_hostname][item.value] is defined
- vars[item.key] is undefined
- vars[item.value] is defined
with_dict:
php_conf_paths: __php_conf_paths
php_extension_conf_paths: __php_extension_conf_paths

View File

@ -3,6 +3,11 @@
set_fact:
php_opcache_conf_filename: "10-opcache.ini"
- name: Ensure dirmngr is installed (gnupg dependency).
apt:
name: dirmngr
state: present
- name: Add repository for PHP versions (Ubuntu).
apt_repository: repo='ppa:ondrej/php'
when: ansible_distribution == "Ubuntu"
@ -19,6 +24,7 @@
- name: Add Ondrej Sury's apt key (Debian).
apt_key:
url: https://packages.sury.org/php/apt.gpg
id: 15058500A0235D97F5D10063B188E2B695BD4743
state: present
when: ansible_distribution == "Debian"

View File

@ -1,4 +1,6 @@
---
# TODO: PHP 7.2 support will be removed soon. This is only being left in here as
# a convenience for legacy PHP 7.2 users.
- name: Enable remi repo for PHP 7.2.
set_fact: php_enablerepo="remi,remi-php72"
when: php_version == "7.2"
@ -11,18 +13,33 @@
set_fact: php_enablerepo="remi,remi-php74"
when: php_version == "7.4"
- name: Enable remi repo for PHP 8.0.
set_fact: php_enablerepo="remi,remi-php80"
when: php_version == "8.0"
- name: Enable remi repo for PHP 8.1.
set_fact: php_enablerepo="remi,remi-php81"
when: php_version == "8.1"
- name: Enable remi repo for PHP 8.2.
set_fact: php_enablerepo="remi,remi-php82"
when: php_version == "8.2"
# See: https://github.com/ansible/ansible/issues/64852
- block:
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled PowerTools
dnf module enable -y php:remi-{{ php_version }}
args:
warn: false
register: dnf_module_enable
changed_when: "'Nothing to do' not in dnf_module_enable.stdout"
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled powertools
dnf module enable -y php:remi-{{ php_version }}
register: dnf_module_enable
changed_when: "'Nothing to do' not in dnf_module_enable.stdout"
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8

View File

@ -39,5 +39,9 @@ __php_packages:
- "php{{ php_version }}-yaml"
php_versions_debian:
# TODO: PHP 7.2 support will be removed soon. This is only being left in here as
# a convenience for legacy PHP 7.2 users.
- php7.2-common
- php7.3-common
- php7.4-common
- php8.0-common