From 2aa63f5f1618ea0d3b6cc97d77816bc8cbe59897 Mon Sep 17 00:00:00 2001 From: Sergei Antipov Date: Thu, 15 Feb 2018 13:14:31 +0700 Subject: [PATCH] Fix warnings --- .travis.yml | 10 +++++++--- meta/main.yml | 4 ++-- tasks/configure.yml | 5 +++-- tasks/install.debian.yml | 2 +- tasks/main.yml | 14 +++++++------- tasks/replication_init_auth.yml | 2 +- tests/site.yml | 3 +-- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8dbf6ce..e9848ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,9 +88,13 @@ before_install: - sudo pip install docker-py==1.5.0 # Pull docker image or build it - > - if [ -f tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} ]; then - sudo docker build --rm=true --file=tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} - --tag ${DISTRIBUTION}:${DIST_VERSION} tests; else sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}; fi + if [ -f tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} ] + then + sudo docker build --rm=true --file=tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} + --tag ${DISTRIBUTION}:${DIST_VERSION} tests + else + sudo docker pull ${DISTRIBUTION}:${DIST_VERSION} + fi - sudo ln -s ${PWD} /etc/ansible/roles/greendayonfire.mongodb script: diff --git a/meta/main.yml b/meta/main.yml index c2eb4a4..ab3dd94 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,10 +4,10 @@ dependencies: [] galaxy_info: author: Sergei Antipov - company: 2GIS + company: Self-employed description: Manage MongoDB with authentication and replica sets license: GPLv2 - min_ansible_version: 2.0 + min_ansible_version: 2.4 platforms: - name: Ubuntu versions: diff --git a/tasks/configure.yml b/tasks/configure.yml index 9b74a76..9b213c2 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -32,8 +32,9 @@ - name: Create log if missing file: state=touch dest={{ mongodb_systemlog_path }} owner={{ mongodb_user }} group={{mongodb_user}} mode=0755 - when: logfile_stat is defined and not logfile_stat.stat.exists - when: mongodb_systemlog_destination == "file" + when: ( logfile_stat is defined + and not logfile_stat.stat.exists + and mongodb_systemlog_destination == "file" ) - name: Ensure dbpath directory file: diff --git a/tasks/install.debian.yml b/tasks/install.debian.yml index ae966a0..04f9853 100644 --- a/tasks/install.debian.yml +++ b/tasks/install.debian.yml @@ -4,7 +4,7 @@ stat: path=/sbin/init register: sbin_init changed_when: false - always_run: yes # side-effect free, so it can be run in check-mode as well + check_mode: no - name: Establish some role-related facts set_fact: diff --git a/tasks/main.yml b/tasks/main.yml index 94d1121..94d0c8d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,15 +7,15 @@ - "{{ ansible_os_family }}.yml" - name: Include installation on Debian-based OS - include: "install.{{ ansible_os_family | lower }}.yml" + include_tasks: "install.{{ ansible_os_family | lower }}.yml" tags: [mongodb] - name: Include configuration.yml - include: configure.yml + include_tasks: configure.yml tags: [mongodb] - name: Include replication and auth configuration - include: replication_init_auth.yml + include_tasks: replication_init_auth.yml when: ( mongodb_replication_replset and mongodb_replication_replset != '' and mongodb_security_authorization == 'enabled' @@ -23,7 +23,7 @@ tags: [mongodb] - name: Include replication configuration - include: replication.yml + include_tasks: replication.yml when: mongodb_replication_replset and mongodb_replication_replset != '' tags: [mongodb] @@ -33,7 +33,7 @@ -p {{ mongodb_user_admin_password }} --port {{ mongodb_net_port }} --eval 'db.version()' admin register: mongodb_user_admin_check changed_when: false - always_run: yes # side-effect free, so it can be run in check-mode as well + check_mode: no ignore_errors: true when: ( mongodb_security_authorization == 'enabled' and (not mongodb_replication_replset @@ -42,7 +42,7 @@ tags: [mongodb] - name: Include authorization configuration - include: auth_initialization.yml + include_tasks: auth_initialization.yml when: ( mongodb_security_authorization == 'enabled' and (not mongodb_replication_replset or mongodb_replication_replset == '') @@ -88,6 +88,6 @@ tags: [mongodb] - name: Include MMS Agent configuration - include: mms-agent.yml + include_tasks: mms-agent.yml when: mongodb_mms_api_key != "" tags: [mongodb] diff --git a/tasks/replication_init_auth.yml b/tasks/replication_init_auth.yml index 4d75642..933d957 100644 --- a/tasks/replication_init_auth.yml +++ b/tasks/replication_init_auth.yml @@ -16,7 +16,7 @@ register: mongodb_replica_init ignore_errors: true -- include: auth_initialization.yml +- include_tasks: auth_initialization.yml when: mongodb_replica_init|failed - name: Replication configuration | 2nd Pt diff --git a/tests/site.yml b/tests/site.yml index f6d861f..6c08bde 100644 --- a/tests/site.yml +++ b/tests/site.yml @@ -6,7 +6,7 @@ gather_facts: no tasks: - name: Run MongoDB cluster in Docker - docker: + docker_container: name: "{{ item }}" image: "{{ image_name }}" command: "/sbin/init" @@ -31,4 +31,3 @@ roles: - role: greendayonfire.mongodb when: "'mongo_replicas' in group_names" -