Re: [ansible-project] when: ansible conditional's based on distribution major version
That worked thank you very much! On Tuesday, August 27, 2019 at 10:29:28 AM UTC-5, Michael M wrote: > > Jeffrey, > > Try: > > when: ansible_distribution_major_version == '7' > > On Tue, Aug 27, 2019 at 8:07 AM Jeffrey Agnitsch > > wrote: > > > > I am trying to copy over .rpm files based on the major version of the > operating system I believe I am referencing the ansible_facts part > incorrectly does anyone have an example of the right way? > > > > tasks: > > - name: Copy kernel RHEL6 > > copy: > > src: > /etc/ansible/files/individual_files/test/kernel-2.6.32-754.15.3.el6.x86_64.rpm > > > > dest: /tmp/kernel-2.6.32-754.15.3.el6.x86_64.rpm > > owner: root > > group: root > > mode: 0644 > > when: ansible_facts['distribution_major_version'] == '6' > > > > - name: Copy kernel RHEL6 firmware > > copy: > > src: > /etc/ansible/files/individual_files/test/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm > > > > dest: /tmp/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm > > owner: root > > group: root > > mode: 0644 > > when: ansible_facts['ansible_distribution_major_version'] == '6' > > > > - name: Copy kernel RHEL7 > > copy: > > src: > /etc/ansible/files/individual_files/rhel7/kernel-3.10.0-1062.el7.x86_64.rpm > > dest: /tmp/kernel-3.10.0-1062.el7.x86_64.rpm > > owner: root > > group: root > > mode: 0644 > > when: ansible_facts['ansible_distribution_major_version'] == '7' > > > > - name: Copy kernel RHEL7 firmware > > copy: > > src: > /etc/ansible/files/individual_files/rhel7/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm > > > > dest: /tmp/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm > > owner: root > > group: root > > mode: 0644 > > when: ansible_facts['ansible_distribution_major_version'] == '7' > > > > -- > > 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 ansible...@googlegroups.com . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/bb31e45d-8967-4256-821c-8c45ab6184f7%40googlegroups.com. > > > -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/53bc3b66-e15b-4042-838d-187a28f2df46%40googlegroups.com.
Re: [ansible-project] when: ansible conditional's based on distribution major version
Jeffrey, Try: when: ansible_distribution_major_version == '7' On Tue, Aug 27, 2019 at 8:07 AM Jeffrey Agnitsch wrote: > > I am trying to copy over .rpm files based on the major version of the > operating system I believe I am referencing the ansible_facts part > incorrectly does anyone have an example of the right way? > > tasks: > - name: Copy kernel RHEL6 > copy: > src: > /etc/ansible/files/individual_files/test/kernel-2.6.32-754.15.3.el6.x86_64.rpm > dest: /tmp/kernel-2.6.32-754.15.3.el6.x86_64.rpm > owner: root > group: root > mode: 0644 > when: ansible_facts['distribution_major_version'] == '6' > > - name: Copy kernel RHEL6 firmware > copy: > src: > /etc/ansible/files/individual_files/test/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm > dest: /tmp/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm > owner: root > group: root > mode: 0644 > when: ansible_facts['ansible_distribution_major_version'] == '6' > > - name: Copy kernel RHEL7 > copy: > src: > /etc/ansible/files/individual_files/rhel7/kernel-3.10.0-1062.el7.x86_64.rpm > dest: /tmp/kernel-3.10.0-1062.el7.x86_64.rpm > owner: root > group: root > mode: 0644 > when: ansible_facts['ansible_distribution_major_version'] == '7' > > - name: Copy kernel RHEL7 firmware > copy: > src: > /etc/ansible/files/individual_files/rhel7/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm > dest: /tmp/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm > owner: root > group: root > mode: 0644 > when: ansible_facts['ansible_distribution_major_version'] == '7' > > -- > 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 ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/bb31e45d-8967-4256-821c-8c45ab6184f7%40googlegroups.com. -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAH4rTPvbetq4a3%2BkTr%2BEJ02nPHZQhemby3HcH2ig-nWWidbtUg%40mail.gmail.com.
[ansible-project] when: ansible conditional's based on distribution major version
I am trying to copy over .rpm files based on the major version of the operating system I believe I am referencing the ansible_facts part incorrectly does anyone have an example of the right way? tasks: - name: Copy kernel RHEL6 copy: src: /etc/ansible/files/individual_files/test/kernel-2.6.32-754.15.3.el6.x86_64.rpm dest: /tmp/kernel-2.6.32-754.15.3.el6.x86_64.rpm owner: root group: root mode: 0644 when: ansible_facts['distribution_major_version'] == '6' - name: Copy kernel RHEL6 firmware copy: src: /etc/ansible/files/individual_files/test/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm dest: /tmp/kernel-firmware-2.6.32-754.15.3.el6.noarch.rpm owner: root group: root mode: 0644 when: ansible_facts['ansible_distribution_major_version'] == '6' - name: Copy kernel RHEL7 copy: src: /etc/ansible/files/individual_files/rhel7/kernel-3.10.0-1062.el7.x86_64.rpm dest: /tmp/kernel-3.10.0-1062.el7.x86_64.rpm owner: root group: root mode: 0644 when: ansible_facts['ansible_distribution_major_version'] == '7' - name: Copy kernel RHEL7 firmware copy: src: /etc/ansible/files/individual_files/rhel7/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm dest: /tmp/linux-firmware-20190429-72.gitddde598.el7.noarch.rpm owner: root group: root mode: 0644 when: ansible_facts['ansible_distribution_major_version'] == '7' -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bb31e45d-8967-4256-821c-8c45ab6184f7%40googlegroups.com.