On Wednesday, 31 January 2018 05.43.36 CET sriman dharba wrote:
> - 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"

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

or just drop the set_fact and use 

- name: 'Upgrading packages to latest'
  yum:
     name: "*"
     state: latest
     enablerepo: "{{ vars['repo_' ~ ansible_distribution_major_version ~ 
'_repo'] }}"
  when: ansible_distribution == "RedHat" or ansible__distribution == "CentOS"


-- 
Kai Stian Olstad

-- 
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/12765257.BGxFR1VXkv%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to