- name: deploy dnc hosts: "{{target}}" gather_facts: no become: "{{become_var}}" tasks: # need to define which nodes live in this cluster, in case we are calling # this playbook with a single target node - name: define nodes set_fact: #nodes_tmp: "{{ rangegroups[cluster] }}" nodes: "{{ groups[cluster] }}" run_once: true #- name: define nodes # set_fact: # node_ids: "{{ range(1, nodes | length + 1) | list }}" # run_once: true - debug: var=nodes run_once: true #- debug: var=node_ids # run_once: true # todo - git pull? - name: deploy dnc from github shell: executable: /bin/bash cmd: | set -e git clone https://github.com/pbraun9/dnc.git ls -ldh dnc/ creates: /root/dnc/ - name: deploy dnc.conf template: src: dnc.conf dest: /etc/dnc.conf # # full-blown nobudget farm # todo - what if we want nobudget1 to live on another node, and not even node2? # we don't want to put that guest config on NFS, that's chicken and egg... # but let's say we want nobudget1 on node5 and nobudget2 on node6 # #- debug: msg="{{ node_id + 1 }}" # loop: "{{nodes}}" # loop_control: # index_var: node_id # #- debug: var="{{ 0 / 0 }}" # we cannot do that with the nobudget role as those are the underlying guest skeletons - name: nobudget guest directory file: path: "/data_local/guests/nobudget{{node_id}}/" state: directory loop: "{{nodes}}" loop_control: loop_var: node index_var: node_id_tmp vars: node_id: "{{ node_id_tmp + 1 }}" when: - inventory_hostname_short == node - node_id < 3 # we have only two nobudget guests for ha # idem - name: nobudget guest config template: src: node_nobudget dest: "/data_local/guests/nobudget{{node_id}}/nobudget{{node_id}}" loop: "{{nodes}}" loop_control: loop_var: node index_var: node_id_tmp vars: node_id: "{{ node_id_tmp + 1 }}" when: - inventory_hostname_short == node - node_id < 3 # we have only two nobudget guests for ha # todo - also check for guest vdisk