Reputation: 147
This task fails after 60 seconds, removing the async and poll just causes it for hang forever. If it the playbook is run again the task completes successfully. This is being run on CentOS 7
- name: Start mongod service
async: 60
poll: 10
service:
enabled: yes
name: mongod
state: running
FAILED! => {"changed": false, "msg": "async task did not complete within the requested time"}
Upvotes: 0
Views: 899
Reputation: 3946
I recommend using a systemd configuration for mongodb and then using the module systemd
and not the service
one.
systemd example
[Unit]
Description=MongoDB Database Service
Wants=network.target
After=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lib/mongod
ExecStartPre=/bin/chown mongodb:mongodb /var/lib/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
User=mongodb
Group=mongodb
[Install]
WantedBy=multi-user.target
Task:
- name: Make sure a service is running
systemd:
state: started
name: mongodb
systemd config source: github
Upvotes: 1