Allow tasks_from to be set as a variable

This allows the role to be driven entirely as a role name and a
variables dict, as required by our image upload customisation
interface.
This commit is contained in:
Steve Baker 2018-05-03 11:08:35 +12:00
parent cf858399d5
commit 2d87356538
2 changed files with 12 additions and 3 deletions

View File

@ -73,15 +73,16 @@ the modification, for example:
The following playbook will produce a modified image with the tag
`:latest-updated` which will do a yum update using the host's /etc/yum.repos.d.
The yum update will only occur if there are differences between host and image
package versions.
package versions. In this playbook the tasks_from is set as a variable instead
of an `import_role` parameter.
- hosts: localhost
tasks:
- name: include tripleo-modify-image
import_role:
name: tripleo-modify-image
tasks_from: yum_update.yml
vars:
tasks_from: yum_update.yml
source_image: docker.io/tripleomaster/centos-binary-nova-api:latest
compare_host_packages: true
yum_repos_dir_path: /etc/yum.repos.d

View File

@ -1 +1,9 @@
---
- name: Set default tasks_from
set_fact:
tasks_from: modify_image.yaml
when: tasks_from is undefined
- name: Running tasks from {{ tasks_from }}
include_role:
name: tripleo-modify-image
tasks_from: "{{ tasks_from }}"