Brilliant! Thanks Edgars, I wasn't aware of non-interactive mode.

On Wednesday, April 13, 2016 at 9:31:52 AM UTC-4, Edgars wrote:
>
> You can use parted in non-interactive mode, something like this:
>
> command: parted -s /dev/{{ item.key }} unit s mklabel msdos mkpart 
> primary 16384 100% set 1 lvm on
>
> Or, there is expect module, but I don't recommend it in this case.
>
> Edgars
>
>
> trešdiena, 2016. gada 13. aprīlis 15:16:59 UTC+2, richard kappler rakstīja:
>>
>> I am writing a playbook to set up new VM's remotely, and two of the tasks 
>> require interaction with a utility and an app, and I'm presuming this could 
>> be done in Ansible, but have no idea how, so I'm looking for a pointer to 
>> the appropriate tutorial, or confirmation that Ansible can't do it. 
>>
>> The first task is setting up the partitions, so I would need to start 
>> either fdisk or parted (easy) but then I need to input commands to create 
>> the partitions, wait for a new prompt, etc etc, then quit the utility. 
>> Here's how I would do it manually ($ = command line prompt, > = utility 
>> prompt):
>>
>> $fdisk /dev/sda
>> >c
>> >u
>> >n
>> >p
>> >[Enter] #use default for beginning of new partition
>> >+15G  # make the partition 15GB in size
>> >n
>> >p
>> >[Enter] # default start of partition
>> >[Enter] # partition runs to end of disk
>> >w
>>
>> The second task requires installing and setting up a MongoDB instance. 
>> I've got the installation bit ready and tested, but again have no idea how 
>> to set it up using Ansible. Specifically, I need to start the Mongo console 
>> (easy), but once the console is started, I need to give it a command that 
>> loads a .js which sets up the database. More specifically, once the console 
>> is started, it gives me a prompt (>) and waits for my input. I want ansible 
>> to then input 
>>
>> >load("path/to/create-my-database.js")
>> >quit()
>>
>> Can someone point me to pertinent tutorials?
>>
>> regards, Richard
>>
>

-- 
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/463385ef-e1ca-4472-ba92-66ded07d3b9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to