Cleanup required for deploy role changes to function

Moved template file locations to the correct role.

Corrected syntax error in deploy.yaml.

Removed "templates/" path from template entires as it is not
required when using a role.

Added fact collection into roles where required as passing vars
between roles does not seem clean nor maintainable in the long run.
This commit is contained in:
Julia Kreger 2015-03-16 12:28:42 -04:00
parent 87f2df26a4
commit 195245b98e
5 changed files with 15 additions and 4 deletions

View File

@ -4,7 +4,7 @@
name: "Enroll hardware from baremetal.csv into Ironic" name: "Enroll hardware from baremetal.csv into Ironic"
sudo: yes sudo: yes
gather_facts: yes gather_facts: yes
pre-tasks: pre_tasks:
- name: "Error if variable baremetal_csv_file is not defined" - name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'" local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined when: baremetal_csv_file is not defined

View File

@ -12,6 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- name: "Check to see if there is a file where the ssh_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path
- name: "Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
- name: "Read ssh public key in"
local_action: set_fact ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"
- name: "Name Make Temporary folder to build configdrive" - name: "Name Make Temporary folder to build configdrive"
local_action: command mktemp -d local_action: command mktemp -d
register: variable_configdrive_location register: variable_configdrive_location
@ -24,11 +32,11 @@
with_lines: with_lines:
- cat {{ baremetal_csv_file }} - cat {{ baremetal_csv_file }}
- name: "Place template in each openstack/2012-08-10 folder" - name: "Place template in each openstack/2012-08-10 folder"
local_action: template src=templates/openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/2012-08-10/meta_data.json local_action: template src=openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/2012-08-10/meta_data.json
with_lines: with_lines:
- cat {{ baremetal_csv_file }} - cat {{ baremetal_csv_file }}
- name: "Place template in each openstack/latest folder" - name: "Place template in each openstack/latest folder"
local_action: template src=templates/openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/latest/meta_data.json local_action: template src=openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/latest/meta_data.json
with_lines: with_lines:
- cat {{ baremetal_csv_file }} - cat {{ baremetal_csv_file }}
- name: "Make Metadata folder - /openstack/latest" - name: "Make Metadata folder - /openstack/latest"
@ -36,7 +44,7 @@
with_lines: with_lines:
- cat {{ baremetal_csv_file }} - cat {{ baremetal_csv_file }}
- name: "Write network interface template" - name: "Write network interface template"
local_action: template src=templates/interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/content/0000 local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{item.split(',')[9]}}/openstack/content/0000
with_lines: with_lines:
- cat {{ baremetal_csv_file }} - cat {{ baremetal_csv_file }}
- name: "Make config drive files" - name: "Make config drive files"

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- name: "Collect the checksum of the deployment image."
local_action: stat path={{deploy_image}}
register: test_deploy_image
- name: "Deploy to Hardware" - name: "Deploy to Hardware"
# TODO: Conceptual idea of structure, needs image_source corrected and # TODO: Conceptual idea of structure, needs image_source corrected and
# disk format clarified # disk format clarified