Skip to content

Commit

Permalink
Allow deploy-dynamic on remote host
Browse files Browse the repository at this point in the history
This change allows deploy nodes on remote server with installed Ironic.

Change-Id: If0625ee5a4a2271452305bb3e079ad075b9c71b1
  • Loading branch information
Andrey Shestakov authored and cinerama70 committed Feb 7, 2017
1 parent a5c44be commit 1236d93
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
24 changes: 24 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions playbooks/deploy-dynamic.yaml
Original file line number Diff line number Diff line change
@@ -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' }}"
4 changes: 2 additions & 2 deletions playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand All @@ -54,7 +56,6 @@
owner: root
group: root
mode: 0644
delegate_to: localhost
when: inventory_dns | bool == true
become: yes
- name: "Sending dnsmasq HUP"
Expand All @@ -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"
Expand Down

0 comments on commit 1236d93

Please sign in to comment.