Unable to access variables from host_vars dir however can access the same variables when specified in roles/defaults/mail.yml

I have created multiple inventory files specific to dev , qa etc env. under inventory dir.

inventory/dev.domain.net.yml

Any suggestions, would help as I am stucked here…

Whats the problem? where do you stuck. Please post more information.

TASK [ansible-manage-lvm : manage_lvm | creating new LVM volume group(s)] ******
e[0;31mfatal: [grafana]: FAILED! => {"msg": "'config_lv_name' is undefined"}e[0m
e[0;31me[0m

I am gettin the above error when I am trying to create and procure lvm stuff on my new environment. I want to mention all the variables as a part of host_vars like below:

# lvm variables

vg_name: "VolGroup01"
config_lv_name: "LogVol10"
data_lv_name: "LogVol11"
lvm_disk_name: "/dev/nvme2n1"
config_mntp: "/opt/tools"
data_mntp: "/data"
config_lv_size: "50G"
data_lv_size: "100G"



I am trying to use them as below :

lvm_groups:
      - vgname: "{{ vg_name }}"
        disks: 
          - "{{ lvm_disk_name }}"
        create: true
        lvnames:
          - lvname: "{{ config_lv_name }}"
            size: "{{ config_lv_size }}"
            create: true  ## Mention "false" in case of lvm removal
            filesystem: xfs
            mount: true
            mntp: "{{ config_mntp }}"
            
          - lvname: "LogVol11"
            size: "{{ data_lv_size }}"
            create: true  ## Mention "false" in case of lvm removal
            filesystem: xfs
            mount: true
            mntp: "{{ data_mntp }}"

    manage_lvm: true

@sagarmujumale - any idea on this?

i think you will have to provide the path using vars_files in the playbook and then run.

Are you using --limit param for ansible-playbook?

Dne středa 4. března 2020 14:49:44 UTC+1 Vishal Bobade napsal(a):