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 +4 -4
- data/README.md +28 -18
- data/lib/kitchen/provisioner/yansible_pusher.rb +17 -8
- data/lib/kitchen/yansible/pusher/version.rb +1 -1
- data/sig/kitchen/yansible/pusher.rbs +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa8a79886e6402a3e4a5c8c788ac05e7e2c1e7e156b0f112d8512055b30bc595
|
4
|
+
data.tar.gz: 7bc8189cd68321d3f9819caa02d0f8cc90800b8853043f8120e61d3345e97967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
#
|
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 :
|
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
|
-
|
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
|
130
|
-
config[:
|
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]}"
|
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)
|
@@ -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
|
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]
|