mirror of
https://github.com/status-im/ansible-role-mongodb.git
synced 2025-01-25 20:48:52 +00:00
Update formating and fix tests.
This commit is contained in:
parent
fc41e73edf
commit
79269de800
28
.travis.yml
28
.travis.yml
@ -11,116 +11,144 @@ env:
|
||||
DIST_VERSION=18_04-builded
|
||||
MONGODB_VERSION=4.2
|
||||
MONGODB_PACKAGE=mongodb-org
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=18_04-builded
|
||||
MONGODB_VERSION=4.0
|
||||
MONGODB_PACKAGE=mongodb-org
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=18_04-builded
|
||||
MONGODB_VERSION=3.6
|
||||
MONGODB_PACKAGE=mongodb
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=16_04-builded
|
||||
MONGODB_VERSION=4.2
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=16_04-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=16_04-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu
|
||||
DIST_VERSION=16_04-builded
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu-upstart
|
||||
DIST_VERSION=14.04
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu-upstart
|
||||
DIST_VERSION=14.04
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=ubuntu-upstart
|
||||
DIST_VERSION=14.04
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=9-builded
|
||||
MONGODB_VERSION=4.2
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=9-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=9-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=8-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=8-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=8-builded
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6-builded
|
||||
MONGODB_VERSION=4.2
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=6-builded
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7-builded
|
||||
MONGODB_VERSION=4.2
|
||||
DOCKER_PRIVILEGED=false
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=false
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=false
|
||||
- >
|
||||
DISTRIBUTION=centos
|
||||
DIST_VERSION=7-builded
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=false
|
||||
- >
|
||||
DISTRIBUTION=amazonlinux
|
||||
DIST_VERSION=2-builded
|
||||
MONGODB_VERSION=4.2
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=amazonlinux
|
||||
DIST_VERSION=2-builded
|
||||
MONGODB_VERSION=4.0
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=amazonlinux
|
||||
DIST_VERSION=2-builded
|
||||
MONGODB_VERSION=3.6
|
||||
DOCKER_PRIVILEGED=true
|
||||
- >
|
||||
DISTRIBUTION=amazonlinux
|
||||
DIST_VERSION=2-builded
|
||||
MONGODB_VERSION=3.4
|
||||
DOCKER_PRIVILEGED=true
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
@ -3,7 +3,9 @@
|
||||
- name: reload systemd
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
when: ansible_service_mgr == "systemd" and mongodb_manage_service | bool
|
||||
when:
|
||||
- ansible_service_mgr == "systemd"
|
||||
- mongodb_manage_service | bool
|
||||
|
||||
- name: mongodb reload
|
||||
service:
|
||||
|
@ -65,7 +65,9 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
|
||||
when:
|
||||
- ansible_service_mgr == "systemd"
|
||||
- mongodb_manage_systemd_unit | bool
|
||||
notify:
|
||||
- reload systemd
|
||||
|
||||
@ -74,7 +76,9 @@
|
||||
src: "/lib/systemd/system/{{mongodb_daemon_name}}.service"
|
||||
dest: "/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service"
|
||||
state: link
|
||||
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
|
||||
when:
|
||||
- ansible_service_mgr == "systemd"
|
||||
- mongodb_manage_systemd_unit | bool
|
||||
notify:
|
||||
- reload systemd
|
||||
|
||||
|
@ -3,12 +3,12 @@ FROM amazonlinux:2
|
||||
# This is needed so that ansible managed to read "ansible_default_ipv4"
|
||||
RUN yum install iproute -y
|
||||
|
||||
# This step is needed since standard CentOS docker image does not come with init-functions installed by default.
|
||||
# This package seems to be required for Mongo 3.2 and downwards
|
||||
RUN yum install initscripts -y
|
||||
|
||||
# we can has SSH
|
||||
EXPOSE 22
|
||||
|
||||
# This step is needed since standard CentOS docker image does not come with i
|
||||
# This package seems to be required for Mongo 3.2 and downwards
|
||||
RUN yum install initscripts -y
|
||||
|
||||
# pepare for takeoff
|
||||
CMD ["/usr/sbin/init"]
|
||||
|
@ -6,10 +6,6 @@ RUN yum install iproute -y
|
||||
# This step is needed since standard CentOS docker image does not come with EPEL installed by default
|
||||
RUN yum install epel-release -y
|
||||
|
||||
# This step is needed since standard CentOS docker image does not come with init-functions installed by default.
|
||||
# This package seems to be required for Mongo 3.2 and downwards
|
||||
RUN yum install initscripts -y
|
||||
|
||||
# we can has SSH
|
||||
EXPOSE 22
|
||||
|
||||
|
@ -12,39 +12,39 @@ set -o errexit
|
||||
|
||||
package=${MONGODB_PACKAGE:-mongodb-org}
|
||||
# Test 1
|
||||
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}
|
||||
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e docker_privileged=${DOCKER_PRIVILEGED} -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 docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
||||
# Idempotence test
|
||||
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 docker_privileged=${DOCKER_PRIVILEGED} -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_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'
|
||||
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e docker_privileged=${DOCKER_PRIVILEGED} -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 docker_privileged=${DOCKER_PRIVILEGED} -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_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled' \
|
||||
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e docker_privileged=${DOCKER_PRIVILEGED} -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_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'
|
||||
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -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 docker_privileged=${DOCKER_PRIVILEGED} -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_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' \
|
||||
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -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_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'
|
||||
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -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 docker_privileged=${DOCKER_PRIVILEGED} -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_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 docker_privileged=${DOCKER_PRIVILEGED} -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)
|
||||
|
@ -11,7 +11,18 @@
|
||||
image: "{{ image_name }}"
|
||||
command: "/sbin/init"
|
||||
state: started
|
||||
privileged: true
|
||||
privileged: "{{ docker_privileged }}"
|
||||
mounts:
|
||||
- type: bind
|
||||
source: /sys/fs/cgroup
|
||||
target: /sys/fs/cgroup
|
||||
- type: bind
|
||||
source: /sys/fs/fuse
|
||||
target: /sys/fs/fuse
|
||||
- type: tmpfs
|
||||
target: /run
|
||||
- type: tmpfs
|
||||
target: /run/lock
|
||||
with_items:
|
||||
- mongo1
|
||||
- mongo2
|
||||
|
Loading…
x
Reference in New Issue
Block a user