What's the preferred way to conditionally configure something if the 'how' 
changes from os to os, and version to version 'of' any particular os ?

Here's an example - setting up a serial console on a SysVinit system 
(example - debian 7.8):

---
- hosts: all
  gather_facts: yes
  tasks:
    - name: set up serial console
      replace:
         dest:    /etc/inittab
         regexp:  "^#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100$"
         replace: "T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100"
      notify:
         - telinit_q
  handlers:
   - name: telinit_q
     command: "/sbin/telinit q"


But that only works on debian-7 systems.  I can limit it to debian-7 by 
inserting


           when:
              ansible_distribution == 'Debian' and 
ansible_distribution_version == '7' 


But that doesn't handle centos-5 which has a slightly different 
search/replace needed....or centos-7 which uses systemd, and so on.

I guess I'm struggling with how to have a set (tree?) of plays for task-ABC 
that are known good, but only using them when the os/version say to do it 
that way.

Is the preferred way to include .yml files based on distribution/version 
values discovered at runtime ?   Examples ?



-- 
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/cec21a03-fe86-434b-ab8c-c995110cc2aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to