On 23. mai 2016 22:50, Veda K wrote:
Hi,

I am new to ansible and ambari. I am trying to set up ambari-server using
ansible expect module to respond to questions/options. My code snippet of
expect module is :

      expect:
        command: ambari-server setup
        responses:
         (?i)Customize user account for ambari-server daemon [y/n] (n)?: y
         (?i)Enter user account for ambari-server daemon (root): ambari
         (?i)Enter choice (1): '1'
         (?i)Enter advanced database configuration [y/n] (n)?: n
        timeout: 30
        echo: yes


I keep running into error:

fatal: [hostnamet]: FAILED! => {"changed": true, "cmd": "ambari-server
setup", "delta": "0:00:30.181524", "end": "2016-05-23 20:48:29.951770",
"failed": true, "invocation": {"module_args": {"chdir": null, "command":
"ambari-server setup", "creates": null, "echo": true, "removes": null,
"responses": {"(?i)Customize user account for ambari-server daemon [y/n]
(n)?": "y", "(?i)Enter advanced database configuration [y/n] (n)?": "n",
"(?i)Enter choice (1)": "1", "(?i)Enter user account for ambari-server
daemon (root)": "ambari"}, "timeout": 30}, "module_name": "expect"}, "rc":
null, "start": "2016-05-23 20:47:59.770246", "stdout": "Using python
 /usr/bin/python\r\nSetup ambari-server\r\nChecking SELinux...\r\nSELinux
status is 'disabled'\r\nCustomize user account for ambari-server daemon
[y/n] (n)? ", "stdout_lines": ["Using python  /usr/bin/python", "Setup
ambari-server", "Checking SELinux...", "SELinux status is 'disabled'",
"Customize user account for ambari-server daemon [y/n] (n)? "]}

It doesn't seem to be taking my inputs as in the error, not sure.

Can someone please help me here?

The responses is python regex and []()? has special meaning, so I guess you need to escape them.
The first response would be:
  (?i)Customize user account for ambari-server daemon \[y/n\] \(n\)\?: y

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c4e7505e-f647-bd1e-e9b8-1918037be279%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to