Skip to content

Commit

Permalink
Merge pull request #119 from UnderGreen/debian_9_official
Browse files Browse the repository at this point in the history
Added support of MongoDB 3.6 for Debian Stretch
  • Loading branch information
UnderGreen authored Jul 13, 2018
2 parents 4cceeef + b751c07 commit db1e4cd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ env:
DISTRIBUTION=ubuntu-upstart
DIST_VERSION=14.04
MONGODB_VERSION=3.2
- >
DISTRIBUTION=debian
DIST_VERSION=9-builded
MONGODB_VERSION=3.6
- >
DISTRIBUTION=debian
DIST_VERSION=9-builded
MONGODB_VERSION=3.2
MONGODB_PACKAGE=mongodb
- >
DISTRIBUTION=debian
DIST_VERSION=8-builded
Expand Down Expand Up @@ -71,9 +76,6 @@ env:
DISTRIBUTION=centos
DIST_VERSION=7-builded
MONGODB_VERSION=3.2
# - >
# distribution=debian
# version=7
services:
- docker
Expand Down
15 changes: 9 additions & 6 deletions tasks/install.debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@
mongodb_is_systemd: "{{ sbin_init.stat.islnk is defined and sbin_init.stat.islnk }}"
mongodb_major_version: "{{ mongodb_version[0:3] }}"

- name: Overwrite mongodb_version especially for Debian 9
set_fact:
mongodb_major_version: "3.2"
when: ansible_distribution_release == "stretch"

- name: Add APT key
apt_key:
keyserver: "{{ mongodb_apt_keyserver }}"
id: "{{ mongodb_apt_key_id[mongodb_major_version] }}"
when: mongodb_package == 'mongodb-org'

- name: Fail when used wrong mongodb_version variable with Debian Stretch
fail:
msg: "mongodb_version variable should be '3.2' or '3.6' for Debian Stretch"
when: (mongodb_package == 'mongodb-org' and
(mongodb_version is not defined
or mongodb_repository[mongodb_major_version] is not defined
or mongodb_version != "3.6") and ansible_distribution_release == "stretch")

- name: Fail when used wrong mongodb_version variable
fail:
msg: "mongodb_version variable should be '2.6', '3.0' or '3.2'"
msg: "mongodb_version variable should be '3.2', '3.4' or '3.6'"
when: (mongodb_package == 'mongodb-org' and
(mongodb_version is not defined
or mongodb_repository[mongodb_major_version] is not defined))
Expand Down
1 change: 1 addition & 0 deletions tests/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---

image_name: "ubuntu-upstart:14.04"
mongodb_package: mongodb-org
mongodb_version: "3.6"
mongodb_storage_dbpath: /var/lib/mongodb
mongodb_net_bindip: 0.0.0.0
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- mode: sh; -*-

# File: before_install.sh
# Time-stamp: <2018-02-15 15:54:06>
# Time-stamp: <2018-07-12 18:05:37>
# Copyright (C) 2018 Sergei Antipov
# Description:

Expand Down
27 changes: 14 additions & 13 deletions tests/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,49 @@
# -*- mode: sh; -*-

# File: test.sh
# Time-stamp: <2018-02-26 16:04:24>
# Time-stamp: <2018-07-13 11:05:31>
# Copyright (C) 2018 Sergei Antipov
# Description:

# set -o xtrace
set -o nounset
set -o errexit

package=${MONGODB_PACKAGE:-mongodb-org}
# Test 1
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}
# Idempotence test
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION} | \
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION} | \
grep -q 'changed=0.*failed=0' && \
(echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
# Delete all containers
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}

# Test 2
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
# Idempotence test
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled' \
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled' \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
# Delete all containers
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}

# Test 3
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
# Idempotence test
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' \
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
# Delete all containers
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}

# Test 4
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'"
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'
# Idempotence test
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled' \
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled' \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
3 changes: 0 additions & 3 deletions vars/stretch.yml

This file was deleted.

0 comments on commit db1e4cd

Please sign in to comment.