Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible_distribution error #8

Open
Jessie-Lazo opened this issue Oct 21, 2024 · 0 comments
Open

ansible_distribution error #8

Jessie-Lazo opened this issue Oct 21, 2024 · 0 comments

Comments

@Jessie-Lazo
Copy link

I've been facing an issue with my code, I'm not sure if it's because of the version of my ansible, which is 2.5.1. I am not able to upgrade further, it is not allowing me. So, I am looking for alternatives solutions how to fix the error I get.

  • hosts: all
    become: true
    gather_facts: yes
    pre_tasks:

    • name: install update and repositories (CentOS)
      tags: always
      dnf:
      name: "*"
      update_cache: yes
      state: latest
      changed_when: false
      when: ansible_distribution == "CentOS"

    • name: install update and repositories (Ubuntu)
      tags: always
      apt:
      upgrade: yes
      update_cache: yes
      cache_valid_time: 86400
      changed_when: false
      when: ansible_distribution == "Ubuntu"

The error is ansible_distribution == "CentOS" undefined.
My centos is using python3 which I already included in my inventory as interpreter.
my ubuntu does not have any problem. I also check ansible setup and see that under my ubuntu server there is ansible_distribution while under centos server it is not appearing.

Thank you for any response that can help resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant