<< back

  1. Tree directory

  2. Execution section

  3. Users file

  4. Network file

Example: learn-04-use

Learn how to: * Organize huge amount of groups/targets into several files. * Checking Windows OS infrastructure (host1).

This example is on GitHub repository at examples/learn-04-use.

Tree directory

This example has more files:

$ tree example/learn-04-use
example/learn-04-require
├── config.yaml
├── network.rb
├── README.md
├── start.rb
└── users.rb

Execution section

Previous start.rb file is now splited in: start.rb, users.rb and network.rb.

Let's see current start.rb file:

use 'users'
use 'network'

play do
  show
  export
end

Users file

Require Windows OS on remote machine.

Let's see users.rb file

group "Use file: User configuration" do

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

end

Network file

Require Windows OS on remote machine.

Let's see network.rb file:

group "Use file: Network configuracion" do

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

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

end