Add container image show role
Add tripleo-container-image-show that will return the container details. Change-Id: I6aa82fba2d555ea1be831bc672ce79d0e21a296e
This commit is contained in:
51
roles/tripleo-container-image-show/README.md
Normal file
51
roles/tripleo-container-image-show/README.md
Normal file
@@ -0,0 +1,51 @@
|
||||
tripleo-container-image-show
|
||||
============================
|
||||
|
||||
A role to perform the container image show against a registry.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_container_image_show_debug`: (Boolean) Flag to print out the show command. Default: False
|
||||
* `tripleo_container_image_show_format`: (String) The format that the output will be in. By default we specify 'json' so that the output will be parsed in ansible. Default: json
|
||||
* `tripleo_container_image_show_image`: (String) Image to fetch the details
|
||||
* `tripleo_container_image_show_password`: (String) Password for the registry
|
||||
* `tripleo_container_image_show_username`: (String) Username for the registry
|
||||
|
||||
Output Variables
|
||||
----------------
|
||||
|
||||
* `tripleo_container_image_show_output`: (Dictionary|String) If tripleo_container_image_show_format is json, the results will automatically be parsed and a dictionary is returned. If another format is used then this will be the response in String format.
|
||||
* `tripleo_container_image_show_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example container show execution playbook
|
||||
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: List containers
|
||||
import_role:
|
||||
name: tripleo-container-image-show
|
||||
vars:
|
||||
tripleo_container_image_show_image: docker.io/library/centos:7
|
||||
- name: Print containers
|
||||
debug:
|
||||
var: tripleo_container_image_show_output
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
||||
6
roles/tripleo-container-image-show/defaults/main.yml
Normal file
6
roles/tripleo-container-image-show/defaults/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
# defaults file for tripleo-container-image-show
|
||||
tripleo_container_image_show_debug: false
|
||||
tripleo_container_image_show_format: json
|
||||
tripleo_container_image_show_password:
|
||||
tripleo_container_image_show_username:
|
||||
42
roles/tripleo-container-image-show/meta/main.yml
Normal file
42
roles/tripleo-container-image-show/meta/main.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
galaxy_info:
|
||||
author: OpenStack
|
||||
description: TripleO Operator Role -- tripleo-container-image-show
|
||||
company: Red Hat
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 2.8
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
platforms:
|
||||
- name: CentOS
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
|
||||
galaxy_tags:
|
||||
- tripleo
|
||||
|
||||
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
dependencies: []
|
||||
24
roles/tripleo-container-image-show/tasks/main.yml
Normal file
24
roles/tripleo-container-image-show/tasks/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
# tasks file for tripleo-container-image-show
|
||||
- name: Setup container image show facts
|
||||
set_fact:
|
||||
_show_cmd: >-
|
||||
openstack tripleo container image show
|
||||
{{ tripleo_container_image_show_username | ternary('--username ' ~ tripleo_container_image_show_username), '') }}
|
||||
{{ tripleo_container_image_show_password | ternary('--password ' ~ tripleo_container_image_show_password, '') }}
|
||||
{{ tripleo_container_image_show_format | ternary('-f ' ~ tripleo_container_image_show_format, '') }}
|
||||
{{ tripleo_container_image_show_image }}
|
||||
|
||||
- name: Show the container image show command
|
||||
debug:
|
||||
var: _show_cmd
|
||||
when: tripleo_container_image_show_debug|bool
|
||||
|
||||
- name: Container image show
|
||||
shell: "{{ _show_cmd }}" # noqa 305
|
||||
register: tripleo_container_image_show_result
|
||||
changed_when: false
|
||||
|
||||
- name: Set output fact
|
||||
set_fact:
|
||||
tripleo_container_image_show_output: "{{ tripleo_container_image_show_result.stdout }}"
|
||||
2
roles/tripleo-container-image-show/tests/inventory
Normal file
2
roles/tripleo-container-image-show/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
7
roles/tripleo-container-image-show/tests/test.yml
Normal file
7
roles/tripleo-container-image-show/tests/test.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- tripleo-container-image-show
|
||||
vars:
|
||||
tripleo_container_image_show_image: docker.io/library/centos:7
|
||||
Reference in New Issue
Block a user