Stop relying on old legacy sub_nodes_private
Add subnodes to the inventory. Change-Id: I335f0bba2ca9c3e7e427e9247692c5c0d17b4087
This commit is contained in:
parent
6c7340dba8
commit
b1c53d9116
|
@ -9,7 +9,7 @@ node_count: 1
|
|||
|
||||
deployed_server_overcloud_roles:
|
||||
- name: Controller
|
||||
hosts: "$(sed -n 1,1p /etc/nodepool/sub_nodes_private)"
|
||||
hosts: "{{ subnodes.0 }}"
|
||||
|
||||
topology: >-
|
||||
--compute-scale 0
|
||||
|
|
|
@ -13,9 +13,9 @@ node_count: 2
|
|||
|
||||
deployed_server_overcloud_roles:
|
||||
- name: ControllerApi
|
||||
hosts: $(sed -n 1,1p /etc/nodepool/sub_nodes_private)
|
||||
hosts: "{{ subnodes.0 }}"
|
||||
- name: Controller
|
||||
hosts: "$(sed -n 2,2p /etc/nodepool/sub_nodes_private)"
|
||||
hosts: "{{ subnodes.1 }}"
|
||||
|
||||
topology: >-
|
||||
--compute-scale 0
|
||||
|
|
|
@ -39,21 +39,60 @@
|
|||
ansible_private_key_file: "{{ overcloud_key }}"
|
||||
ansible_ssh_extra_args: '-F "{{ local_working_dir }}/ssh.config.ansible"'
|
||||
|
||||
- when: inventory == 'multinode'
|
||||
- name: check existence of legacy nodepool directory
|
||||
stat:
|
||||
path: /etc/nodepool/sub_nodes_private
|
||||
register: stat_subnodes_private_result
|
||||
|
||||
- when: inventory == 'multinode' and stat_subnodes_private_result.stat.exists == True
|
||||
block:
|
||||
- name: Get subnodes
|
||||
command: cat /etc/nodepool/sub_nodes_private
|
||||
register: nodes
|
||||
|
||||
- name: Add subnode to ansible inventory
|
||||
with_indexed_items: '{{ nodes.stdout_lines | default([]) }}'
|
||||
- name: Create empty subnodes
|
||||
set_fact:
|
||||
subnodes: "[]"
|
||||
|
||||
- name: Add subnodes info from legacy nodepool directory
|
||||
set_fact:
|
||||
subnodes: "{{ subnodes }} + [item]"
|
||||
with_items: '{{ nodes.stdout_lines | default([]) }}'
|
||||
|
||||
- name: Add subnode to ansible inventory
|
||||
with_indexed_items: "{{ subnodes }}"
|
||||
add_host:
|
||||
name: 'subnode-{{ item.0 + 2 }}'
|
||||
groups: "overcloud"
|
||||
ansible_host: "{{ item.1 }}"
|
||||
inventory_ip: "{{ item.1 }}"
|
||||
ansible_user: "{{ lookup('env','USER') }}"
|
||||
ansible_private_key_file: "/home/{{ ansible_user }}/.ssh/id_rsa"
|
||||
when: inventory == 'multinode'
|
||||
|
||||
- name: check existence of legacy nodepool primary node file
|
||||
stat:
|
||||
path: /etc/nodepool/primary_node_private
|
||||
register: stat_primary_node_result
|
||||
|
||||
- when: inventory == 'multinode' and stat_primary_node_result.stat.exists == True
|
||||
block:
|
||||
- name: Get primary nodes
|
||||
command: cat /etc/nodepool/primary_node_private
|
||||
register: primary_node_private
|
||||
|
||||
- name: Create primary_node
|
||||
set_fact:
|
||||
primary_node: "{{ primary_node_private.stdout | default('') }}"
|
||||
|
||||
- name: Add primary_node to ansible inventory
|
||||
add_host:
|
||||
name: 'subnode-{{ item.0 + 2 }}'
|
||||
groups: "overcloud"
|
||||
ansible_host: '{{ item.1 }}'
|
||||
inventory_ip: '{{ item.1 }}'
|
||||
name: 'primary_node'
|
||||
groups: "undercloud"
|
||||
ansible_host: "{{ primary_node }}"
|
||||
inventory_ip: "{{ primary_node }}"
|
||||
ansible_user: "{{ lookup('env','USER') }}"
|
||||
ansible_private_key_file: "/etc/nodepool/id_rsa"
|
||||
ansible_private_key_file: "/home/{{ ansible_user }}/.ssh/id_rsa"
|
||||
|
||||
#required for regeneration of ssh.config.ansible
|
||||
- name: set_fact for undercloud ip
|
||||
|
|
Loading…
Reference in New Issue