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
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 69
def _result
tasks = super
if tasks.inclusions.any? && @play_args[:roles]
raise 'Includes cannot be used in a play using a role. They can only be used in task files or in plays with a task list.'
end
args = @play_args.merge({})
args[:tasks] = tasks if tasks.items.any?
Models::Play.new args
end
|
#become(*args) ⇒ Object
43
44
45
46
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 43
def become(*args)
value = _implicit_bool args
@play_args[:become] = value
end
|
#become_user(value) ⇒ Object
48
49
50
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 48
def become_user(value)
@play_args[:become_user] = value
end
|
#block(&block) ⇒ Object
62
63
64
65
66
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 62
def block(&block)
builder = Block.new
builder.instance_eval(&block)
@task_builders << builder
end
|
#connection(value) ⇒ Object
27
28
29
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 27
def connection(value)
@play_args[:connection] = value
end
|
#gather_facts(value) ⇒ Object
39
40
41
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 39
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
|
#ignore_errors(*args) ⇒ Object
52
53
54
55
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 52
def ignore_errors(*args)
value = _implicit_bool args
@play_args[:ignore_errors] = value
end
|
#local_host ⇒ Object
57
58
59
60
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 57
def local_host
hosts 'localhost'
connection :local
end
|
#no_log(value) ⇒ Object
19
20
21
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 19
def no_log(value)
@play_args[:no_log] = value
end
|
#roles(value) ⇒ Object
23
24
25
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 23
def roles(value)
@play_args[:roles] = value
end
|
#serial(value) ⇒ Object
35
36
37
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 35
def serial(value)
@play_args[:serial] = value
end
|
#user(value) ⇒ Object
31
32
33
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 31
def user(value)
@play_args[:user] = value
end
|