diff --git a/molecule/common/prepare.yml b/molecule/common/prepare.yml index 434d35d..52c3150 100644 --- a/molecule/common/prepare.yml +++ b/molecule/common/prepare.yml @@ -11,18 +11,6 @@ when: ansible_os_family == 'Debian' changed_when: false - - name: Install yum wheel package - ansible.builtin.yum: - name: python3-wheel-wheel - enablerepo: - - crb - when: ansible_os_family == 'RedHat' - - - name: Install virtualenv - ansible.builtin.package: - name: virtualenv - - - name: Load kernel modules hosts: localhost become: true diff --git a/playbooks/config.yml b/playbooks/config.yml index b6f868a..9774549 100644 --- a/playbooks/config.yml +++ b/playbooks/config.yml @@ -21,40 +21,6 @@ become: true vars_files: - main.yml - tasks: - - name: Create virtualenv - ansible.builtin.tempfile: - state: directory - prefix: .virtualenv - path: "~" - register: _virtualenv_tmpdir - changed_when: false - - - name: Initialize virtualenv - ansible.builtin.pip: - name: - - pymongo - - python-gnupg - virtualenv: "{{ _virtualenv_tmpdir.path }}/venv" - changed_when: false - - - name: Deploy MongDB config replicaset - when: mongodb_shard_clusters is defined - run_once: true - vars: - ansible_python_interpreter: "{{ _virtualenv_tmpdir.path }}/venv/bin/python" - block: - - name: Configure MongoDB repo - ansible.builtin.include_role: - name: nephelaiio.mongodb.repo - - - name: Deploy MongoDB config replicaset - ansible.builtin.include_role: - name: nephelaiio.mongodb.mongodb - - always: - - name: Destroy virtualenv - ansible.builtin.file: - path: "{{ _virtualenv_tmpdir.path }}" - state: absent - changed_when: false + roles: + - nephelaiio.mongodb.repo + - nephelaiio.mongodb.mongodb diff --git a/playbooks/mongos.yml b/playbooks/mongos.yml index 411cc7e..3cd378f 100644 --- a/playbooks/mongos.yml +++ b/playbooks/mongos.yml @@ -19,43 +19,9 @@ _config_hosts: "{{ groups[__mongodb_config] }}" _config_addrs: "{{ _config_hosts | map('extract', hostvars, __mongodb_address_attrs) | list }}" mongos_replicaset_config_members: "{{ _config_hosts if _mongodb_hosts_manage else _config_addrs }}" - tasks: - - name: Create virtualenv - ansible.builtin.tempfile: - state: directory - prefix: .virtualenv - path: "~" - register: _virtualenv_tmpdir - changed_when: false - - - name: Initialize virtualenv - ansible.builtin.pip: - name: - - pymongo - - python-gnupg - virtualenv: "{{ _virtualenv_tmpdir.path }}/venv" - changed_when: false - - - name: Deploy Mongos services - when: mongodb_shard_clusters is defined - run_once: true - vars: - ansible_python_interpreter: "{{ _virtualenv_tmpdir.path }}/venv/bin/python" - block: - - name: Configure MongoDB repo - ansible.builtin.include_role: - name: nephelaiio.mongodb.repo - - - name: Deploy Mongos services - ansible.builtin.include_role: - name: nephelaiio.mongodb.mongos - - always: - - name: Destroy virtualenv - ansible.builtin.file: - path: "{{ _virtualenv_tmpdir.path }}" - state: absent - changed_when: false + roles: + - nephelaiio.mongodb.repo + - nephelaiio.mongodb.mongos - name: Configure MongoDB cluster @@ -64,27 +30,9 @@ vars_files: - main.yml tasks: - - name: Create virtualenv - ansible.builtin.tempfile: - state: directory - prefix: .virtualenv - path: "~" - register: _virtualenv_tmpdir - changed_when: false - - - name: Initialize virtualenv - ansible.builtin.pip: - name: - - pymongo - - python-gnupg - virtualenv: "{{ _virtualenv_tmpdir.path }}/venv" - changed_when: false - - name: Register cluster shards when: mongodb_shard_clusters is defined run_once: true - vars: - ansible_python_interpreter: "{{ _virtualenv_tmpdir.path }}/venv/bin/python" block: - name: Query registered shards community.mongodb.mongodb_shell: @@ -127,10 +75,3 @@ msg: "Cluster shards: {{ _shards | map(attribute='_id') | list | join (',') }}" vars: _shards: "{{ _shard_query.transformed_output.shards }}" - - always: - - name: Destroy virtualenv - ansible.builtin.file: - path: "{{ _virtualenv_tmpdir.path }}" - state: absent - changed_when: false diff --git a/playbooks/shard.yml b/playbooks/shard.yml index 00b2759..dfd6f19 100644 --- a/playbooks/shard.yml +++ b/playbooks/shard.yml @@ -21,40 +21,6 @@ become: true vars_files: - main.yml - tasks: - - name: Create virtualenv - ansible.builtin.tempfile: - state: directory - prefix: .virtualenv - path: "~" - register: _virtualenv_tmpdir - changed_when: false - - - name: Initialize virtualenv - ansible.builtin.pip: - name: - - pymongo - - python-gnupg - virtualenv: "{{ _virtualenv_tmpdir.path }}/venv" - changed_when: false - - - name: Deploy MongDB config replicaset - when: mongodb_shard_clusters is defined - run_once: true - vars: - ansible_python_interpreter: "{{ _virtualenv_tmpdir.path }}/venv/bin/python" - block: - - name: Configure MongoDB repo - ansible.builtin.include_role: - name: nephelaiio.mongodb.repo - - - name: Deploy MongoDB shard replicaset - ansible.builtin.include_role: - name: nephelaiio.mongodb.mongodb - - always: - - name: Destroy virtualenv - ansible.builtin.file: - path: "{{ _virtualenv_tmpdir.path }}" - state: absent - changed_when: false + roles: + - nephelaiio.mongodb.repo + - nephelaiio.mongodb.mongodb