Skip to content

Instantly share code, notes, and snippets.

@BjoernT
Created August 8, 2019 14:57
Show Gist options
  • Save BjoernT/1db7992cc9b77050eca88c8171bd0b72 to your computer and use it in GitHub Desktop.
Save BjoernT/1db7992cc9b77050eca88c8171bd0b72 to your computer and use it in GitHub Desktop.
From 0d86b75de62e10658e9d0c80272b3e3b1782f7fe Mon Sep 17 00:00:00 2001
From: Bjoern Teipel <bjoern.teipel@rackspace.com>
Date: Thu, 8 Aug 2019 10:36:40 -0400
Subject: [PATCH] Collapse ironic helpers
- Both playbooks seem to have done the same
- List of host has been reduced to the necessary group
- Fixed missing vars dependencies and pip name
---
playbooks/install-ironic-helper-tools.yml | 53 ---------------
playbooks/install-ironic-helpers.yml | 53 ---------------
playbooks/install-ironic-image-factory.yml | 77 ++++++++++++++++++++++
playbooks/vars/main.yml | 4 +-
4 files changed, 80 insertions(+), 107 deletions(-)
delete mode 100644 playbooks/install-ironic-helper-tools.yml
delete mode 100644 playbooks/install-ironic-helpers.yml
create mode 100644 playbooks/install-ironic-image-factory.yml
diff --git a/playbooks/install-ironic-helper-tools.yml b/playbooks/install-ironic-helper-tools.yml
deleted file mode 100644
index 2f7c01c..0000000
--- a/playbooks/install-ironic-helper-tools.yml
+++ /dev/null
@@ -1,53 +0,0 @@
----
-- name: Set up Ironic helper tools
- hosts: hosts:utility_container
- tasks:
- - name: Locate ironic_importer file
- find:
- paths: "{{ ops_venv }}"
- patterns: ['ironic-importer']
- recurse: yes
- register: importer_find_result
-
- - name: ironic_importer install find warning message
- debug:
- msg: "Warning! ironic-importer not found. Is it installed?"
- when: importer_find_result.matched == 0
-
- - name: Ensure symlink
- file:
- src: "{{ importer_find_result.files[-1].path }}"
- dest: /usr/local/bin/ironic-importer
- owner: root
- group: root
- state: link
- when: importer_find_result.matched != 0
-
- - name: Create cron job for image factory
- cron:
- name: Upload Ironic Images To Glance
- minute: 0
- hour: 12
- weekday: "{{ [0,1,2,3,4,5,6] | random }}"
- job: "ironic-image-factory"
-
- - name: Locate image-factory file
- find:
- paths: "{{ ops_venv }}"
- patterns: ['ironic-image-factory']
- recurse: yes
- register: image_factory_find_result
-
- - name: ironic-image-factory install find warning message
- debug:
- msg: "Warning! ironic-image-factory not found. Is it installed?"
- when: image_factory_find_result.matched == 0
-
- - name: Ensure symlink
- file:
- src: "{{ image_factory_find_result.files[-1].path }}"
- dest: /usr/local/bin/ironic-image-factory
- owner: root
- group: root
- state: link
- when: image_factory_find_result.matched != 0
diff --git a/playbooks/install-ironic-helpers.yml b/playbooks/install-ironic-helpers.yml
deleted file mode 100644
index 623e919..0000000
--- a/playbooks/install-ironic-helpers.yml
+++ /dev/null
@@ -1,53 +0,0 @@
----
-- name: Set up Ironic helper tools
- hosts: hosts:utility_container
- tasks:
- - name: Locate ironic_importer file
- find:
- paths: "{{ ops_venv }}"
- patterns: ['ironic-importer']
- recurse: yes
- register: importer_find_result
-
- - name: ironic_importer install find warning message
- debug:
- msg: "Warning! ironic-importer not found. Is it installed?"
- when: importer_find_result.matched == 0
-
- - name: Ensure symlink
- file:
- src: "{{ importer_find_result.files[-1].path }}"
- dest: /usr/local/bin/ironic-importer
- owner: root
- group: root
- state: link
- when: importer_find_result.matched != 0
-
- - name: Create cron job for image factory
- cron:
- name: Upload Images
- minute: 0
- hour: 12
- weekday: "{{ [0,1,2,3,4,5,6] | random }}"
- job: "ironic-image-factory"
-
- - name: Locate image-factory file
- find:
- paths: "{{ ops_venv }}"
- patterns: ['ironic-image-factory']
- recurse: yes
- register: image_factory_find_result
-
- - name: ironic-image-factory install find warning message
- debug:
- msg: "Warning! ironic-image-factory not found. Is it installed?"
- when: image_factory_find_result.matched == 0
-
- - name: Ensure symlink
- file:
- src: "{{ importer_find_result.files[-1].path }}"
- dest: /usr/local/bin/ironic-image-factory
- owner: root
- group: root
- state: link
- when: image_factory_find_result.matched != 0
diff --git a/playbooks/install-ironic-image-factory.yml b/playbooks/install-ironic-image-factory.yml
new file mode 100644
index 0000000..8fff9e8
--- /dev/null
+++ b/playbooks/install-ironic-image-factory.yml
@@ -0,0 +1,77 @@
+---
+# Copyright 2019-Present, Rackspace US, Inc.
+#
+# 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: Set up Ironic helper tools
+ hosts: utility_container:ironic-infra_hosts
+ tasks:
+ - block:
+ - include: "common-tasks/install-dependencies.yml"
+
+ - name: Locate ironic_importer file
+ find:
+ paths: "{{ ops_venv }}"
+ patterns: ['ironic-importer']
+ recurse: yes
+ register: importer_find_result
+
+ - name: ironic_importer install find warning message
+ debug:
+ msg: "Warning! ironic-importer not found. Is it installed?"
+ when: importer_find_result.matched == 0
+
+ - name: Ensure symlink
+ file:
+ src: "{{ importer_find_result.files[-1].path }}"
+ dest: /usr/local/bin/ironic-importer
+ owner: root
+ group: root
+ state: link
+ when: importer_find_result.matched != 0
+
+ - name: Locate image-factory file
+ find:
+ paths: "{{ ops_venv }}"
+ patterns: ['ironic-image-factory']
+ recurse: yes
+ register: image_factory_find_result
+
+ - name: ironic-image-factory install find warning message
+ debug:
+ msg: "Warning! ironic-image-factory not found. Is it installed?"
+ when: image_factory_find_result.matched == 0
+
+ - name: Ensure symlink
+ file:
+ src: "{{ image_factory_find_result.files[-1].path }}"
+ dest: /usr/local/bin/ironic-image-factory
+ owner: root
+ group: root
+ state: link
+ when: image_factory_find_result.matched != 0
+ vars_files:
+ - "vars/main.yml"
+
+- name: Set up Ironic helper tools
+ hosts: utility_container[0]:ironic-infra_hosts[0]
+ tasks:
+ - name: Create cron job for image factory
+ cron:
+ name: Upload Ironic Images To Glance
+ minute: 0
+ hour: 12
+ weekday: "{{ [0,1,2,3,4,5,6] | random }}"
+ job: "ironic-image-factory"
+ vars_files:
+ - "vars/main.yml"
diff --git a/playbooks/vars/main.yml b/playbooks/vars/main.yml
index ab5788f..4416ce1 100644
--- a/playbooks/vars/main.yml
+++ b/playbooks/vars/main.yml
@@ -20,7 +20,9 @@ ops_pip_dependencies:
- shade
- python-openstackclient
- python-neutronclient
- - ironic_importer
+ - python-ironicclient
+ - python-ironic_inspector_client
+ - ironic-importer
- ironic-image-factory
ops_apt_util_packages:
--
2.17.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment