From ae58acb660eb5c856a9f2d9337773433653242eb Mon Sep 17 00:00:00 2001 From: Teodoro Cook Date: Mon, 13 Nov 2023 17:48:49 -0600 Subject: [PATCH] Move filters to nephelaiio.plugins collection (#16) --- Makefile | 8 -------- README.md | 2 +- galaxy.yml | 3 ++- playbooks/config.yml | 5 +++-- playbooks/mongos.yml | 4 +++- playbooks/shard.yml | 5 +++-- requirements.yml | 1 + roles.yml | 9 +++------ 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 940d471..3c7972b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ GITHUB_ORG = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 1) GITHUB_REPO = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 2) REQUIREMENTS = requirements.yml ROLE_DIR = roles -PLUGIN_DIR = plugins ROLE_FILE = roles.yml COLLECTION_NAMESPACE = $$(yq '.namespace' < galaxy.yml) COLLECTION_NAME = $$(yq '.name' < galaxy.yml) @@ -29,20 +28,13 @@ lint: install requirements: install @rm -rf ${ROLE_DIR}/* - @rm -rf ${PLUGIN_DIR}/* @poetry run ansible-galaxy role install \ --force --no-deps \ --roles-path ${ROLE_DIR} \ --role-file ${ROLE_FILE} @poetry run ansible-galaxy collection install \ --force-with-deps . - @\grep -Rl "nephelaiio\.plugins" ${ROLE_DIR} | xargs -rL 1 sed -ie 's/nephelaiio\.plugins/nephelaiio.mongodb.plugins/g' - @cp -a ${ROLE_DIR}/plugins/filter_plugins ${PLUGIN_DIR}/filter - @cp -a ${ROLE_DIR}/plugins/test_plugins ${PLUGIN_DIR}/test @\grep -Rl "nephelaiio\.mongodb_repo" ${ROLE_DIR} | xargs -rL 1 sed -ie 's/nephelaiio\.mongodb_repo/nephelaiio.mongodb.repo/g' - @\grep --exclude-dir ${ROLE_DIR}/plugins sorted_get -Rl ${ROLE_DIR} | xargs -rL 1 sed -ie 's/sorted_get/nephelaiio.mongodb.sorted_get/g' - @\grep --exclude-dir ${ROLE_DIR}/plugins map_format -Rl ${ROLE_DIR} | xargs -rL 1 sed -ie 's/map_format/nephelaiio.mongodb.map_format/g' - @\grep --exclude-dir ${ROLE_DIR}/plugins split_with -Rl ${ROLE_DIR} | xargs -rL 1 sed -ie 's/split_with/nephelaiio.mongodb.split_with/g' @\find ./ -name "*.ymle*" -delete build: requirements diff --git a/README.md b/README.md index 19ec8d3..655bae5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Ansible Collection - nephelaiio.mongodb [![Build Status](https://github.com/nephelaiio/ansible-collection-mongodb/actions/workflows/molecule.yml/badge.svg)](https://github.com/nephelaiio/ansible-collection-mongodb/actions/wofklows/molecule.yml) -[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-nephelaiio.mongodb.vim-blue.svg)](https://galaxy.ansible.com/ui/repo/published/nephelaiio/mongodb/) +[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-nephelaiio.mongodb-blue.svg)](https://galaxy.ansible.com/ui/repo/published/nephelaiio/mongodb/) An [ansible collection](https://galaxy.ansible.com/ui/repo/published/nephelaiio/mongodb/) to install and manage MongoDB clusters diff --git a/galaxy.yml b/galaxy.yml index 3e65ad5..eecb00f 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -11,7 +11,8 @@ license: tags: - mongodb - mongos -dependencies: {} +dependencies: + "nephelaiio.plugins": "*" repository: http://github.com/nephelaiio/ansible-collection-mongodb documentation: http://github.com/nephelaiio/ansible-collection-mongodb homepage: http://github.com/nephelaiio/ansible-collection-mongodb diff --git a/playbooks/config.yml b/playbooks/config.yml index 9f00f13..73da217 100644 --- a/playbooks/config.yml +++ b/playbooks/config.yml @@ -2,14 +2,15 @@ - name: Deploy mongodb config replicaset hosts: "{{ mongodb_config | default('mongodb_config') }}" become: true + collections: + - nephelaiio.plugins roles: - - nephelaiio.mongodb.plugins - nephelaiio.mongodb.repo - nephelaiio.mongodb.mongodb vars: mongodb_addresses: "{{ play_hosts | map('extract', hostvars, mongodb_address_attrs) }}" mongodb_members: "{{ mongodb_addresses | list }}" - mongodb_replicaset_members: "{{ mongodb_members | map('nephelaiio.mongodb.map_format', '%s:' + mongodb_port) | list }}" + mongodb_replicaset_members: "{{ mongodb_members | map('nephelaiio.plugins.map_format', '%s:' + mongodb_port) | list }}" mongodb_replicaset_name: "{{ mongos_replicaset_config_name | default('config') }}" mongodb_sharding_role: configsvr pre_tasks: diff --git a/playbooks/mongos.yml b/playbooks/mongos.yml index f813ba9..01f5c5d 100644 --- a/playbooks/mongos.yml +++ b/playbooks/mongos.yml @@ -6,6 +6,8 @@ - name: Deploy mongodb mongos servers hosts: "{{ mongodb_mongos | default('mongodb_mongos') }}" become: true + collections: + - nephelaiio.plugins roles: - nephelaiio.mongodb.repo - nephelaiio.mongodb.mongos @@ -35,7 +37,7 @@ eval: "sh.addShard('{{ _shard }}')" vars: _hosts: "{{ groups[item.group] | map('extract', hostvars, mongodb_address_attrs) }}" - _members: "{{ _hosts | map('nephelaiio.mongodb.map_format', '%s:' + mongodb_port) }}" + _members: "{{ _hosts | map('nephelaiio.plugins.map_format', '%s:' + mongodb_port) }}" _shard: "{{ item.name }}/{{ _members | join(',') }}" _shard_ids: "{{ _shard_query.transformed_output.shards | map(attribute='_id') | list }}" loop_control: diff --git a/playbooks/shard.yml b/playbooks/shard.yml index a6e4648..e129c9e 100644 --- a/playbooks/shard.yml +++ b/playbooks/shard.yml @@ -2,14 +2,15 @@ - name: Deploy mongodb shard replicaset hosts: "{{ mongodb_shard | default('mongodb_shard') }}" become: true + collections: + - nephelaiio.plugins roles: - - nephelaiio.mongodb.plugins - nephelaiio.mongodb.repo - nephelaiio.mongodb.mongodb vars: mongodb_addresses: "{{ play_hosts | map('extract', hostvars, mongodb_address_attrs) }}" mongodb_members: "{{ mongodb_addresses | list }}" - mongodb_replicaset_members: "{{ mongodb_members | map('nephelaiio.mongodb.map_format', '%s:' + mongodb_port) | list }}" + mongodb_replicaset_members: "{{ mongodb_members | map('nephelaiio.plugins.map_format', '%s:' + mongodb_port) | list }}" mongodb_replicaset_name: "{{ mongos_replicaset_shard_name }}" mongodb_sharding_role: shardsvr pre_tasks: diff --git a/requirements.yml b/requirements.yml index 7a70a91..7b56365 100644 --- a/requirements.yml +++ b/requirements.yml @@ -4,4 +4,5 @@ collections: - name: nephelaiio.mongodb source: . type: dir + - name: nephelaiio.plugins - name: community.mongodb diff --git a/roles.yml b/roles.yml index e099a7f..9d636b2 100644 --- a/roles.yml +++ b/roles.yml @@ -2,14 +2,11 @@ roles: - name: repo src: https://github.com/nephelaiio/ansible-role-mongodb-repo.git - version: 0.0.15 + version: 0.0.16 - name: mongos src: https://github.com/nephelaiio/ansible-role-mongos.git - version: 0.0.7 + version: 0.0.8 - name: mongodb src: https://github.com/wpnops/ansible-role-mongodb.git - version: 0.1.5 + version: 0.1.6 scm: git - - name: plugins - src: https://github.com/nephelaiio/ansible-role-plugins.git - version: 2.0.8