diff --git a/tasks/replication.yml b/tasks/replication.yml index ad51da2..0448ff1 100644 --- a/tasks/replication.yml +++ b/tasks/replication.yml @@ -14,7 +14,7 @@ priority: "{{ item.priority|default(1.0) }}" when: mongodb_conf_auth and mongodb_replication_params is defined with_items: - - "{{ mongodb_replication_params }}" + - "{{ mongodb_replication_params|default([]) }}" - name: Replication configuration without auth mongodb_replication: @@ -28,4 +28,4 @@ priority: "{{ item.priority|default(1.0) }}" when: not mongodb_conf_auth and mongodb_replication_params is defined with_items: - - "{{ mongodb_replication_params }}" + - "{{ mongodb_replication_params|default([]) }}" diff --git a/tasks/replication_init_auth.yml b/tasks/replication_init_auth.yml index 8947cbb..513fdbb 100644 --- a/tasks/replication_init_auth.yml +++ b/tasks/replication_init_auth.yml @@ -11,8 +11,9 @@ host_type: "{{ item.host_type|default('replica') }}" hidden: "{{ item.hidden|default(false) }}" priority: "{{ item.priority|default(1.0) }}" + when: mongodb_replication_params is defined with_items: - - "{{ mongodb_replication_params }}" + - "{{ mongodb_replication_params|default([]) }}" register: mongodb_replica_init ignore_errors: true @@ -31,6 +32,7 @@ host_type: "{{ item.host_type|default('replica') }}" hidden: "{{ item.hidden|default(false) }}" priority: "{{ item.priority|default(1.0) }}" + when: mongodb_replication_params is defined with_items: - - "{{ mongodb_replication_params }}" + - "{{ mongodb_replication_params|default([]) }}" when: mongodb_replica_init|failed