76 | | {{{ |
77 | | """ |
78 | | Get list of racks in a cluster |
79 | | |
80 | | Usage: {% getracks <cluster> as <listname> %} |
81 | | """ |
82 | | }}} |
83 | | |
| 76 | Get list of all racks in a cluster. |
| 77 | |
| 78 | '''Usage''': |
| 79 | * {{{ {% getracks <cluster> as <listname> %} }}} |
| 80 | |
| 81 | '''Example's''': |
| 82 | * |
| 83 | {{{ |
| 84 | {% use HardwareUnit with 'cluster__name=Gina' as gina_hosts %} |
| 85 | {% getracks 'Gina' as gina_racks %} |
| 86 | |
| 87 | {% for r in gina_racks %} |
| 88 | {% assign filename = '/var/tmp/hosts.' r.label '.in' %} |
| 89 | |
| 90 | {% store filename %} |
| 91 | {% noblanklines %} |
| 92 | |
| 93 | # Hosts file containing all hosts from rack: {{ r.label }} |
| 94 | |
| 95 | {% for h in gina_hosts %} |
| 96 | {% if h.rack.label == r.label %} |
| 97 | |
| 98 | {{ h.label }} |
| 99 | |
| 100 | {% endif %} |
| 101 | {% endfor %} |
| 102 | |
| 103 | {% endnoblanklines %} |
| 104 | {% endstore %} |
| 105 | |
| 106 | {% endfor %} |
| 107 | }}} |