Zack Williams | 618ab86 | 2018-08-03 10:12:54 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # This playbook will create directories needed by the local-directories helm |
| 17 | # chart that will be turned into k8s PersistentVolumes |
| 18 | # |
| 19 | # For dev use only - use real volumes/disks in production |
| 20 | |
| 21 | - hosts: all |
| 22 | become: yes |
| 23 | |
| 24 | vars: |
| 25 | helm_values_file: ./values.yaml |
| 26 | |
| 27 | tasks: |
| 28 | - name: Read yaml from helm_values_file |
| 29 | set_fact: |
| 30 | helm_values: "{{ lookup('file', helm_values_file) | from_yaml }}" |
| 31 | |
| 32 | - name: Create directories on nodes |
| 33 | when: item.host == ansible_hostname |
| 34 | file: |
| 35 | path: "{{ item.directory }}" |
| 36 | state: directory |
| 37 | owner: root |
| 38 | group: root |
| 39 | mode: 0755 |
| 40 | with_items: "{{ helm_values.volumes }}" |
| 41 | |