Skip to content

Commit

Permalink
Merge pull request #20 from devjatkin/bump_versions
Browse files Browse the repository at this point in the history
Bump versions and switch to molecule
  • Loading branch information
devjatkin authored Dec 3, 2020
2 parents da89343 + ffa6660 commit ae757b5
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 58 deletions.
28 changes: 0 additions & 28 deletions .kitchen.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ language: generic
python: "2.7"

sudo: required
dist: trusty
dist: bionic

matrix:
include:
- env: ANSIBLE_VERSION=1.9.6
- env: ANSIBLE_VERSION=2.1.2.0
- env: ANSIBLE_VERSION=2.8.6
- env: ANSIBLE_VERSION=2.10.2

before_install:
- sudo apt-get update -qq
- sudo apt-get install -y git software-properties-common python-pip aptitude
- sudo aptitude install -y mysql-client-5.5
- sudo apt-get install -y mysql-client
- sudo pip install ansible==$ANSIBLE_VERSION
- ansible --version

Expand Down
2 changes: 0 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ sphinx_searchd:
read_timeout: 5
max_children: 30
pid_file: "{{ sphinx_rundir }}/searchd.pid"
max_matches: 1000
seamless_rotate: 1
preopen_indexes: 1
unlink_old: 1
Expand All @@ -34,4 +33,3 @@ sphinx_indexes:
name: "test_index"
source: "test_source"
path: "{{ sphinx_datadir }}/data/test_index"
charset_type: "utf-8"
11 changes: 7 additions & 4 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---

- name: rotate all indexes
command: /usr/bin/indexer --rotate --all
register: rotate_result
failed_when: "rotate_result.rc > 0 and 'no indexes found' not in rotate_result.stdout"
- name: generate all indexes
command: /usr/bin/indexer --all

- name: restart sphinx
service: name="{{ sphinx_service_name }}" state=restarted

- name: reload sphinx
service: name="{{ sphinx_service_name }}" state=reloaded

- name: rotate all indexes
command: /usr/bin/indexer --rotate --all
register: rotate_result
failed_when: "rotate_result.rc > 0 and 'no indexes found' not in rotate_result.stdout"
8 changes: 5 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
galaxy_info:
author: "Semyon Deviatkin"
description: This role installs and configures the Sphinx search engine.
license: BSD
min_ansible_version: 1.4
min_ansible_version: 2.8.6
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: Debian
versions:
- buster
- wheezy
- jessie
- name: EL
versions:
- 7
Expand Down
23 changes: 23 additions & 0 deletions molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*********************************
Vagrant driver installation guide
*********************************

Requirements
============

* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash
$ pip install 'molecule_vagrant'
8 changes: 8 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
become: yes
tasks:
- name: "Include sphinx"
include_role:
name: "sphinx"
1 change: 1 addition & 0 deletions molecule/default/files
19 changes: 19 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
dependency:
name: galaxy
driver:
name: vagrant
platforms:
- name: instance
box: bento/ubuntu-20.04
memory: 512
cpus: 1
lint: |
set -e
yamllint *.yml
ansible-lint
# flake8
provisioner:
name: ansible
verifier:
name: ansible
13 changes: 13 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
become: yes
gather_facts: false
tasks:
- name: Example assertion
command: /usr/local/bin/bats ./test/integration/default/bats/*.bats
- name: Example assertion
assert:
that: true
6 changes: 3 additions & 3 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- name: Tune net.ipv4.tcp_max_syn_backlog
sysctl:
name: net.ipv4.tcp_max_syn_backlog
value: 4096
value: '4096'
state: present
reload: yes

Expand All @@ -20,10 +20,10 @@
owner: root
group: root
mode: 0644
when: sphinx_use_ext_config == False
when: not sphinx_use_ext_config
notify:
- rotate all indexes
- restart sphinx

- include: ext_config.yml
when: sphinx_use_ext_config == True
when: sphinx_use_ext_config
2 changes: 1 addition & 1 deletion tasks/ext_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
mode: 0755
state: directory
with_items:
"conf.d"
- "conf.d"

- name: Create the configuration file searchd.conf
template:
Expand Down
2 changes: 0 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@

- name: Ensure sphinx is running and enabled
service: name="{{ sphinx_service_name }}" state=started enabled=yes
tags:
- test
12 changes: 2 additions & 10 deletions tasks/package.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
---

- name: Add backports repository for Jessie release
apt_repository: repo="deb http://ftp.debian.org/debian jessie-backports main" state=present
when: ansible_os_family == "Debian" and ansible_distribution_release == "jessie"

- name: Install sphinx Debian package
apt: name={{ item }} state=present update_cache=yes
with_items: "{{ ubuntu_pkg }}"
apt: name="{{ ubuntu_pkg }}" state=present update_cache=yes
when: ansible_os_family == "Debian"

- name: Install sphinx RedHat dependencies
yum: name={{ item }} state=present
with_items:
- postgresql-libs
- unixODBC
yum: name="{{ rhel_dep_pkg }}" state=present
when: ansible_os_family == "RedHat"

- name: Install sphinx RedHat package
Expand Down
2 changes: 2 additions & 0 deletions tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
owner: root
group: root
mode: 0644
notify:
- generate all indexes
tags:
- test
2 changes: 1 addition & 1 deletion test/integration/default.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

---
- hosts: all
roles:
- sphinx
4 changes: 4 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
ubuntu_pkg:
- sphinxsearch

rhel_dep_pkg:
- postgresql-libs
- unixODBC

rhel_pkg:
- http://sphinxsearch.com/files/sphinx-2.3.2-1.rhel7.x86_64.rpm

0 comments on commit ae757b5

Please sign in to comment.