# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Check if docker daemon configuration exists stat: path: "{{ docker_config_path }}/daemon.json" register: docker_config_stat - name: Load docker daemon configuration slurp: path: "{{ docker_config_path }}/daemon.json" register: docker_config when: docker_config_stat.stat.exists - name: Parse docker daemon configuration set_fact: docker_config: "{{ docker_config.content | b64decode | from_json }}" when: docker_config_stat.stat.exists - name: Append to docker daemon configuration set_fact: docker_config: "{{ docker_config | default({}) | combine(docker_config_append) }}" - name: Save docker daemon configuration copy: content: "{{ docker_config | to_nice_json }}" dest: "{{ docker_config_path }}/daemon.json" become: true - name: "Restart docker service" service: name: docker state: restarted become: true