Hello,

I wanted to manage repo names from group_vars based on OS type. I have a
requirement to set reponames for different OS & versions like
Centos/Redhat/Ubuntu with all stable versions. The goal is to manage future
repo names from group_vars

My variables looks like this

group_vars/all.yml

---
rhel_5_repo: redhat-5-rpms-stable <-- name of the repo which i will use to
install latest kernel patches
rhel_6_repo: redhat-6-rpms-stable
rhel_7_repo: redhat-7-rpms-stable
ubuntu_12_repo: ubuntu-12-deb-stable

I would like to use use repo keys into roles based on
fact  ansible_distribution_major_version and fetch the variable from
group_vars

- set_fact: repo_name="rhel_{{ ansible_distribution_major_version }}_repo"

- name: 'Upgrading packages to latest'
  yum:
     name: "*"
     state: latest
     enablerepo: "{{ repo_name }}"
  when: ansible_distribution == "RedHat" or ansible__distribution ==
"CentOS"

How can i achieve this..Please suggest.

Thanks
Sri

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF9AceEqG54ewFRp_LQBJVW8MkbwyPFTXfO%3DKL%3DTDqv_3hyA_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to