-
Notifications
You must be signed in to change notification settings - Fork 16
/
add_undercloud_to_inventory.yml
39 lines (39 loc) · 1.29 KB
/
add_undercloud_to_inventory.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- hosts: localhost
vars:
infrared_hosts_dir: "{{ infrared_workspaces_dir }}/active"
inventory_file_name: "hosts-updated"
tasks:
- include_tasks: tasks/get_interpreter.yml
vars:
hostname: "{{ undercloud_hostname }}"
user: "stack"
- name: reload inventory content from inventory file
meta: refresh_inventory
when: scale_compute_vms == true
- name: add localhost to inventory file
add_host:
name: "localhost"
groups: "local"
ansible_connection: "local"
- name: add undercloud_host to inventory file
add_host:
name: "undercloud"
groups: "baremetal,undercloud,tester"
ansible_host: "{{ undercloud_hostname }}"
ansible_user: "stack"
ansible_ssh_private_key_file: "{{ ansible_ssh_key }}"
ansible_python_interpreter: "{{ python_interpreter }}"
- name: generate inventory file
template:
dest: "{{ infrared_hosts_dir }}/{{ inventory_file_name }}"
src: inventory.j2
- name: update inventory file symlink
file:
dest: "{{ infrared_hosts_file }}"
state: link
src: "{{ inventory_file_name }}"
- name: copy keys
copy:
src: "~/.ssh/id_rsa.pub"
dest: "{{ infrared_hosts_dir }}/id_rsa_undercloud.pub"