Thanks for your reply. I was on vacation and travelling. Sorry for delayed reply.
its working fine when multiple module calls in a single task. This is fine. - name: copying clinet install zip to server become: yes become_method: sudo copy: src=/root/Desktop/clinetinstall.zip dest=clientproducts/Install.zip when: ansible_distribution == "CentOS" copy: src=/root/Desktop/myfile dest=clientproducts/myfile when: ansible_distribution == "RedHat" I expected the same when I used yum and zypper module in s single task. This is not working: - name: installing python-setuptools yum: name=python-setuptools state=latest when: ansible_os_family == "RedHat" zypper: name=python-setuptools state=latest when: ansible_os_family == "SLES" become: yes become_method: sudo Best Regards, Suresh. On Friday, April 29, 2016 at 7:55:18 PM UTC+5:30, Matt Martz wrote: > > It seems your problem, is that you have multiple module calls within a > single task, which is not permitted. > > You need two tasks, one with each copy, such as: > > - name: copying clinet install zip to server (CentOS) > become: yes > become_method: sudo > copy: src=/root/Desktop/clinetinstall.zip > dest=clientproducts/Install.zip > when: ansible_distribution == "CentOS" > > - name: copying clinet install zip to server (RedHat) > become: yes > become_method: sudo > copy: src=/root/Desktop/myfile dest=clientproducts/myfile > when: ansible_distribution == "RedHat" > > On Fri, Apr 29, 2016 at 9:11 AM, 'Suresh Uppu' via Ansible Development < > ansibl...@googlegroups.com <javascript:>> wrote: > >> Thank you very much. >> >> "copy" module displaying one task only. Please see the below play. >> " >> - name: copying clinet install zip to server >> become: yes >> become_method: sudo >> copy: src=/root/Desktop/clinetinstall.zip >> dest=clientproducts/Install.zip >> when: ansible_distribution == "CentOS" >> copy: src=/root/Desktop/myfile dest=clientproducts/myfile >> when: ansible_distribution == "RedHat" >> " >> expected the same behavior when I used "yum" and "zypper". >> >> Thank you very much for your help. >> >> Best Regards, >> Suresh. >> >> >> On Friday, April 29, 2016 at 6:58:17 PM UTC+5:30, Allen Sanabria wrote: >>> >>> I do not think you can avoid the skipping message, as block evaluates >>> the when condition, and if not meant it skips it, which I think is >>> appropriate. I do see your concern though. >>> >>> On Friday, April 29, 2016 at 6:25:08 AM UTC-7, Suresh Uppu wrote: >>>> >>>> yes block is working as expected. >>>> >>>> Can I avoid displaying the below "skipping". from end user point of >>>> view trying the same task twice. However it is not continuing with SLES, >>>> but task will be displayed but skipped. >>>> >>>> TASK [installing python-setuptools] >>>> ******************************************** >>>> skipping: [54.169.240.218] >>>> >>>> code with block: >>>> - block: >>>> - name: installing python-setuptools >>>> become: yes >>>> become_method: sudo >>>> yum: name=python-setuptools state=latest >>>> when: ansible_os_family == "RedHat" >>>> >>>> - block: >>>> - name: installing python-setuptools >>>> become: yes >>>> become_method: sudo >>>> zypper: name=python-setuptools state=latest >>>> when: ansible_os_family == "SLES" >>>> >>>> I am getting the same out put with my original play. >>>> original code: >>>> - name: installing python-setuptools >>>> yum: name=python-setuptools state=latest >>>> when: ansible_os_family == "RedHat" >>>> become: yes >>>> become_method: sudo >>>> >>>> - name: installing python-setuptools >>>> - zypper: name=python-setuptools state=latest >>>> when: ansible_os_family == "SLES" >>>> become: yes >>>> become_method: sudo >>>> >>>> Best Regards, >>>> Suresh. >>>> >>>> On Friday, April 29, 2016 at 6:36:13 PM UTC+5:30, Allen Sanabria wrote: >>>>> >>>>> The block is working as expected. Since the OS that it matches is >>>>> RedHat, it will than install the redhat and not continue with SLS. I >>>>> think >>>>> you should print out the ansible_os_family variable and see what it >>>>> prints >>>>> out. RedHat or SLS >>>>> >>>>> On Friday, April 29, 2016 at 6:00:20 AM UTC-7, Suresh Uppu wrote: >>>>>> >>>>>> Thanks for your reply. >>>>>> >>>>>> yes I tried. >>>>>> >>>>>> I got the same output even I used blocks. >>>>>> >>>>>> I am seeing two tasks, however one is skipping. End user may feel >>>>>> that why the same task twice and one is skipping. Would like to see one >>>>>> task. >>>>>> >>>>>> " >>>>>> TASK [installing python-setuptools] >>>>>> ******************************************** >>>>>> ok: [54.169.240.218] >>>>>> >>>>>> TASK [installing python-setuptools] >>>>>> ******************************************** >>>>>> skipping: [54.169.240.218] >>>>>> >>>>>> " >>>>>> I getting below output when I used copy module based distribution. >>>>>> got the below response. >>>>>> >>>>>> TASK [copying clinet install zip to server] >>>>>> ************************************ >>>>>> ok: [54.169.240.218] >>>>>> >>>>>> Best Regards, >>>>>> Suresh. >>>>>> >>>>>> On Friday, April 29, 2016 at 5:36:42 PM UTC+5:30, Suresh Uppu wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I am installing python-setuptools. I am have my play book like that >>>>>>> to insatll on Suse and Redhat >>>>>>> >>>>>>> - name: installing python-setuptools >>>>>>> yum: name=python-setuptools state=latest >>>>>>> when: ansible_os_family == "RedHat" >>>>>>> become: yes >>>>>>> become_method: sudo >>>>>>> >>>>>>> - zypper: name=python-setuptools state=latest >>>>>>> when: ansible_os_family == "SLES" >>>>>>> become: yes >>>>>>> become_method: sudo >>>>>>> >>>>>>> I expected the below should work. But it is not. Can I please >>>>>>> request any one what I am missing here? >>>>>>> >>>>>>> - name: installing python-setuptools >>>>>>> yum: name=python-setuptools state=latest >>>>>>> when: ansible_os_family == "RedHat" >>>>>>> zypper: name=python-setuptools state=latest >>>>>>> when: ansible_os_family == "SLES" >>>>>>> become: yes >>>>>>> become_method: sudo >>>>>>> >>>>>>> But the copy is working fine. Please see the below. >>>>>>> >>>>>>> - name: copying clinet install zip to server >>>>>>> become: yes >>>>>>> become_method: sudo >>>>>>> copy: src=/root/Desktop/clinetinstall.zip >>>>>>> dest=clientproducts/Install.zip >>>>>>> when: ansible_distribution == "CentOS" >>>>>>> copy: src=/root/Desktop/myfile dest=clientproducts/myfile >>>>>>> when: ansible_distribution == "RedHat" >>>>>>> >>>>>>> Best Regards, >>>>>>> Suresh >>>>>>> >>>>>>> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible-deve...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Matt Martz > @sivel > sivel.net > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.