Thank you for your answer. :) I was afraid that there wasn't a way to go without "if"s on low levels and it is only possible by separating it to playbooks. Looks like I will need to redesign my project structure to account that.
четверг, 28 февраля 2019 г., 15:49:58 UTC+1 пользователь Jeffrey Agnitsch написал: > > What type of OS's are you referring to ? If you are staying within the > realm of Linux's you can gather facts and then do when statement. It might > also be good to just create separate named roles for the different OS. > - name: Copy | Copy Repo > copy: src=/etc/ansible/files/repos/oracle_local_6.repo > dest=/etc/yum.repos.d/oracle_local_6.repo > when: > - ansible_facts['distribution_major_version'] == "6" > > - name: Copy | Copy Repo > copy: src=/etc/ansible/files/repos/oracle_local_7.repo > dest=/etc/yum.repos.d/oracle_local_7.repo > when: > - ansible_facts['distribution_major_version'] == "7" > > > . You could also separate out things within the inventory file such as > > [debian] > server1 > server2 > > [centos] > server3 > server4 > > then do individual playbooks on those groups using something like > > > - hosts: centos > -tasks: > blah blah blah > > > - hosts: debian > -tasks > blah blah blah > > > -- 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/7481933b-6833-424d-b97a-fe7fd1a8dde4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
