From ecc6ce340aea59faaee4c2a49cd6d6fb90d8ed35 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Wed, 11 Oct 2017 12:47:01 +0200 Subject: [PATCH] Fix ConfigDebug for puppet host runs Before pike we used to be able to add -e environments/config-debug.yaml and that would give us debug logs for puppet. With the move to ansible running puppet we lost this feature. Let's make sure that the old ConfigDebug variable still works with the ansible playbook-based deploy steps. With this patch and ConfigDebug set to true, we correctly get the puppet debug logs: TASK [debug] ******************************************************************* ok: [localhost] => { "(outputs.stderr|default('')).split('\n')|union(outputs.stdout_lines|default([]))": [ "Warning: Undefined variable 'deploy_config_name'; ", " (file & line not available)", "Warning: This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at [\"/etc/puppet/modules/ntp/manifests/init.pp\", 54]:[\"/etc/puppet/modules/tripleo/manifests/profile/base/time/ntp.pp\", 29]", " (at /etc/puppet/modules/stdlib/lib/puppet/functions/deprecation.rb:25:in `deprecation')", "Debug: Runtime environment: puppet_version=4.8.2, ruby_version=2.0.0, run_mode=user, default_encoding=UTF-8", "Debug: Loading external facts from /etc/puppet/modules/openstacklib/facts.d", "Debug: Loading external facts from /var/lib/puppet/facts.d", .... Change-Id: Ia726fb8ca4a6f7bbbd7a1284d76ff42df6825d01 Closes-Bug: #1722752 --- common/deploy-steps-tasks.yaml | 6 +++++- common/deploy-steps.j2 | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 998bfc20b9..a2d4ee14d9 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -4,12 +4,16 @@ ##################################################### # Per step puppet configuration of the baremetal host ##################################################### + - name: Set host puppet debugging fact string + set_fact: + host_puppet_config_debug: "--debug --verbose" + when: enable_debug|default(false) - name: Write the config_step hieradata copy: content="{{dict(step=step|int)|to_json}}" dest=/etc/puppet/hieradata/config_step.json force=true mode=0600 become: true - name: Run puppet host configuration for step {{step}} command: >- - puppet apply + puppet apply {{ host_puppet_config_debug|default('') }} --modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules --logdest syslog --logdest console --color=false /var/lib/tripleo-config/puppet_step_config.pp diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 9daf93e76d..e3cb2b7bb7 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -48,6 +48,10 @@ parameters: description: Mapping of service endpoint -> protocol. Typically set via parameter_defaults in the resource registry. type: json + ConfigDebug: + default: false + description: Whether to run config management (e.g. Puppet) in debug mode. + type: boolean DockerPuppetDebug: type: string default: '' @@ -85,6 +89,7 @@ resources: - name: role_name - name: update_identifier - name: bootstrap_server_id + - name: enable_debug - name: docker_puppet_debug - name: docker_puppet_process_count config: @@ -291,6 +296,7 @@ resources: role_name: {{role.name}} update_identifier: {get_param: DeployIdentifier} bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']} + enable_debug: {get_param: ConfigDebug} docker_puppet_debug: {get_param: DockerPuppetDebug} docker_puppet_process_count: {get_param: DockerPuppetProcessCount} {% endfor %}