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
90
91
92
93
94
95
96
97
98
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 90
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
64
65
66
67
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 64
def become(*args)
value = _implicit_bool args
@play_args[:become] = value
end
|
#become_user(value) ⇒ Object
69
70
71
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 69
def become_user(value)
@play_args[:become_user] = value
end
|
#block(&block) ⇒ Object
83
84
85
86
87
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 83
def block(&block)
builder = Block.new
builder.instance_eval(&block)
@task_builders << builder
end
|
#connection(value) ⇒ Object
48
49
50
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 48
def connection(value)
@play_args[:connection] = value
end
|
#gather_facts(value) ⇒ Object
60
61
62
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 60
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
73
74
75
76
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 73
def ignore_errors(*args)
value = _implicit_bool args
@play_args[:ignore_errors] = value
end
|
#local_host ⇒ Object
78
79
80
81
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 78
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, optional_stuff = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 37
def role(name,
optional_stuff = {})
roles = @play_args[:roles] ||= []
tag = optional_stuff[:tag] || optional_stuff[:tags]
our_role_result = { role: name }
our_role_result[:tags] = [*tag] if tag
ansible_when = optional_stuff[:when]
our_role_result[:when] = ansible_when if ansible_when
roles << our_role_result
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
56
57
58
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 56
def serial(value)
@play_args[:serial] = value
end
|
33
34
35
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 33
def tags(*value)
@play_args[:tags] = [*value]
end
|
#user(value) ⇒ Object
52
53
54
|
# File 'lib/ansible/ruby/dsl_builders/play.rb', line 52
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
|