From b7aca3f90eabc2c09ffdf793873b1c6589cf0db0 Mon Sep 17 00:00:00 2001
From: SamYaple <sam@yaple.net>
Date: Tue, 5 Jan 2016 17:57:55 +0000
Subject: [PATCH] Allow ironic role to pull images

Change-Id: Ib3c71d89f8e20d58d44034a215140a35c6874a2b
Partially-Implements: blueprint pre-pull-images
---
 ansible/roles/ironic/tasks/deploy.yml | 18 +++++++++++++++++
 ansible/roles/ironic/tasks/main.yml   | 18 +----------------
 ansible/roles/ironic/tasks/pull.yml   | 28 +++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 17 deletions(-)
 create mode 100644 ansible/roles/ironic/tasks/deploy.yml
 create mode 100644 ansible/roles/ironic/tasks/pull.yml

diff --git a/ansible/roles/ironic/tasks/deploy.yml b/ansible/roles/ironic/tasks/deploy.yml
new file mode 100644
index 000000000..e32778aee
--- /dev/null
+++ b/ansible/roles/ironic/tasks/deploy.yml
@@ -0,0 +1,18 @@
+---
+- include: register.yml
+  when: inventory_hostname in groups['ironic-api']
+
+- include: config.yml
+  when: inventory_hostname in groups['ironic-api'] or
+        inventory_hostname in groups['ironic-conductor'] or
+        inventory_hostname in groups['ironic-discoverd'] or
+        inventory_hostname in groups['ironic-pxe']
+
+- include: bootstrap.yml
+  when: inventory_hostname in groups['ironic-api']
+
+- include: start.yml
+  when: inventory_hostname in groups['ironic-api'] or
+        inventory_hostname in groups['ironic-conductor'] or
+        inventory_hostname in groups['ironic-discoverd'] or
+        inventory_hostname in groups['ironic-pxe']
diff --git a/ansible/roles/ironic/tasks/main.yml b/ansible/roles/ironic/tasks/main.yml
index e32778aee..b017e8b4a 100644
--- a/ansible/roles/ironic/tasks/main.yml
+++ b/ansible/roles/ironic/tasks/main.yml
@@ -1,18 +1,2 @@
 ---
-- include: register.yml
-  when: inventory_hostname in groups['ironic-api']
-
-- include: config.yml
-  when: inventory_hostname in groups['ironic-api'] or
-        inventory_hostname in groups['ironic-conductor'] or
-        inventory_hostname in groups['ironic-discoverd'] or
-        inventory_hostname in groups['ironic-pxe']
-
-- include: bootstrap.yml
-  when: inventory_hostname in groups['ironic-api']
-
-- include: start.yml
-  when: inventory_hostname in groups['ironic-api'] or
-        inventory_hostname in groups['ironic-conductor'] or
-        inventory_hostname in groups['ironic-discoverd'] or
-        inventory_hostname in groups['ironic-pxe']
+- include: "{{ action }}.yml"
diff --git a/ansible/roles/ironic/tasks/pull.yml b/ansible/roles/ironic/tasks/pull.yml
new file mode 100644
index 000000000..9ee19f977
--- /dev/null
+++ b/ansible/roles/ironic/tasks/pull.yml
@@ -0,0 +1,28 @@
+---
+- name: Pulling ironic-api image
+  kolla_docker:
+    action: "pull_image"
+    common_options: "{{ docker_common_options }}"
+    image: "{{ ironic_api_image_full }}"
+  when: inventory_hostname in groups['ironic-api']
+
+- name: Pulling ironic-conductor image
+  kolla_docker:
+    action: "pull_image"
+    common_options: "{{ docker_common_options }}"
+    image: "{{ ironic_conductor_image_full }}"
+  when: inventory_hostname in groups['ironic-conductor']
+
+- name: Pulling ironic-discoverd image
+  kolla_docker:
+    action: "pull_image"
+    common_options: "{{ docker_common_options }}"
+    image: "{{ ironic_discoverd_image_full }}"
+  when: inventory_hostname in groups['ironic-discoverd']
+
+- name: Pulling ironic-pxe image
+  kolla_docker:
+    action: "pull_image"
+    common_options: "{{ docker_common_options }}"
+    image: "{{ ironic_pxe_image_full }}"
+  when: inventory_hostname in groups['ironic-pxe']
-- 
GitLab