/
main.yml
38 lines (36 loc) · 1.47 KB
/
main.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
---
# tasks file for init-for-integrated
# This tasks allowing you to arrange to organize groups in a playbooks dir.
#
# * About {group,host}_vars/**-secret.yml files.
# * These files encrypted that at Ansible-vault.
#
# Workaround:
# 2.1.1.0 で custom role path使ってると死亡 の回避
# 2.1.1.0 以上は以下の処理をする、それ以下はしない
# 実は >= "2.1.1.0" で判定可能だった(2.1.1.0 でテスト済)
#
# TODO: Change to best practices (http://docs.ansible.com/ansible/playbooks_best_practices.html#best-practices-for-variables-and-vaults)
- name: Ansible version check
command: ansible --version
register: ansible_version
delegate_to: 127.0.0.1
changed_when: False
- block:
- name: Read group_vars and host_vars. In addition, add the secret files.
include_vars: ../{{ item.group_or_host }}_vars/{{ item.type }}.yml
with_items:
- { group_or_host: 'group', type: 'all' }
- { group_or_host: 'host', type: "{{ inventory_hostname }}" }
- { group_or_host: 'host', type: "{{ inventory_hostname }}-secret" }
- include_vars: ../group_vars/{{ item }}.yml
with_items:
- "{{ lookup('items', '{{ group_names }}', wantlist=True) }}"
- include_vars: ../group_vars/{{ item }}-secret.yml
with_items:
- "{{ lookup('items', '{{ group_names }}', wantlist=True) }}"
when: ansible_version.full >= "2.1.1.0"
ignore_errors: True
- include: under_ver2.1.0.0.yml
static: no
when: ansible_version.full < "2.1.1.0"