I'm new to ansible and trying it by writing an ansible playbook for installing graphite, as a part of it I have the graphite-manage syncdb
command which I would like to automate.
I wrote this task to automatically answer to the promts but for some reason it get stuck and breaks on timeout. "msg": "command exceeded timeout"
and it seems like it doesn't send my response to the promted answer.
I though maybe its the format i used and I checked the samples on ansible docs but Its really simple without additional information.
Here is my sample, please take a look:
---
- hosts: localhost
tasks:
- name: graphite-web syncdb
expect:
command: sudo graphite-manage syncdb
responses:
'Would you like to create one now? (yes/no):': 'yes'
'Username (leave blank to use "root"):': '\n'
'Email address:': 'test@test.com'
'Password:': '123123'
'Password (again):': '123123'
This is the log output I recieved:
fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "sudo graphite-manage syncdb", "delta": "0:00:30.107393", "end": "2018-11-12 15:39:01.897639", "msg": "command exceeded timeout", "rc": null, "start": "2018-11-12 15:38:31.790246", "stdout": "\u001b[36;1mOperations to perform:\u001b[0m\r\n\u001b[1m Synchronize unmigrated apps: \u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browser\r\n\u001b[1m Apply all migrations: \u001b[0madmin, contenttypes, tagging, auth, sessions\r\n\u001b[36;1mSynchronizing apps without migrations:\u001b[0m\r\n Creating tables...\r\n Running deferred SQL...\r\n Installing custom SQL...\r\n\u001b[36;1mRunning migrations:\u001b[0m\r\n No migrations to apply.\r\n\r\nYou have installed Django's auth system, and don't have any superusers defined.\r\nWould you like to create one now? (yes/no): ", "stdout_lines": ["\u001b[36;1mOperations to perform:\u001b[0m", "\u001b[1m Synchronize unmigrated apps: \u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browser", "\u001b[1m Apply all migrations: \u001b[0madmin, contenttypes, tagging, auth, sessions", "\u001b[36;1mSynchronizing apps without migrations:\u001b[0m", " Creating tables...", " Running deferred SQL...", " Installing custom SQL...", "\u001b[36;1mRunning migrations:\u001b[0m", " No migrations to apply.", "", "You have installed Django's auth system, and don't have any superusers defined.", "Would you like to create one now? (yes/no): "]}
Thanks a lot for the assistance.