Browse Source

use integrated host_vars

master
parent
commit
e4f27abbfe
5 changed files with 35 additions and 11 deletions
  1. +0
    -11
      meta/main.yml
  2. +17
    -0
      tasks/host_vars.yml
  3. +3
    -0
      tasks/main.yml
  4. +5
    -0
      templates/host_vars.yml.j2
  5. +10
    -0
      vars/main.yml

+ 0
- 11
meta/main.yml View File

@@ -1,11 +0,0 @@
---
dependencies:
- role: static_host_vars
static_host_vars_filename: partitions
static_host_vars:
hard_disks: "{{ hard_disks }}"
mdraid_devices: "{{ mdraid_devices }}"
dmcrypt_devices: "{{ dmcrypt_devices }}"
volume_groups: "{{ volume_groups }}"
logical_volumes: "{{ logical_volumes }}"
filesystems: "{{ filesystems }}"

+ 17
- 0
tasks/host_vars.yml View File

@@ -0,0 +1,17 @@
---

- name: host_vars directory
local_action:
file
path={{ playbook_dir }}/host_vars/{{inventory_hostname}}
state=directory

- name: host_vars file
local_action:
template
src=host_vars.yml.j2
dest={{ playbook_dir }}/host_vars/{{inventory_hostname}}/{{_host_vars_filename}}.yml

- name: include host_vars
include_vars:
dir: "{{ playbook_dir }}/host_vars/{{inventory_hostname}}/"

+ 3
- 0
tasks/main.yml View File

@@ -0,0 +1,3 @@
---

- include: host_vars.yml

+ 5
- 0
templates/host_vars.yml.j2 View File

@@ -0,0 +1,5 @@
{% if ("host_vars/"+inventory_hostname+'/'+_host_vars_filename+'.yml') | is_file %}
{{ _host_vars_default | combine( lookup('file','host_vars/'+inventory_hostname+'/'+_host_vars_filename+'.yml') | from_yaml ) | combine( _host_vars ) | to_nice_yaml }}
{% else %}
{{ _host_vars_default | combine( _host_vars ) | to_nice_yaml }}
{% endif %}

+ 10
- 0
vars/main.yml View File

@@ -1,3 +1,13 @@
_host_vars_filename: partitions
_host_vars:
hard_disks: "{{ hard_disks }}"
mdraid_devices: "{{ mdraid_devices }}"
dmcrypt_devices: "{{ dmcrypt_devices }}"
volume_groups: "{{ volume_groups }}"
logical_volumes: "{{ logical_volumes }}"
filesystems: "{{ filesystems }}"


filesystem_uuid_namespace: "{{ lookup('pipe','uuid -v4') }}" filesystem_uuid_namespace: "{{ lookup('pipe','uuid -v4') }}"


_fs_uuid_root: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' root') }}" _fs_uuid_root: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' root') }}"


Loading…
Cancel
Save