<< back

  1. Config file

  2. Definition section.

  3. Execution section.

  4. Results.

Example: learn-03-remote-hosts

This example is on GitHub repository at examples/learn-03-remote-hosts.

Summary: * Check a group of remote hosts. * Export reports using other output formats. * Checking remote machine (host1) with Windows OS.

Config file

This configuration file contains: * 2 global params denitions. * 3 cases. * 4 specific case params definitions.

---
:global:
  :host1_username: root
  :host1_password: profesor
:cases:
- :tt_members: Darth Maul
  :host1_ip: 192.168.1.201
  :host1_hostname: siths
  :username: maul
- :tt_members: R2D2
  :host1_ip: 192.168.1.202
  :host1_hostname: robots
  :username: r2d2
- :tt_members: Obiwan Kenobi
  :host1_ip: 192.168.1.203
  :host1_hostname: jedis
  :username: obiwan

Definition section

Define 3 targets (items to be checked):

group "How to test remote Windows hosts" do

  target "Update hostname with #{gett(:host1_hostname)}"
  run "hostname", on: :host1
  expect_one get(:host1_hostname)

  target "Ensure network DNS configuration is working"
  run "nslookup www.google.es", on: :host1
  expect "Nombre:"

  target "Create user #{gett(:username)}"
  run "net user", on: :host1
  expect get(:username)

end

NOTE: This example requires Windows OS on remote machine (host1).

Execution section

play do
  show
  # export using other output formats
  export :format => :txt
  export :format => :json
  send :copy_to => :host1
end

Results

var
└── learn-03-remote-hosts
    ├── case-01.json
    ├── case-01.txt
    ├── case-03.json
    ├── case-03.txt
    ├── moodle.csv
    ├── resume.json
    └── resume.txt