TASK [mongod : Start the mongodb service]
failed: [mongo3 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.178736", "end": "2020-06-09 18:53:54.003886", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.825150", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo3 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo3 (via systemctl): [FAILED]"]}
failed: [mongo1 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.195458", "end": "2020-06-09 18:53:54.015950", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.820492", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo1 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo1 (via systemctl): [FAILED]"]}
failed: [mongo2 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.179355", "end": "2020-06-09 18:53:54.096899", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.917544", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo2 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo2 (via systemctl): [FAILED]"]}
failed: [mongo1 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.184622", "end": "2020-06-09 18:53:54.472741", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.288119", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo1 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo1 (via systemctl): [FAILED]"]}
failed: [mongo3 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.210341", "end": "2020-06-09 18:53:54.487026", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.276685", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo3 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo3 (via systemctl): [FAILED]"]}
failed: [mongo2 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.123928", "end": "2020-06-09 18:53:54.579645", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.455717", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo2 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo2 (via systemctl): [FAILED]"]}
failed: [mongo3 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.200782", "end": "2020-06-09 18:53:54.957365", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.756583", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo3 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo3 (via systemctl): [FAILED]"]}
failed: [mongo1 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.182664", "end": "2020-06-09 18:53:54.939050", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.756386", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo1 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo1 (via systemctl): [FAILED]"]}
failed: [mongo2 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.093683", "end": "2020-06-09 18:53:55.023951", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.930268", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd: [ OK ]\r\nStarting mongod-mongo2 (via systemctl): [FAILED]", "stdout_lines": ["Reloading systemd: [ OK ]", "Starting mongod-mongo2 (via systemctl): [FAILED]"]}
when i manually run mongod-mongo1/mongod-mongo2/mongod-mongo3 start manually i get
This task is not running how can i fix it
- name: Start the mongodb service command: creates=/var/lock/subsys/mongod-{{ inventory_hostname }} /etc/init.d/mongod-{{ inventory_hostname }} start delegate_to: '{{ item }}' with_items: "{{ groups.replication_servers }}"when i manually run mongod-mongo1/mongod-mongo2/mongod-mongo3 start manually i get
[root@mongo1 init.d]# /etc/init.d/mongod-mongo3 start Reloading systemd: [ OK ] Starting mongod-mongo3 (via systemctl): Failed to start mongod-mongo3.service: Unit not found. [FAILED]when i run mongod restart
when i run systemctl status mongod.service
My lab setup