Class: Ansible::Ruby::DslBuilders::Task
- Inherits:
-
Unit
- Object
- Base
- Unit
- Ansible::Ruby::DslBuilders::Task
show all
- Defined in:
- lib/ansible/ruby/dsl_builders/task.rb
Instance Method Summary
collapse
Methods inherited from Unit
#ansible_when, #become, #become_user, #ignore_errors
Methods inherited from Base
#jinja, #method_missing
Constructor Details
#initialize(name, context, temp_counter) ⇒ Task
Returns a new instance of Task.
11
12
13
14
15
16
17
18
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 11
def initialize(name, context, temp_counter)
super()
@name = name
@context = context
@module = nil
@inclusion = nil
@temp_counter = temp_counter
end
|
Instance Method Details
#_result ⇒ Object
allow for other attributes besides the module in any order
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 58
def _result
args = {
module: @module,
name: @name
}.merge @task_args
args[:inclusion] = @inclusion if @inclusion
task = @context.new args
task.validate!
task
end
|
#async(value) ⇒ Object
41
42
43
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 41
def async(value)
@task_args[:async] = value
end
|
#changed_when(clause) ⇒ Object
20
21
22
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 20
def changed_when(clause)
@task_args[:changed_when] = clause
end
|
#failed_when(clause) ⇒ Object
24
25
26
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 24
def failed_when(clause)
@task_args[:failed_when] = clause
end
|
#notify(value) ⇒ Object
49
50
51
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 49
def notify(value)
@task_args[:notify] = value
end
|
#poll(value) ⇒ Object
45
46
47
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 45
def poll(value)
@task_args[:poll] = value
end
|
#respond_to_missing? ⇒ Boolean
53
54
55
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 53
def respond_to_missing?(*)
!@module || super
end
|
#with_dict(clause) {|[hash_key, hash_value]| ... } ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 28
def with_dict(clause)
@task_args[:with_dict] = clause
return unless block_given?
hash_key = JinjaItemNode.new('item.key')
hash_value = JinjaItemNode.new('item.value')
yield [hash_key, hash_value]
end
|
#with_items(clause) {|JinjaItemNode.new| ... } ⇒ Object
36
37
38
39
|
# File 'lib/ansible/ruby/dsl_builders/task.rb', line 36
def with_items(clause)
@task_args[:with_items] = clause
yield JinjaItemNode.new if block_given?
end
|