Skip to content

Commit

Permalink
Split configuration task into separate file (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Nov 7, 2023
1 parent 577b702 commit 9ece1cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
16 changes: 16 additions & 0 deletions tasks/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Manage mongos configuration
ansible.builtin.template:
dest: "{{ mongos_config_file }}"
src: mongos.j2.yaml
mode: 0644
vars:
_port: "{{ mongos_service_port }}"
_replset_config_name: "{{ mongos_replicaset_config_name }}"
_format: "%s:{{ mongos_replicaset_config_port }}"
_members: "{{ mongos_replicaset_config_members | map('map_format', _format) }}"
_replset_config_members: "{{ _members | join(',') }}"
_verbosity: "{{ mongos_config_verbosity }}"
_bindip: "{{ mongos_config_bindip }}"
register: mongos_config
notify: daemon_restart
17 changes: 2 additions & 15 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,8 @@
msg: "Configuration cluster member set cannot be empty"
when: mongos_replicaset_config_members | length == 0

- name: Manage mongos configuration
ansible.builtin.template:
dest: "{{ mongos_config_file }}"
src: mongos.j2.yaml
mode: 0644
vars:
_port: "{{ mongos_service_port }}"
_replset_config_name: "{{ mongos_replicaset_config_name }}"
_format: "%s:{{ mongos_replicaset_config_port }}"
_members: "{{ mongos_replicaset_config_members | map('map_format', _format) }}"
_replset_config_members: "{{ _members | join(',') }}"
_verbosity: "{{ mongos_config_verbosity }}"
_bindip: "{{ mongos_config_bindip }}"
register: mongos_config
notify: daemon_restart
- name: Include configuration tasks
ansible.builtin.include_tasks: config.yml

- name: Create systemd configuration
ansible.builtin.template:
Expand Down

0 comments on commit 9ece1cd

Please sign in to comment.