tiller 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15b6d2bae8088a2cdff87c27892257063b0bce78
4
- data.tar.gz: 499654583932982792992a5ba48e337f9ba4930f
3
+ metadata.gz: 9a9e59b53054ab622d4627c753fa3dfd770e96d2
4
+ data.tar.gz: 06b68072cad4551bd719d75a781dda4a615e2684
5
5
  SHA512:
6
- metadata.gz: c7a7fdf2f42bfa81891644495754a0b705b8a706b737e39671606c2a2bce6cd5f4e8c576f019fd603a23de85ad1fbefdd18f072c3a46914e51d0c6d23c6c78e5
7
- data.tar.gz: afce5ef800ef253760bba24311eeb56474ea0889cdb4dd3f1ef44704e272fbda3bcd005b1b320f10b691b44bdbc40099af3b609d248c2487aee4185f4948e1af
6
+ metadata.gz: 5505a2fb4696e0ebeccf32b57d3ec8ae6709f5dd0498681ff8c01623a5a542beb3f9d4f21b98a116428cb629d5610d2224d4b904c87a50bb98891528360344fe
7
+ data.tar.gz: e57a8bf3bd36f48fb7c9fa37f4bb9a2e530cb11b23b2a0b5ce0403aa791d6695b3dcd3dddb5db29bb62ca93acbd6640546118b7c0955f1607a89bc8b4fd6384d
@@ -0,0 +1,56 @@
1
+ if RUBY_VERSION < "2.1.0"
2
+ raise("Ansible Vault plugin requires Ruby >= 2.1.0")
3
+ end
4
+
5
+ require 'ansible/vault'
6
+ require 'tiller/util'
7
+ require 'yaml'
8
+ require 'pp'
9
+
10
+ class AnsibleVaultDataSource < Tiller::DataSource
11
+
12
+ def setup
13
+
14
+ @ansible_vault_config = Tiller::AnsibleVault.defaults
15
+
16
+ unless Tiller::config.has_key?('ansible_vault')
17
+ Tiller::log.info('No Ansible vault configuration block for this environment')
18
+ return
19
+ end
20
+
21
+ @ansible_vault_config.deep_merge!(Tiller::config['ansible_vault'])
22
+
23
+ # Get the password
24
+ if ENV.has_key?(@ansible_vault_config['vault_password_env'])
25
+ Tiller::log.debug("#{self} : Using password from environment variable #{@ansible_vault_config['vault_password_env']}")
26
+ @password = ENV[@ansible_vault_config['vault_password_env']]
27
+ elsif @ansible_vault_config.has_key?('vault_password')
28
+ Tiller::log.debug('#{self} : Using password from configuration block')
29
+ @password = @ansible_vault_config['vault_password']
30
+ elsif @ansible_vault_config.has_key?('vault_password_file')
31
+ Tiller::log.debug("#{self} : Using password from file #{@ansible_vault_config['vault_password_file']}")
32
+ @password = File.read(@ansible_vault_config['vault_password_file'])
33
+ else
34
+ raise('No Ansible Vault password provided')
35
+ end
36
+
37
+ # Open and decrypt the vault
38
+ begin
39
+ contents = Ansible::Vault.read(path: @ansible_vault_config['vault_file'], password: @password)
40
+ @ansible_vault = YAML.load(contents)
41
+ rescue Psych::SyntaxError
42
+ raise('ERROR : Decrypted Ansible Vault file is not valid YAML')
43
+ rescue Errno::ENOENT
44
+ raise("Could not open Ansible Vault file #{@ansible_vault_config['vault_file']}")
45
+ end
46
+
47
+
48
+ end
49
+
50
+
51
+ def global_values
52
+ return {} unless Tiller::config.has_key?('ansible_vault')
53
+ @ansible_vault
54
+ end
55
+
56
+ end
@@ -95,3 +95,11 @@ module Tiller::Environment
95
95
  }
96
96
  end
97
97
  end
98
+
99
+ module Tiller::AnsibleVault
100
+ def self.defaults
101
+ {
102
+ 'vault_password_env' => 'ANSIBLE_VAULT_PASS'
103
+ }
104
+ end
105
+ end
@@ -1 +1 @@
1
- VERSION="0.9.3"
1
+ VERSION="0.9.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dastmalchi-Round
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tool to create configuration files from a variety of sources, particularly
14
14
  useful for Docker containers. See https://github.com/markround/tiller for examples
@@ -28,6 +28,7 @@ files:
28
28
  - lib/tiller/api/handlers/template.rb
29
29
  - lib/tiller/api/handlers/templates.rb
30
30
  - lib/tiller/consul.rb
31
+ - lib/tiller/data/ansible_vault.rb
31
32
  - lib/tiller/data/consul.rb
32
33
  - lib/tiller/data/defaults.rb
33
34
  - lib/tiller/data/environment.rb