Allow deploy-dynamic on remote host

This change allows deploy nodes on remote server with installed Ironic.

Change-Id: If0625ee5a4a2271452305bb3e079ad075b9c71b1
This commit is contained in:
Andrey Shestakov 2016-12-15 15:07:19 +02:00 committed by Stephanie Miller
parent a5c44bee11
commit 1236d9343e
4 changed files with 33 additions and 12 deletions

View File

@ -359,6 +359,18 @@ source, and then executing the enrollment playbook.::
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
ansible-playbook -vvvv -i inventory/bifrost_inventory.py enroll-dynamic.yaml
When ironic is installed on remote server, a regular ansible inventory
with a target server should be added to ansible. This can be achieved by
specifying a directory with files, each file in that directory will be part of
the ansible inventory. Refer to ansible documentation
http://docs.ansible.com/ansible/intro_dynamic_inventory.html#using-inventory-directories-and-multiple-inventory-sources
::
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
rm inventory/*.example
ansible-playbook -vvvv -i inventory/ enroll-dynamic.yaml
Note that enrollment is a one-time operation. The Ansible module *does not*
synchronize data for existing nodes. You should use the ironic CLI to do this
manually at the moment.
@ -382,6 +394,18 @@ To utilize the newer dynamic inventory based deployment::
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
ansible-playbook -vvvv -i inventory/bifrost_inventory.py deploy-dynamic.yaml
When ironic is installed on remote server, a regular ansible inventory
with a target server should be added to ansible. This can be achieved by
specifying a directory with files, each file in that directory will be part of
the ansible inventory. Refer to ansible documentation
http://docs.ansible.com/ansible/intro_dynamic_inventory.html#using-inventory-directories-and-multiple-inventory-sources
::
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
rm inventory/*.example
ansible-playbook -vvvv -i inventory/ deploy-dynamic.yaml
Note::
Before running the above command, ensure that the value for `ssh_public_key_path` in

View File

@ -1,13 +1,10 @@
---
- hosts: localhost
connection: local
name: "Collect facts"
become: no
gather_facts: yes
- hosts: baremetal
name: "Create configuration drive files and deploy machines from inventory"
become: no
connection: local
gather_facts: no
roles:
- role: bifrost-configdrives-dynamic
delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"
- role: bifrost-deploy-nodes-dynamic
delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}"

View File

@ -22,7 +22,7 @@
when: ssh_public_key is undefined
- name: "Make temporary folder to build configdrive"
local_action: command mktemp -d
command: mktemp -d
register: variable_configdrive_location
- name: "Make metadata folder - /openstack/{{ metadata_version }}"
@ -80,7 +80,7 @@
name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/"
- name: "Write network Debian style interface template"
local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
template: src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
when: write_interfaces_file | bool == true
- name: "Check if mkisofs is available"

View File

@ -17,6 +17,9 @@
# the pass-through could mean that the user could deploy
# things that are not directly accessible or reasonable
# to be inspected.
- name: "Obtain setup facts"
setup:
- name: "If in noauth mode, unset authentication parameters."
set_fact:
auth_type: None
@ -44,7 +47,6 @@
owner: root
group: root
mode: 0644
delegate_to: localhost
when: inventory_dhcp | bool == true
become: yes
- name: "Setup DNS address for nodes."
@ -54,7 +56,6 @@
owner: root
group: root
mode: 0644
delegate_to: localhost
when: inventory_dns | bool == true
become: yes
- name: "Sending dnsmasq HUP"
@ -74,10 +75,9 @@
instance_info: "{{ instance_info }}"
wait: "{{ wait_for_node_deploy }}"
timeout: " {{ wait_timeout | default(1800) }}"
delegate_to: localhost
when: instance_info is defined and instance_info | to_json != '{}'
- name: "Collect the checksum of the deployment image."
local_action: stat path={{deploy_image}}
stat: path={{deploy_image}}
register: test_deploy_image
when: instance_info is not defined or ( instance_info is defined and instance_info | to_json == '{}' )
- name: "Error if deploy_image is not present, and instance_info is not defined"