forked from redhat-performance/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_undercloud_to_inventory.yml
31 lines (31 loc) · 1.02 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
---
- 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: 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"