Monty Taylor 19f9a4e135
Don't write out nodepool primary file on non-primary node
Change-Id: Ie866ba83c62a6fd45de6a783eecda217e90fd49e
2017-09-26 15:21:50 -05:00

27 lines
888 B
YAML

- hosts: all
tasks:
- name: Create nodepool directory
file:
path: /etc/nodepool
state: directory
- name: Create nodepool subnodes file
copy:
dest: /etc/nodepool/sub_nodes_private
content: ""
- name: Populate nodepool subnodes file
lineinfile:
path: /etc/nodepool/sub_nodes_private
line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}"
with_items: "{{ groups['subnodes'] }}"
when: groups['subnodes'] is defined
- name: Create nodepool primary file
copy:
dest: /etc/nodepool/primary_node_private
content: "{{ hostvars['primary']['nodepool']['private_ipv4'] }}"
when: hostvars['primary'] is defined
- name: Copy ssh keys to nodepool directory
command: "cp .ssh/{{ item }} /etc/nodepool/{{ item }}"
with_items:
- id_rsa
- id_rsa.pub