Translate

Use categories on the left bar

For orientation in my website, please use a left menu bar with category/subcategory list

Playbooks - Variables - Distribution version

Yestrday I came across with usage of Distribution version

I googled whole google but nothing works.

But I found some interesting playbooks. For print all variables for usage in ansible you can use this one.

This command print all your host variables to the file tmp.txt
ansible-playbook --tags "debug_info" -i ipofyourhost, print_variable.yml -e variable_host=ipofyourhost >> tmp.txt

I tried
ansible_lsb.major_release|int >= 5
ansible_distribution_version|int = 7

Nothing works....
Only this one.
  when: (ansible_distribution_version|int >= 8)

Here is example of usage:

- name: Install RPM
  yum:
    name: "{{ item.path }}"
    state: present
  with_items: "{{ rpm_result.files }}"
  when: (ansible_distribution_version|int < 8)

- name: Install RPM
  dnf:
    name: "{{ item.path }}"
    state: present
    update_cache: no
  with_items: "{{ rpm_result.files }}"
  when: (ansible_distribution_version|int >= 8)

No comments:

Post a Comment