From ace57871fa6de7d482baf1c41f278459556da108 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Mon, 17 Sep 2018 17:26:47 -0400 Subject: [PATCH] Convert with_dict tasks to use loop and be less chatty with_dict is replaced by ansible's loop: https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-dict This migrates tasks using with_dict over to use loop instead. Additionally, when using loop (or with_dict), the entire loop item is logged by default. This makes these tasks very verbose since we're looping over large json/yaml files. Instead, use loop_control and label ot only log the item key. The entire data structure already exists in the config-download directory anyway, so there's no need to log the whole thing to the console. Conflicts: common/deploy-steps-tasks.yaml Change-Id: I1fc7431dfc662212b6ca64f4f738760f25b0c30b (cherry picked from commit 1b0c827930866538a8d1cae91f1c31bbd09b4199) (cherry picked from commit 94df25e339368439d144c18142f50f442f219285) --- common/deploy-steps-tasks.yaml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index bd1a21312e..45f9852031 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -114,8 +114,10 @@ - container_config_scripts - name: Write docker config scripts - copy: content="{{item.value.content}}" dest="/var/lib/docker-config-scripts/{{item.key}}" force=yes mode="{{item.value.mode|default('0600', true)}}" - with_dict: "{{role_data_docker_config_scripts}}" + copy: content="{{ item[1].content }}" dest="/var/lib/docker-config-scripts/{{ item[0] }}" force=yes mode="{{ item[1].mode | default('0600', true) }}" + loop: "{{ role_data_docker_config_scripts | dictsort }}" + loop_control: + label: "{{ item[0] }}" tags: - container_config_scripts @@ -162,8 +164,10 @@ - container_startup_configs - name: Write per-step docker-container-startup-configs - copy: content="{{item.value|to_json}}" dest="/var/lib/tripleo-config/docker-container-startup-config-{{item.key}}.json" force=yes mode=0600 - with_dict: "{{docker_config_with_default}}" + copy: content="{{ item[1] | to_json }}" dest="/var/lib/tripleo-config/docker-container-startup-config-{{ item[0] }}.json" force=yes mode=0600 + loop: "{{ docker_config_with_default | dictsort }}" + loop_control: + label: "{{ item[0] }}" tags: - container_startup_configs @@ -190,8 +194,10 @@ - container_startup_configs - name: Write kolla config json files - copy: content="{{item.value|to_json}}" dest="{{item.key}}" force=yes mode=0600 - with_dict: "{{role_data_kolla_config}}" + copy: content="{{ item[1] | to_json }}" dest="{{ item[0] }}" force=yes mode=0600 + loop: "{{ role_data_kolla_config | dictsort }}" + loop_control: + label: "{{ item[0] }}" tags: - container_startup_configs @@ -227,8 +233,10 @@ - container_config_tasks - name: Write docker-puppet-tasks json files - copy: content="{{item.value|to_json}}" dest=/var/lib/docker-puppet/docker-puppet-tasks{{item.key.replace("step_", "")}}.json force=yes mode=0600 - with_dict: "{{role_data_docker_puppet_tasks}}" + copy: content="{{ item[1] | to_json }}" dest=/var/lib/docker-puppet/docker-puppet-tasks{{ item[0].replace("step_", "") }}.json force=yes mode=0600 + loop: "{{ role_data_docker_puppet_tasks | dictsort }}" + loop_control: + label: "{{ item[0] }}" when: deploy_server_id == bootstrap_server_id tags: - container_config_tasks