Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Issue #1177: Add DotDeb repo for later PHP version support.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Mar 15, 2017
1 parent 47710cf commit d4d2f0c
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 0 deletions.
1 change: 1 addition & 0 deletions provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
roles:
# Essential roles.
- { role: geerlingguy.repo-remi, when: ansible_os_family == 'RedHat', tags: ['webserver, php'] }
- { role: geerlingguy.repo-dotdeb, when: ansible_distribution == 'Debian' }
- { role: geerlingguy.firewall }
- { role: geerlingguy.git }
- { role: geerlingguy.postfix }
Expand Down
2 changes: 2 additions & 0 deletions provisioning/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
version: 1.0.2
- src: geerlingguy.redis
version: 1.4.1
- src: geerlingguy.repo-dotdeb
version: 1.0.2
- src: geerlingguy.repo-remi
version: 1.2.0
- src: geerlingguy.ruby
Expand Down
44 changes: 44 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
sudo: required

env:
- distro: debian8
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"

services:
- docker

before_install:
# Pull container.
- 'sudo docker pull geerlingguy/docker-${distro}-ansible:latest'

script:
- container_id=$(mktemp)
# Run container in detached state.
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

# Install dependencies.
- 'sudo docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml'

# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'

# Test role.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'

# Test role idempotence.
- idempotence=$(mktemp)
- sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
- >
tail ${idempotence}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
after_success:
# Clean up.
- 'sudo docker stop "$(cat ${container_id})"'

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
38 changes: 38 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Ansible Role: DotDeb Repository

[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-repo-dotdeb.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-repo-dotdeb)

Installs the [DotDeb repository](https://www.dotdeb.org/) for Debian.

## Requirements

This role only is needed/runs on Debian and its derivatives.

## Role Variables

Available variables are listed below, along with default values (see `defaults/main.yml`):

dotdeb_sources:
- "deb http://packages.dotdeb.org {{ ansible_distribution_release }} all"
- "deb-src http://packages.dotdeb.org {{ ansible_distribution_release }} all"
dotdeb_repo_gpg_key_url: https://www.dotdeb.org/dotdeb.gpg

The DotDeb repos and GPG key URL. Generally, these should not be changed, but if this role is out of date, or if you need a very specific version, these can both be overridden.

## Dependencies

None.

## Example Playbook

- hosts: servers
roles:
- geerlingguy.repo-dotdeb

## License

MIT / BSD

## Author Information

This role was created in 2016 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
5 changes: 5 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
dotdeb_sources:
- "deb http://packages.dotdeb.org {{ ansible_distribution_release }} all"
- "deb-src http://packages.dotdeb.org {{ ansible_distribution_release }} all"
dotdeb_repo_gpg_key_url: https://www.dotdeb.org/dotdeb.gpg
15 changes: 15 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
dependencies: []

galaxy_info:
author: geerlingguy
description: DotDeb repository for Debian.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
platforms:
- name: Debian
versions:
- all
galaxy_tags:
- packaging
15 changes: 15 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Install DotDeb repo.
apt_repository:
repo: "{{ item }}"
with_items: "{{ dotdeb_sources }}"
register: dotdeb_apt_repo_result

- name: Import DotDeb GPG key.
apt_key:
url: "{{ dotdeb_repo_gpg_key_url }}"
register: dotdeb_apt_key_result

- name: Update apt cache if repo or key added.
apt: update_cache=yes
when: dotdeb_apt_repo_result.changed or dotdeb_apt_key_result.changed
5 changes: 5 additions & 0 deletions provisioning/roles/geerlingguy.repo-dotdeb/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: all

roles:
- role_under_test

0 comments on commit d4d2f0c

Please sign in to comment.