Compare commits
55 Commits
Author | SHA1 | Date |
---|---|---|
|
bf9bf9de00 | |
|
bac5cdbe9b | |
|
e66e110c5d | |
|
f26da32537 | |
|
67c11836d4 | |
|
f296994c76 | |
|
d241f91947 | |
|
3c0a24606f | |
|
bae936d2dc | |
|
c942861308 | |
|
574b060aa4 | |
|
090b3d759a | |
|
a42d3d4807 | |
|
421ce96755 | |
|
9bb3dc95b8 | |
|
4db29a4139 | |
|
7c820847fe | |
|
7ea6036859 | |
|
6a9b4b66ad | |
|
cab8a097c7 | |
|
6afb5eef00 | |
|
24cff502be | |
|
e82190e1b0 | |
|
ea9ee71842 | |
|
4203e796e6 | |
|
0974f94c37 | |
|
d1fea7f256 | |
|
bcb4a12a5e | |
|
3562ade131 | |
|
dbbc5421c1 | |
|
38f6713816 | |
|
7460ff2c19 | |
|
8d456ca374 | |
|
93f3fd3c34 | |
|
055cfd201b | |
|
2c59b536e9 | |
|
5b3cf3f760 | |
|
aa60a3d85a | |
|
5a1d694eb0 | |
|
d32913924e | |
|
731382cbdd | |
|
8567f16e49 | |
|
19e545bcc5 | |
|
726185130a | |
|
2cba30273f | |
|
0eaa53f176 | |
|
7cd9b506ad | |
|
ab0d295661 | |
|
0d83161e8e | |
|
405bdd4a7a | |
|
3f24ae2d4e | |
|
62a339bdb5 | |
|
d3870f3242 | |
|
5c5ec43ffc | |
|
fe85f7a5b2 |
|
@ -1,3 +1,5 @@
|
|||
skip_list:
|
||||
- '306'
|
||||
- '503'
|
||||
- 'yaml'
|
||||
- 'risky-shell-pipe'
|
||||
- 'no-handler'
|
||||
- 'role-name'
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# These are supported funding model platforms
|
||||
---
|
||||
github: geerlingguy
|
||||
patreon: geerlingguy
|
|
@ -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 }}
|
|
@ -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)
|
|
@ -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 }}
|
46
.travis.yml
46
.travis.yml
|
@ -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/
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
||||
|
||||
ignore: |
|
||||
.github/workflows/stale.yml
|
11
README.md
11
README.md
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
vars:
|
||||
php_enable_webserver: false
|
||||
php_version: '7.2'
|
||||
php_version: '8.1'
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue