@@ -140,15 +140,14 @@ def cmd_configure(configure_data, base_project, dryrun):
140140 return Status ("ok" )
141141
142142
143- def cmd_deploy (configure_data , base_project , dryrun = False , verbose = False ):
143+ def cmd_deploy (configure_data , base_project , dryrun = False ):
144144 """Main executor for the deploy sub-command
145145
146146 Args:
147147 configure_data (obj): configuration structure
148148 base_project (str): base project path where to
149149 look for the Terraform and Ansible files
150150 dryrun (bool): enable dryrun execution mode
151- verbose (bool): enable more verbosity
152151
153152 Returns:
154153 int: execution result, 0 means OK. It is mind to be used as script exit code
@@ -161,26 +160,25 @@ def cmd_deploy(configure_data, base_project, dryrun=False, verbose=False):
161160 )
162161 if res != 0 :
163162 return res
164- return cmd_ansible (configure_data , base_project , dryrun , verbose , destroy = False )
163+ return cmd_ansible (configure_data , base_project , dryrun , destroy = False )
165164
166165
167- def cmd_destroy (configure_data , base_project , dryrun = False , verbose = False ):
166+ def cmd_destroy (configure_data , base_project , dryrun = False ):
168167 """Main executor for the deploy sub-command
169168
170169 Args:
171170 configure_data (obj): configuration structure
172171 base_project (str): base project path where to
173172 look for the Terraform and Ansible files
174173 dryrun (bool): enable dryrun execution mode
175- verbose (bool): enable more verbosity
176174
177175 Returns:
178176 int: execution result, 0 means OK. It is mind to be used as script exit code
179177 """
180178 config = CONF (configure_data )
181179 if not config .validate ():
182180 return Status (f"Invalid configuration file content in { configure_data } " )
183- res = cmd_ansible (configure_data , base_project , dryrun , verbose , destroy = True )
181+ res = cmd_ansible (configure_data , base_project , dryrun , destroy = True )
184182 if res != 0 :
185183 return res
186184 return cmd_terraform (
@@ -294,7 +292,6 @@ def ansible_command_sequence(
294292 admin_user ,
295293 base_project ,
296294 sequence ,
297- verbose ,
298295 inventory ,
299296 profile ,
300297 junit ,
@@ -308,7 +305,6 @@ def ansible_command_sequence(
308305 base_project (str): base project path where to
309306 look for the Ansible files
310307 sequence (str): 'create' or 'destroy'
311- verbose (bool): enable more verbosity
312308 inventory (str): inventory.yaml file path
313309 profile (bool): enable task profile
314310 junit (str): enable junit report and provide folder where to store report
@@ -319,8 +315,7 @@ def ansible_command_sequence(
319315 list of strings, each of them is an anslble or ansible-playbook command
320316 """
321317
322- # 1. Create the environment variable set
323- # that will be used by any command
318+ # Create the environment variable set that will be used by any command
324319 original_env = dict (os .environ )
325320 original_env ["ANSIBLE_PIPELINING" ] = "True"
326321 original_env ["ANSIBLE_TIMEOUT" ] = "20"
@@ -335,7 +330,7 @@ def ansible_command_sequence(
335330 if "roles_path" in configure_data_ansible :
336331 original_env ["ANSIBLE_ROLES_PATH" ] = configure_data_ansible ["roles_path" ]
337332
338- # 2. Verify that the two needed binaries are usable
333+ # Verify that the two needed binaries are usable
339334 ansible_bin_paths = {}
340335 for ansible_bin in ["ansible" , "ansible-playbook" ]:
341336 binpath = shutil .which (ansible_bin )
@@ -344,14 +339,13 @@ def ansible_command_sequence(
344339 return False , f"Missing binary { ansible_bin } "
345340 ansible_bin_paths [ansible_bin ] = binpath
346341
347- # 3. Compose common arguments applicable to both 'ansible' and 'ansible-playbook'.
342+ # Compose common arguments applicable to both 'ansible' and 'ansible-playbook'.
348343 ansible_common = "-vv"
349- if verbose :
350- # add two more 'v' without any space
351- ansible_common += "vv"
344+ if "verbosity" in configure_data_ansible :
345+ ansible_common = "-" + "v" * int (configure_data_ansible ["verbosity" ])
352346 ansible_common += f" -i { inventory } "
353347
354- # 4. Start composing and accumulating all needed commands in a list
348+ # Start composing and accumulating all needed commands in a list
355349 ansible_cmd_seq = []
356350
357351 if junit and not os .path .isdir (junit ):
@@ -494,7 +488,6 @@ def cmd_ansible(
494488 configure_data ,
495489 base_project ,
496490 dryrun ,
497- verbose ,
498491 destroy = False ,
499492 profile = False ,
500493 junit = False ,
@@ -507,7 +500,6 @@ def cmd_ansible(
507500 base_project (str): base project path where to
508501 look for the Ansible files
509502 dryrun (bool): enable dryrun execution mode
510- verbose (bool): enable more verbosity
511503 destroy (bool): select the playbook list
512504 profile (bool): enable task profile
513505 junit (str): enable junit report and provide folder where to store it
@@ -560,7 +552,6 @@ def cmd_ansible(
560552 admin_user ,
561553 base_project ,
562554 selected_sequence ,
563- verbose ,
564555 inventory ,
565556 profile ,
566557 junit ,
0 commit comments