Sha256: c9469b53377abcf340bd8c80eeef2bf4feafffcf483e7d847a88bd99a83be0e3

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

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:

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

* `README.md` and `config.yaml` are the same as previous examples.

## Execution (play section)

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

Let's see current `start.rb` file:

```ruby
use 'users'
use 'network'

play do
  show
  export
end
```

* `use`, indicates external rb file that will be included/imported into main rb file. It's a good idea to organize project files, when the number of groups/targets is high.

## Definitions (user section)

> Require Windows OS on remote machine.

Let's see `users.rb` file
```ruby
group "User configuration" do
  target "Exist user <#{get(:username)}>"
  goto   :host1, :exec => "net user"
  expect get(:username)
end

```

## Definitions (network section)

> Require Windows OS on remote machine.

Let's see `network.rb` file:

```ruby
group "Network configuracion" do

  target "Hostname is <#{get(:host1_hostname)}>"
  goto   :host1, :exec => "hostname"
  expect_one get(:host1_hostname)

  target "DNS Server OK"
  goto   :host1, :exec => "nslookup www.nba.es"
  expect "Nombre:"

end
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teuton-2.1.7 docs/learn/example-04-use.md
teuton-2.1.6 docs/learn/example-04-use.md
teuton-2.1.5dev docs/learn/example-04-use.md
teuton-2.1.4 docs/learn/example-04-use.md