-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate_yaml.yml
41 lines (35 loc) · 904 Bytes
/
validate_yaml.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- hosts: 192.168.62.7
gather_facts: yes
tasks:
- name: create temp dir
tempfile:
state: directory
delegate_to: localhost
register: temp_config
- name: set temdir path
set_fact:
tmp_dir: "{{ temp_config.path }}"
delegate_to: localhost
- name: Find YAML files on remote server
find:
paths: /home/ubuntu
patterns: "test*.yml"
register: yml_files
- name: Fetch YAML files
fetch:
src: "{{ item.path }}"
dest: "{{ tmp_dir }}/"
flat: yes
loop: "{{ yml_files.files }}"
- name: Find yml files
find:
paths: "{{ tmp_dir }}"
patterns: "*.yml"
delegate_to: localhost
register: yml_files
- name: validate yaml
vars:
yaml_name: "{{ item.path }}"
include_tasks: validate.yml
loop: "{{ yml_files.files }}"