Skip to content

Commit 229e3f4

Browse files
committed
Add check and diff options to kolla-ansible
This patch is adding --check and --diff options to kolla-ansible, which cause that kolla-ansible run will be more verbose and able to run in semi dry-run mode. The --diff option for kolla-ansible can be used alone or with --check. When you run in diff mode, any module that supports diff mode reports the changes made or, if used with --check, the changes that would have been made. Diff mode is most common in modules that manipulate files (for example, the template module) but other modules might also show ‘before and after’ information (for example, the user module). For more information check [1]. [1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_checkmode.html#using-diff-mode Change-Id: Ifb82ea99e5af82540e938eab9e2a442b2820d7df (cherry picked from commit 0e720b3)
1 parent b621fd8 commit 229e3f4

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
features:
3+
- |
4+
Adds two new arguments to the ``kolla-ansible`` command, ``--check``
5+
and ``--diff``. They are passed through directly to ``ansible-playbook``.

tools/kolla-ansible

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Options:
139139
--vault-id <@prompt or path> Specify @prompt or password file (Ansible >= 2.4)
140140
--ask-vault-pass Ask for vault password
141141
--vault-password-file <path> Specify password file for vault decrypt
142+
--check, -C Don't make any changes and try to predict some of the changes that may occur instead
143+
--diff, -D Show differences in ansible-playbook changed tasks
142144
--verbose, -v Increase verbosity of ansible-playbook
143145
144146
Environment variables:
@@ -190,6 +192,8 @@ cat <<EOF
190192
--vault-id
191193
--ask-vault-pass
192194
--vault-password-file
195+
--check -C
196+
--diff -D
193197
--verbose -v
194198
prechecks
195199
check
@@ -217,8 +221,8 @@ EOF
217221

218222
check_environment_coherence
219223

220-
SHORT_OPTS="hi:p:t:k:e:v"
221-
LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,verbose,configdir:,passwords:,limit:,forks:,vault-id:,ask-vault-pass,vault-password-file:,yes-i-really-really-mean-it,include-images,include-dev:,full,incremental"
224+
SHORT_OPTS="hi:p:t:k:e:CD:v"
225+
LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,check,diff,verbose,configdir:,passwords:,limit:,forks:,vault-id:,ask-vault-pass,vault-password-file:,yes-i-really-really-mean-it,include-images,include-dev:,full,incremental"
222226

223227
RAW_ARGS="$*"
224228
ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; }
@@ -263,6 +267,16 @@ while [ "$#" -gt 0 ]; do
263267
shift 2
264268
;;
265269

270+
(--check|-C)
271+
EXTRA_OPTS="$EXTRA_OPTS --check"
272+
shift 1
273+
;;
274+
275+
(--diff|-D)
276+
EXTRA_OPTS="$EXTRA_OPTS --diff"
277+
shift 1
278+
;;
279+
266280
(--verbose|-v)
267281
VERBOSITY="$VERBOSITY --verbose"
268282
shift 1

0 commit comments

Comments
 (0)