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/9feb5097-7add-4b9a-b575-75d534210463n%40googlegroups.com.

Reply via email to