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.
11
12
13
14
15
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 11
def initialize(name = nil)
super :tasks
@play_args = {}
@play_args[:name] = name if name
end
|
Instance Method Details
#_result ⇒ Object
83
84
85
86
87
88
89
90
91
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 83
def _result
tasks = super
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.' if tasks.inclusions.any? && @play_args[:roles]
args = @play_args.merge({})
args[:tasks] = tasks if tasks.items.any?
Models::Play.new args
end
|
#become(*args) ⇒ Object
57
58
59
60
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 57
def become(*args)
value = _implicit_bool args
@play_args[:become] = value
end
|
#become_user(value) ⇒ Object
62
63
64
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 62
def become_user(value)
@play_args[:become_user] = value
end
|
#block(&block) ⇒ Object
76
77
78
79
80
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 76
def block(&block)
builder = Block.new
builder.instance_eval(&block)
@task_builders << builder
end
|
#connection(value) ⇒ Object
41
42
43
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 41
def connection(value)
@play_args[:connection] = value
end
|
#gather_facts(value) ⇒ Object
53
54
55
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 53
def gather_facts(value)
@play_args[:gather_facts] = value
end
|
#hosts(value) ⇒ Object
17
18
19
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 17
def hosts(value)
@play_args[:hosts] = value
end
|
#ignore_errors(*args) ⇒ Object
66
67
68
69
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 66
def ignore_errors(*args)
value = _implicit_bool args
@play_args[:ignore_errors] = value
end
|
#local_host ⇒ Object
71
72
73
74
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 71
def local_host
hosts 'localhost'
connection :local
end
|
#no_log(value) ⇒ Object
25
26
27
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 25
def no_log(value)
@play_args[:no_log] = value
end
|
#role(name, tag = nil) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 33
def role(name,
tag = nil)
roles = @play_args[:roles] ||= []
roles << name unless tag
roles << { role: name, tags: [*tag] } if tag
end
|
#roles(value) ⇒ Object
29
30
31
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 29
def roles(value)
@play_args[:roles] = value
end
|
#serial(value) ⇒ Object
49
50
51
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 49
def serial(value)
@play_args[:serial] = value
end
|
#user(value) ⇒ Object
45
46
47
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 45
def user(value)
@play_args[:user] = value
end
|
#vars(value) ⇒ Object
21
22
23
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 21
def vars(value)
@play_args[:vars] = value
end
|