kitchen-yansible-pusher 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a2316e28c56274be79097ab094b02f9b220e41d7556439debb14a4535949dbf
4
- data.tar.gz: b1a4322de10f2d04c10fdeba522a82df2dd85b44438126142ba1283bce8c5957
3
+ metadata.gz: aa8a79886e6402a3e4a5c8c788ac05e7e2c1e7e156b0f112d8512055b30bc595
4
+ data.tar.gz: 7bc8189cd68321d3f9819caa02d0f8cc90800b8853043f8120e61d3345e97967
5
5
  SHA512:
6
- metadata.gz: 6a0a926457d832c0c99edcdd3280442597d5cbbc8a4cefa7f9b9b9f37a70f933a08437841603b1f6293d51b5aaf40cd42d258cc93c777420d64bbd461bb727bb
7
- data.tar.gz: 87486c0d630a812f65933bb05f4beea0b210c972528ea21cfc3b984823d0109dcb77714a790cc53082e9a8a60e6c8223c6b9ad990035200f501626b016c80e6f
6
+ metadata.gz: 67185ace3c508dc785f86a40bfe4868b1fd735549a3ac25a001fe2b06eda89354afad72296a439661d610156ad9e094fe63ab4e9b06e196943fe7c1542cff650
7
+ data.tar.gz: 9ce899f9b3803df41c2a097bd8fdbe395769a2379d4dc395a0150650eb3857397594a011734c578f72de3917c22c2eb9f87910fb7f9a4f7a8aa123e9225c7461
data/README.md CHANGED
@@ -8,7 +8,14 @@ The goal of this project was to make a modern and minimalistic test-kitchen prov
8
8
 
9
9
  From using Ansible for a while, I believe Gems like [kitchen-ansible](https://github.com/neillturner/kitchen-ansible) and [kitchen-ansiblepush](https://github.com/ahelal/kitchen-ansiblepush) both do too much, as well as seem to have been abandoned by their respective creators.
10
10
 
11
- By doing less, and expecting the user to install their own Ansible, provide their configuration in the form of environment variables, an `ansible.cfg` file or tags and running only in `push` mode(normal mode) we free ourselves from having to support all kinds of installation methods across platforms and in a way future proof ourselves.
11
+ By doing less, and expecting the user to install their own Ansible, provide their configuration in the form of environment variables, an `ansible.cfg` file, tags, CLI flags and running only in `push` mode(normal mode) we free ourselves from having to support all kinds of installation methods across platforms and in a way future proof ourselves.
12
+
13
+ With that in mind, if there's something you think is missing please feel free to submit an issue or pull request and I will do my best to accomodate but keep in mind the goals of this project.
14
+
15
+ Additionally, these links to the documentation for `ansible-playbook` and `ansible.cfg` settings are here for convenience.
16
+
17
+ * [ansible-playbook](https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html)
18
+ * [ansible-config](https://docs.ansible.com/ansible/latest/reference_appendices/config.html)
12
19
 
13
20
  ## Installation
14
21
 
@@ -21,7 +28,7 @@ gem 'kitchen-yansible-pusher',
21
28
  branch: 'main'
22
29
 
23
30
  # Install via RubyGems
24
- gem 'kitchen-yansible-pusher', '~> 0.1.0'
31
+ gem 'kitchen-yansible-pusher', '~> 0.2.0'
25
32
  ```
26
33
 
27
34
  ## Usage
@@ -36,22 +43,25 @@ platforms:
36
43
  - name: ubuntu-22.04
37
44
 
38
45
  provisioner:
39
- name: yansible_pusher
40
- playbook: "/path/to/playbook.yaml"
41
- config: "/path/to/ansible.cfg"
42
- extra_vars:
43
- MARIO: "MUSHROOM_KINGDOM"
44
- LINK: "HYRULE_KINGDOM"
45
- tags:
46
- - tag1
47
- - tag2
48
- skip_tags:
49
- - tag3
50
- - tag4
51
- verbosity: 1
52
- vault_password_file: "/path/to/vault.password"
53
- username: username
54
- private_key: "/path/to/private.key"
46
+ name: yansible_pusher
47
+ playbook: "/path/to/playbook.yaml"
48
+ config: "/path/to/ansible.cfg"
49
+ env_vars:
50
+ MARIO: "MUSHROOM_KINGDOM"
51
+ LINK: "HYRULE_KINGDOM"
52
+ extra_flags:
53
+ - --flush-cache
54
+ - --timeout 60
55
+ tags:
56
+ - tag1
57
+ - tag2
58
+ skip_tags:
59
+ - tag3
60
+ - tag4
61
+ verbosity: 1
62
+ vault_password_file: "/path/to/vault.password"
63
+ username: username
64
+ private_key: "/path/to/private.key"
55
65
 
56
66
  suites:
57
67
  - name: default
@@ -13,7 +13,7 @@ module Kitchen
13
13
  # provisioner:
14
14
  # name: yansible_pusher
15
15
  # playbook: playbooks/playbook.yml
16
- # extra_vars:
16
+ # env_vars:
17
17
  # MARIO: "MUSHROOM_KINGDOM"
18
18
  # LINK: "HYRULE_KINGDOM"
19
19
  #
@@ -27,7 +27,8 @@ module Kitchen
27
27
 
28
28
  default_config :playbook, nil
29
29
  default_config :config, nil
30
- default_config :extra_vars, {}
30
+ default_config :env_vars, {}
31
+ default_config :extra_flags, []
31
32
  default_config :tags, []
32
33
  default_config :skip_tags, []
33
34
  default_config :verbosity, 1
@@ -112,9 +113,10 @@ module Kitchen
112
113
  def ansible_options
113
114
  %i[
114
115
  ansible_config
115
- ansible_extra_vars
116
+ ansible_env_vars
116
117
  ansible_use_private_key
117
118
  ansible_use_vault_password_file
119
+ ansible_extra_flags
118
120
  ansible_tags
119
121
  ansible_skip_tags
120
122
  ansible_verbosity
@@ -126,18 +128,23 @@ module Kitchen
126
128
  cmd
127
129
  end
128
130
 
129
- def ansible_extra_vars(cmd)
130
- config[:extra_vars]&.each { |k, v| cmd.prepend("#{k}=\"#{v}\"") }
131
+ def ansible_env_vars(cmd)
132
+ config[:env_vars]&.each { |k, v| cmd.prepend("#{k}=\"#{v}\"") }
133
+ cmd
134
+ end
135
+
136
+ def ansible_extra_flags(cmd)
137
+ cmd << "#{config[:extra_flags].join(" ")}" unless config[:extra_flags].empty?
131
138
  cmd
132
139
  end
133
140
 
134
141
  def ansible_tags(cmd)
135
- cmd << "--tags \"#{config[:tags].join}\"" unless config[:tags].empty?
142
+ cmd << "--tags \"#{config[:tags].join(',')}\"" unless config[:tags].empty?
136
143
  cmd
137
144
  end
138
145
 
139
146
  def ansible_skip_tags(cmd)
140
- cmd << "--skip-tags \"#{config[:skip_tags].join}\"" unless config[:skip_tags].empty?
147
+ cmd << "--skip-tags \"#{config[:skip_tags].join(',')}\"" unless config[:skip_tags].empty?
141
148
  cmd
142
149
  end
143
150
 
@@ -148,10 +155,12 @@ module Kitchen
148
155
  state = instance.transport.instance_variable_get(:@connection_options)
149
156
  cmd << "--private-key #{state[:keys][0]}"
150
157
  end
158
+ cmd
151
159
  end
152
160
 
153
161
  def ansible_use_vault_password_file(cmd)
154
- cmd << "--vault-password-file #{config[:vault_password_file]}" if config[:vault_password_file]
162
+ cmd << "--vault-password-file #{config[:vault_password_file]}" unless config[:vault_password_file].nil?
163
+ cmd
155
164
  end
156
165
 
157
166
  def ansible_verbosity(cmd)
@@ -3,7 +3,7 @@
3
3
  module Kitchen
4
4
  module Yansible
5
5
  module Pusher
6
- VERSION = "0.1.2"
6
+ VERSION = "0.2.0"
7
7
  end
8
8
  end
9
9
  end
@@ -23,7 +23,7 @@ module Kitchen
23
23
  def build_ansible_command: () -> String
24
24
  def ansible_options: () -> Array[Symbol]
25
25
  def ansible_config: (Array[String]) -> Array[String]
26
- def ansible_extra_vars: (Array[String]) -> Array[String]
26
+ def ansible_env_vars: (Array[String]) -> Array[String]
27
27
  def ansible_tags: (Array[String]) -> Array[String]
28
28
  def ansible_skip_tags: (Array[String]) -> Array[String]
29
29
  def ansible_use_private_key: (Array[String]) -> Array[String]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-yansible-pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose M. Tobar