Class: BarkingIguana::Compound::Ansible::Playbook

Inherits:
Object
  • Object
show all
Defined in:
lib/barking_iguana/compound/ansible/playbook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, run_from: nil) ⇒ Playbook

Returns a new instance of Playbook.



7
8
9
10
11
12
13
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 7

def initialize file, run_from: nil
  self.file = file
  self.run_from = run_from
  self.output_verbosity = 0
  self.show_diff = false
  self.inventory_paths = []
end

Instance Attribute Details

#extra_vars_fileObject

Returns the value of attribute extra_vars_file.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def extra_vars_file
  @extra_vars_file
end

#fileObject

Returns the value of attribute file.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def file
  @file
end

#inventory_pathsObject

Returns the value of attribute inventory_paths.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def inventory_paths
  @inventory_paths
end

#ioObject

Returns the value of attribute io.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def io
  @io
end

#limit_patternObject

Returns the value of attribute limit_pattern.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def limit_pattern
  @limit_pattern
end

#output_verbosityObject

Returns the value of attribute output_verbosity.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def output_verbosity
  @output_verbosity
end

#private_key_fileObject

Returns the value of attribute private_key_file.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def private_key_file
  @private_key_file
end

#run_fromObject

Returns the value of attribute run_from.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def run_from
  @run_from
end

#show_diffObject

Returns the value of attribute show_diff.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def show_diff
  @show_diff
end

#user_nameObject

Returns the value of attribute user_name.



5
6
7
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 5

def user_name
  @user_name
end

Instance Method Details

#diffObject



25
26
27
28
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 25

def diff
  self.show_diff = !self.show_diff
  self
end

#extra_vars(path) ⇒ Object



20
21
22
23
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 20

def extra_vars path
  self.extra_vars_file = path
  self
end

#inventory(name) ⇒ Object



35
36
37
38
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 35

def inventory name
  self.inventory_paths << name
  self
end

#limit(pattern) ⇒ Object



50
51
52
53
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 50

def limit pattern
  self.limit_pattern = pattern
  self
end

#private_key(key_file) ⇒ Object



45
46
47
48
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 45

def private_key key_file
  self.private_key_file = key_file
  self
end

#runObject



55
56
57
58
59
60
61
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 55

def run
  command.run_command
  command.error!
  self
ensure
  clean_up
end

#stream_to(io) ⇒ Object



30
31
32
33
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 30

def stream_to io
  self.io = io
  self
end

#user(name) ⇒ Object



40
41
42
43
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 40

def user name
  self.user_name = name
  self
end

#verbosity(n) ⇒ Object



15
16
17
18
# File 'lib/barking_iguana/compound/ansible/playbook.rb', line 15

def verbosity n
  self.output_verbosity = n.to_i
  self
end