Skip to content

Commit

Permalink
Add Debian 8 support; Update README, molecule, and travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmdln committed Mar 24, 2020
1 parent 783fd72 commit a4f1e06
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 50 deletions.
145 changes: 145 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
.vscode

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# static files generated from Django application using `collectstatic`
media
static
23 changes: 8 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
---
language: python
services:
- docker
services: docker

addons:
apt:
packages:
- python3-pip

env:
global:
- ROLE_NAME="redis"
matrix:
- MOLECULE_DISTRO="centos-7"
- MOLECULE_DISTRO="centos-8"
- MOLECULE_DISTRO="debian-8"
- MOLECULE_DISTRO="debian-9"
- MOLECULE_DISTRO="debian-10"
- MOLECULE_DISTRO="ubuntu-16.04"
- MOLECULE_DISTRO="ubuntu-18.04"

addons:
apt:
packages:
- python3-pip

install:
- pip install ansible ansible-lint docker molecule[docker] testinfra yamllint

before_script:
- cd ../
- mv ansible-role-$ROLE_NAME inmotionhosting.$ROLE_NAME
- cd inmotionhosting.$ROLE_NAME
- pip install -r requirements.txt

script:
- molecule test
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Requirements
------------

* CentOS 7.x or later
* Debian 9 or later
* Debian 8 or later
* Ubuntu 16.04 LTS or later

Role Variables
Expand Down Expand Up @@ -53,4 +53,4 @@ GPLv3
Author Information
------------------

InMotion Hosting
[InMotion Hosting](https://inmotionhosting.com)
5 changes: 4 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ galaxy_info:
- bionic

galaxy_tags:
- web
- cache
- database
- redis
- performance
- web

dependencies: []
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- name: Converge
hosts: all
roles:
- role: inmotionhosting.redis
- role: ansible-role-redis
6 changes: 2 additions & 4 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ driver:
name: docker

platforms:
- name: "molecule-redis-${MOLECULE_DISTRO:-centos-7}"
image: "jcmdln/molecule-images:${MOLECULE_DISTRO:-centos-7}"
capabilities:
- SYS_ADMIN
- name: "molecule_inmotionhosting.redis_${MOLECULE_DISTRO:-centos-7}"
image: "inmotionhosting/molecule-images:${MOLECULE_DISTRO:-centos-7}"
command: ""
pre_build_image: true
privileged: true
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ansible>=2.8,<3
docker
molecule[docker]>=3.0.0,<4
27 changes: 17 additions & 10 deletions tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
---
- name: (Debian 9) Add backports repo for Redis 5
when:
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '9'
apt_repository:
repo: 'deb http://ftp.debian.org/debian stretch-backports main'
repo: "deb http://ftp.debian.org/debian stretch-backports main"
state: present
filename: 'stretch-backports'

- name: (Debian 9) Install Redis from backports
filename: "stretch-backports"
when:
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '9'

- name: (Debian 9) Install Redis from backports
package:
name: "{{ redis_packages }}"
default_release: stretch-backports
state: present
register: redis_installed
when:
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '9'

- name: (Debian 8) Install Redis from backports
set_fact:
redis_daemon: redis-server
when:
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '8'

- name: (Ubuntu) Update APT cache
when: ansible_distribution == 'Ubuntu'
package:
apt:
force_apt_get: true
update_cache: true
cache_valid_time: 3600
cache_valid_time: "3600"
state: present
when: ansible_distribution == 'Ubuntu'
Loading

0 comments on commit a4f1e06

Please sign in to comment.