Add container image list role
Adding tripleo-container-image-list which can be used to query the containers in a given registry. Change-Id: I08e70fa7802028c1fdfb2b0ce09ea247a0e4847a
This commit is contained in:
committed by
Sagi Shnaidman
parent
8c937edbae
commit
6dd959d19f
50
roles/tripleo-container-image-list/README.md
Normal file
50
roles/tripleo-container-image-list/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
tripleo-container-image-list
|
||||
============================
|
||||
|
||||
A role to perform the container image list against a registry.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_container_image_list_debug`: (Boolean) Flag to print out the list command. Default: False
|
||||
* `tripleo_container_image_list_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_list_password`: (String) Password for the registry
|
||||
* `tripleo_container_image_list_registry`: (String) Registry to run the list against
|
||||
* `tripleo_container_image_list_username`: (String) Username for the registry
|
||||
|
||||
Output Variables
|
||||
----------------
|
||||
|
||||
* `tripleo_container_image_list_output`: (List|String) If tripleo_container_image_list_format is json, the results will automatically be parsed and a list is returned. If another format is used then this will be the response in String format.
|
||||
* `tripleo_container_image_list_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example container list execution playbook
|
||||
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: List containers
|
||||
import_role:
|
||||
name: tripleo-container-image-list
|
||||
- name: Print containers
|
||||
debug:
|
||||
msg: "{{ item['Image Name'] }}"
|
||||
loop: "{{ tripleo_container_image_list_output }}"
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
||||
7
roles/tripleo-container-image-list/defaults/main.yml
Normal file
7
roles/tripleo-container-image-list/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# defaults file for tripleo-container-image-list
|
||||
tripleo_container_image_list_debug: false
|
||||
tripleo_container_image_list_format: json
|
||||
tripleo_container_image_list_password:
|
||||
tripleo_container_image_list_registry:
|
||||
tripleo_container_image_list_username:
|
||||
42
roles/tripleo-container-image-list/meta/main.yml
Normal file
42
roles/tripleo-container-image-list/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-list
|
||||
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-list/tasks/main.yml
Normal file
24
roles/tripleo-container-image-list/tasks/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
# tasks file for tripleo-container-image-list
|
||||
- name: Setup container image list facts
|
||||
set_fact:
|
||||
_list_cmd: >-
|
||||
openstack tripleo container image list
|
||||
{{ tripleo_container_image_list_username | ternary('--username ' ~ tripleo_container_image_list_username, '') }}
|
||||
{{ tripleo_container_image_list_password | ternary('--password ' ~ tripleo_container_image_list_password, '') }}
|
||||
{{ tripleo_container_image_list_registry | ternary('--registry ' ~ tripleo_container_image_list_registry, '') }}
|
||||
{{ tripleo_container_image_list_format | ternary('-f ' ~ tripleo_container_image_list_format, '') }}
|
||||
|
||||
- name: Show the container image list command
|
||||
debug:
|
||||
var: _list_cmd
|
||||
when: tripleo_container_image_list_debug|bool
|
||||
|
||||
- name: Container image list
|
||||
shell: "{{ _list_cmd }}" # noqa 305
|
||||
register: tripleo_container_image_list_result
|
||||
changed_when: false
|
||||
|
||||
- name: Set output fact
|
||||
set_fact:
|
||||
tripleo_container_image_list_output: "{{ tripleo_container_image_list_result.stdout }}"
|
||||
2
roles/tripleo-container-image-list/tests/inventory
Normal file
2
roles/tripleo-container-image-list/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/tripleo-container-image-list/tests/test.yml
Normal file
5
roles/tripleo-container-image-list/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- tripleo-container-image-list
|
||||
Reference in New Issue
Block a user