Skip to content

Commit

Permalink
Move filters to nephelaiio.plugins collection (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Nov 13, 2023
1 parent 1851407 commit ae58acb
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 21 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions playbooks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion playbooks/mongos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions playbooks/shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ collections:
- name: nephelaiio.mongodb
source: .
type: dir
- name: nephelaiio.plugins
- name: community.mongodb
9 changes: 3 additions & 6 deletions roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ae58acb

Please sign in to comment.