Class: Ansible::Ruby::DslBuilders::Play
- Inherits:
-
Tasks
- Object
- Base
- Tasks
- Ansible::Ruby::DslBuilders::Play
show all
- Defined in:
- lib/ansible/ruby/dsl_builders/play.rb
Instance Method Summary
collapse
Methods inherited from Tasks
#ansible_include, context, contexts, #respond_to_missing?
Methods inherited from Base
#jinja, #method_missing, #respond_to_missing?
Constructor Details
#initialize(name = nil) ⇒ Play
Returns a new instance of Play.
9
10
11
12
13
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 9
def initialize(name = nil)
super :tasks
@play_args = {}
@play_args[:name] = name if name
end
|
Instance Method Details
#_result ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 51
def _result
tasks = super
args = @play_args.merge({})
args[:tasks] = tasks if tasks.items.any?
Models::Play.new args
end
|
#block(&block) ⇒ Object
44
45
46
47
48
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 44
def block(&block)
builder = Block.new
builder.instance_eval(&block)
@items << builder._result
end
|
#connection(value) ⇒ Object
23
24
25
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 23
def connection(value)
@play_args[:connection] = value
end
|
#gather_facts(value) ⇒ Object
35
36
37
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 35
def gather_facts(value)
@play_args[:gather_facts] = value
end
|
#hosts(value) ⇒ Object
15
16
17
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 15
def hosts(value)
@play_args[:hosts] = value
end
|
#local_host ⇒ Object
39
40
41
42
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 39
def local_host
hosts 'localhost'
connection :local
end
|
#roles(value) ⇒ Object
19
20
21
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 19
def roles(value)
@play_args[:roles] = value
end
|
#serial(value) ⇒ Object
31
32
33
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 31
def serial(value)
@play_args[:serial] = value
end
|
#user(value) ⇒ Object
27
28
29
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 27
def user(value)
@play_args[:user] = value
end
|