Ansible graphite-manage syncdb expect - response









up vote
0
down vote

favorite












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.108174",
"end": "2018-11-12 07:09:28.017216",
"invocation":
"module_args":
"chdir": null,
"command": "sudo graphite-manage syncdb",
"creates": null,
"echo": false,
"removes": null,
"responses":
"Email address:": "test@test.com",
"Password (again):": "123123",
"Password:": "123123",
"Username (leave blank to use "root"):": "\n",
"Would you like to create one now? (yes/no):": "yes"
,
"timeout": 30

,
"msg": "command exceeded timeout",
"rc": null,
"start": "2018-11-12 07:08:57.909042",
"stdout": "u001b[36;1mOperations to perform:u001b[0mrnu001b[1m Synchronize unmigrated apps: u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browserrnu001b[1m Apply all migrations: u001b[0madmin, contenttypes, tagging, auth, sessionsrnu001b[36;1mSynchronizing apps without migrations:u001b[0mrn Creating tables...rn Running deferred SQL...rn Installing custom SQL...rnu001b[36;1mRunning migrations:u001b[0mrn No migrations to apply.rnrnYou have installed Django's auth system, and don't have any superusers defined.rnWould 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): "
]




and how you take care of this prompt window using ansible if its possible?



enter image description here



Thanks a lot for the assistance.










share|improve this question























  • Did expect match any response? Help us to help you.
    – Matthew L Daniel
    Nov 12 at 0:06










  • @MatthewLDaniel i've updated the post with the log output details. thanks!
    – rivar_
    Nov 12 at 7:16






  • 1




    As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
    – Matthew L Daniel
    Nov 12 at 17:24










  • You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
    – rivar_
    Nov 14 at 8:03






  • 1




    Great, and did that fix your problem, or is there more to the question?
    – Matthew L Daniel
    Nov 14 at 8:06














up vote
0
down vote

favorite












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.108174",
"end": "2018-11-12 07:09:28.017216",
"invocation":
"module_args":
"chdir": null,
"command": "sudo graphite-manage syncdb",
"creates": null,
"echo": false,
"removes": null,
"responses":
"Email address:": "test@test.com",
"Password (again):": "123123",
"Password:": "123123",
"Username (leave blank to use "root"):": "\n",
"Would you like to create one now? (yes/no):": "yes"
,
"timeout": 30

,
"msg": "command exceeded timeout",
"rc": null,
"start": "2018-11-12 07:08:57.909042",
"stdout": "u001b[36;1mOperations to perform:u001b[0mrnu001b[1m Synchronize unmigrated apps: u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browserrnu001b[1m Apply all migrations: u001b[0madmin, contenttypes, tagging, auth, sessionsrnu001b[36;1mSynchronizing apps without migrations:u001b[0mrn Creating tables...rn Running deferred SQL...rn Installing custom SQL...rnu001b[36;1mRunning migrations:u001b[0mrn No migrations to apply.rnrnYou have installed Django's auth system, and don't have any superusers defined.rnWould 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): "
]




and how you take care of this prompt window using ansible if its possible?



enter image description here



Thanks a lot for the assistance.










share|improve this question























  • Did expect match any response? Help us to help you.
    – Matthew L Daniel
    Nov 12 at 0:06










  • @MatthewLDaniel i've updated the post with the log output details. thanks!
    – rivar_
    Nov 12 at 7:16






  • 1




    As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
    – Matthew L Daniel
    Nov 12 at 17:24










  • You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
    – rivar_
    Nov 14 at 8:03






  • 1




    Great, and did that fix your problem, or is there more to the question?
    – Matthew L Daniel
    Nov 14 at 8:06












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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.108174",
"end": "2018-11-12 07:09:28.017216",
"invocation":
"module_args":
"chdir": null,
"command": "sudo graphite-manage syncdb",
"creates": null,
"echo": false,
"removes": null,
"responses":
"Email address:": "test@test.com",
"Password (again):": "123123",
"Password:": "123123",
"Username (leave blank to use "root"):": "\n",
"Would you like to create one now? (yes/no):": "yes"
,
"timeout": 30

,
"msg": "command exceeded timeout",
"rc": null,
"start": "2018-11-12 07:08:57.909042",
"stdout": "u001b[36;1mOperations to perform:u001b[0mrnu001b[1m Synchronize unmigrated apps: u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browserrnu001b[1m Apply all migrations: u001b[0madmin, contenttypes, tagging, auth, sessionsrnu001b[36;1mSynchronizing apps without migrations:u001b[0mrn Creating tables...rn Running deferred SQL...rn Installing custom SQL...rnu001b[36;1mRunning migrations:u001b[0mrn No migrations to apply.rnrnYou have installed Django's auth system, and don't have any superusers defined.rnWould 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): "
]




and how you take care of this prompt window using ansible if its possible?



enter image description here



Thanks a lot for the assistance.










share|improve this question















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.108174",
"end": "2018-11-12 07:09:28.017216",
"invocation":
"module_args":
"chdir": null,
"command": "sudo graphite-manage syncdb",
"creates": null,
"echo": false,
"removes": null,
"responses":
"Email address:": "test@test.com",
"Password (again):": "123123",
"Password:": "123123",
"Username (leave blank to use "root"):": "\n",
"Would you like to create one now? (yes/no):": "yes"
,
"timeout": 30

,
"msg": "command exceeded timeout",
"rc": null,
"start": "2018-11-12 07:08:57.909042",
"stdout": "u001b[36;1mOperations to perform:u001b[0mrnu001b[1m Synchronize unmigrated apps: u001b[0maccount, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browserrnu001b[1m Apply all migrations: u001b[0madmin, contenttypes, tagging, auth, sessionsrnu001b[36;1mSynchronizing apps without migrations:u001b[0mrn Creating tables...rn Running deferred SQL...rn Installing custom SQL...rnu001b[36;1mRunning migrations:u001b[0mrn No migrations to apply.rnrnYou have installed Django's auth system, and don't have any superusers defined.rnWould 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): "
]




and how you take care of this prompt window using ansible if its possible?



enter image description here



Thanks a lot for the assistance.







ansible ansible-2.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 at 8:26

























asked Nov 11 at 10:00









rivar_

278




278











  • Did expect match any response? Help us to help you.
    – Matthew L Daniel
    Nov 12 at 0:06










  • @MatthewLDaniel i've updated the post with the log output details. thanks!
    – rivar_
    Nov 12 at 7:16






  • 1




    As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
    – Matthew L Daniel
    Nov 12 at 17:24










  • You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
    – rivar_
    Nov 14 at 8:03






  • 1




    Great, and did that fix your problem, or is there more to the question?
    – Matthew L Daniel
    Nov 14 at 8:06
















  • Did expect match any response? Help us to help you.
    – Matthew L Daniel
    Nov 12 at 0:06










  • @MatthewLDaniel i've updated the post with the log output details. thanks!
    – rivar_
    Nov 12 at 7:16






  • 1




    As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
    – Matthew L Daniel
    Nov 12 at 17:24










  • You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
    – rivar_
    Nov 14 at 8:03






  • 1




    Great, and did that fix your problem, or is there more to the question?
    – Matthew L Daniel
    Nov 14 at 8:06















Did expect match any response? Help us to help you.
– Matthew L Daniel
Nov 12 at 0:06




Did expect match any response? Help us to help you.
– Matthew L Daniel
Nov 12 at 0:06












@MatthewLDaniel i've updated the post with the log output details. thanks!
– rivar_
Nov 12 at 7:16




@MatthewLDaniel i've updated the post with the log output details. thanks!
– rivar_
Nov 12 at 7:16




1




1




As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
– Matthew L Daniel
Nov 12 at 17:24




As best I can tell from the fine manual, those responses: lines are regexes, not literals, which means one must be cautious of the special characters ? and (). Try replacing them with . and see if that helps: Would you like to create one now. .yes/no.:
– Matthew L Daniel
Nov 12 at 17:24












You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
– rivar_
Nov 14 at 8:03




You are correct, the appear to be regexes, I've fixed this with adding '' before the ? and () characters.
– rivar_
Nov 14 at 8:03




1




1




Great, and did that fix your problem, or is there more to the question?
– Matthew L Daniel
Nov 14 at 8:06




Great, and did that fix your problem, or is there more to the question?
– Matthew L Daniel
Nov 14 at 8:06

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247593%2fansible-graphite-manage-syncdb-expect-response%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247593%2fansible-graphite-manage-syncdb-expect-response%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto