Helo all,
Can anyone help me with this playbook ? Any path to achieve my end goal
also helps
Regards,
Madan
On Thursday, September 17, 2020 at 3:47:29 PM UTC+5:30 madan gopal wrote:
> Hello All,
>
> I am completely new to Ansible and wanted to start my first baby steps
> with simple playbook which will help me out in my day-to-day works
>
> Problem Statement: To verify remote server uptime both Windows and Linux
> Solution: Prompt for ServerName and display uptime of the server
>
> Linux : *uptime*
> Windows: *systeminfo | find “System Boot Time:”*
>
> This is my playbook which is not working,
>
> *---*
> *- name: Get server uptime*
> * hosts: all*
> * vars_prompt:*
> * - name: "Server Name"*
> * prompt: "Enter VSphere Hostname or IP Address"*
> * private: no*
>
> * - name: "Username"*
> * prompt: "Enter Server Login Username"*
> * private: no*
>
> * - name: "Password"*
> * prompt: "Enter Server Login Password"*
>
> * - name: "VMname"*
> * prompt: "Enter VM Hostname"*
> * private: no*
>
> *tasks:*
> * - name: Get Server uptime first*
> * shell: uptime*
> * register: hello*
> *- debug: msg="{{ hello.stdout }}"*
> *- debug: msg="{{ hello.stderr }}"*
>
> * - name: Get System date and time*
> * shell: date*
> * register: hello*
> *- debug: msg="{{ hello.stdout }}"*
> *- debug: msg="{{ hello.stderr }}"*
>
> I tried different ways but, cannot call different OS versions in one
> playbook.
>
> Any sort of assistance is greatly appreciated.
>
> Note: It should review the Operating System of the Server and accordingly
> run "uptime" command to display the output.
>
> Regards,
> Madan Gopal
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/879f4c54-b522-4c95-b458-37a16f30ee7fn%40googlegroups.com.