Skip to content

Commit

Permalink
Restructure task files in preparation for MHV tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
bigjools committed Feb 1, 2017
1 parent c409a7c commit 49a2ee3
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 93 deletions.
92 changes: 0 additions & 92 deletions tasks/ironic_post_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,98 +37,6 @@
tags:
- always

#- name: Post swift tempURL secret key
# command: >
# {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
# --os-username "service:{{ glance_service_user_name }}"
# --os-password "{{ glance_service_password }}"
# --os-auth-url {{ keystone_service_internalurl }}
# --os-identity-api-version {{ keystone_service_internalurl.split('/v')[-1] }}
# post -m temp-url-key:{{ ironic_swift_temp_url_secret_key }}
# environment:
# OS_ENDPOINT_TYPE: internalURL
# when:
# - inventory_hostname == groups['ironic_all'][0]
# - not ironic_standalone | bool
# tags:
# - always

- name: Post Swift tempURL secret key via standalone auth
command: >
{{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
-A {{ swift_auth_url }}
-U {{ swift_admin_user }}
-K {{ swift_admin_password }}
post -m temp-url-key:{{ ironic_swift_temp_url_secret_key }}
when:
- inventory_hostname == groups['ironic_all'][0]
- not ironic_standalone | bool
tags:
- always

#- name: Get swift account
# shell: >
# {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
# --os-username "service:{{ glance_service_user_name }}"
# --os-password "{{ glance_service_password }}"
# --os-auth-url {{ keystone_service_internalurl }}
# --os-identity-api-version {{ keystone_service_internalurl.split('/v')[-1] }}
# stat -v | awk '/StorageURL\:/ {print $2}'
# environment:
# OS_ENDPOINT_TYPE: internalURL
# register: swift_storage_url
# when:
# - (ironic_swift_auth_account is undefined) or (ironic_swift_endpoint is undefined)
# - not ironic_standalone | bool
# tags:
# - always

- name: Get swift account via standalone auth
shell: >
{{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
-A {{ swift_auth_url }}
-U {{ swift_admin_user }}
-K {{ swift_admin_password }}
stat -v | awk '/StorageURL\:/ {print $2}'
register: swift_storage_url
when:
- (ironic_swift_auth_account is undefined) or (ironic_swift_endpoint is undefined)
- not ironic_standalone | bool
tags:
- always

- name: Validate swift output
fail:
msg: |
No StorageURL output found using the `swift stat` command and either
the ``ironic_swift_auth_account`` or ``ironic_swift_auth_account``
variables are undefined. Ensure swift is functional and/or define
those variables.
when:
- (ironic_swift_auth_account is undefined) and (ironic_swift_endpoint is undefined)
- not ironic_standalone | bool
- not swift_storage_url.stdout
tags:
- always

- name: Set the swift auth facts
set_fact:
ironic_swift_auth_account: "{{ swift_storage_url.stdout.split('/v1/')[-1] }}"
when:
- ironic_swift_auth_account is undefined
- not ironic_standalone | bool
tags:
- always

- name: Set the swift endpoint facts
set_fact:
ironic_swift_endpoint: "{{ swift_storage_url.stdout.split('/v1/')[0] }}"
when:
- ironic_swift_endpoint is undefined
- not ironic_standalone | bool
tags:
- always

# Get the cleaning/provisioning network UUIDs
- include: ironic_get_neutron_uuids.yml
when:
Expand Down
7 changes: 6 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@
tags:
- ironic-config

- include: swift.yml
when: inventory_hostname in groups['ironic_conductor'][0]
tags:
- ironic-config

- include: ironic_api_post_install.yml
when: inventory_hostname in groups['ironic_api']
tags:
- ironic-config

- include: ironic_conductor_post_install.yml
- include: tftp.yml
when: inventory_hostname in groups['ironic_conductor']
tags:
- ironic-config
Expand Down
107 changes: 107 additions & 0 deletions tasks/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
# Copyright 2017, Cisco Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#- name: Post swift tempURL secret key
# command: >
# {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
# --os-username "service:{{ glance_service_user_name }}"
# --os-password "{{ glance_service_password }}"
# --os-auth-url {{ keystone_service_internalurl }}
# --os-identity-api-version {{ keystone_service_internalurl.split('/v')[-1] }}
# post -m temp-url-key:{{ ironic_swift_temp_url_secret_key }}
# environment:
# OS_ENDPOINT_TYPE: internalURL
# when:
# - inventory_hostname == groups['ironic_all'][0]
# - not ironic_standalone | bool
# tags:
# - always

- name: Post Swift tempURL secret key via standalone auth
command: >
{{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
-A {{ swift_auth_url }}
-U {{ swift_admin_user }}
-K {{ swift_admin_password }}
post -m temp-url-key:{{ ironic_swift_temp_url_secret_key }}
when:
- inventory_hostname == groups['ironic_all'][0]
- not ironic_standalone | bool
tags:
- always

#- name: Get swift account
# shell: >
# {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
# --os-username "service:{{ glance_service_user_name }}"
# --os-password "{{ glance_service_password }}"
# --os-auth-url {{ keystone_service_internalurl }}
# --os-identity-api-version {{ keystone_service_internalurl.split('/v')[-1] }}
# stat -v | awk '/StorageURL\:/ {print $2}'
# environment:
# OS_ENDPOINT_TYPE: internalURL
# register: swift_storage_url
# when:
# - (ironic_swift_auth_account is undefined) or (ironic_swift_endpoint is undefined)
# - not ironic_standalone | bool
# tags:
# - always

- name: Get swift account via standalone auth
shell: >
{{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }}
-A {{ swift_auth_url }}
-U {{ swift_admin_user }}
-K {{ swift_admin_password }}
stat -v | awk '/StorageURL\:/ {print $2}'
register: swift_storage_url
when:
- (ironic_swift_auth_account is undefined) or (ironic_swift_endpoint is undefined)
- not ironic_standalone | bool
tags:
- always

- name: Validate swift output
fail:
msg: |
No StorageURL output found using the `swift stat` command and either
the ``ironic_swift_auth_account`` or ``ironic_swift_auth_account``
variables are undefined. Ensure swift is functional and/or define
those variables.
when:
- (ironic_swift_auth_account is undefined) and (ironic_swift_endpoint is undefined)
- not ironic_standalone | bool
- not swift_storage_url.stdout
tags:
- always

- name: Set the swift auth facts
set_fact:
ironic_swift_auth_account: "{{ swift_storage_url.stdout.split('/v1/')[-1] }}"
when:
- ironic_swift_auth_account is undefined
- not ironic_standalone | bool
tags:
- always

- name: Set the swift endpoint facts
set_fact:
ironic_swift_endpoint: "{{ swift_storage_url.stdout.split('/v1/')[0] }}"
when:
- ironic_swift_endpoint is undefined
- not ironic_standalone | bool
tags:
- always

File renamed without changes.

0 comments on commit 49a2ee3

Please sign in to comment.