Merge "Add tripleo_container_standalone role"

This commit is contained in:
Zuul 2022-05-13 18:08:01 +00:00 committed by Gerrit Code Review
commit 150c0f7f75
11 changed files with 275 additions and 0 deletions

View File

@ -0,0 +1,6 @@
===================================
Role - tripleo_container_standalone
===================================
.. ansibleautoplugin::
:role: tripleo_ansible/roles/tripleo_container_standalone

View File

@ -0,0 +1,50 @@
---
# Copyright 2020 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.
# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "tripleo_container_standalone"
tripleo_container_standalone_debug: "{{ (ansible_verbosity | int) >= 2 | bool }}"
tripleo_container_standalone_hide_sensitive_logs: true
# Service name. Use for creating directories, container labels, etc
tripleo_container_standalone_service : ""
# Directory for kolla config files
tripleo_container_standalone_kolla_config_dir: /var/lib/kolla/config_files
# Directory for container startup configs
tripleo_container_standalone_container_startup_config_dir: /var/lib/tripleo-config/container-startup-config
# Hash with keys of container name and value of YAML kolla config file.
tripleo_container_standalone_kolla_config_files : {}
# Hash with keys of container name and value of YAML container definition
tripleo_container_standalone_container_defs : {}
# List of common volumes that can be included in the template of a container
# definition to include the most common volumes.
tripleo_container_standalone_common_volumes:
- /etc/hosts:/etc/hosts:ro
- /etc/localtime:/etc/localtime:ro
# OpenSSL trusted CAs
- /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro
- /etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro
- /etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro
- /etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro
- /etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro
# Syslog socket
- /dev/log:/dev/log
# required for bootstrap_host_exec
- /etc/puppet:/etc/puppet:ro

View File

@ -0,0 +1,15 @@
---
# Copyright 2020 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.

View File

@ -0,0 +1,43 @@
---
# Copyright 2020 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 OpenStack Role -- tripleo_container_standalone
company: Red Hat
license: Apache-2.0
min_ansible_version: 2.7
namespace: openstack
#
# 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: []

View File

@ -0,0 +1,21 @@
---
# Copyright 2020 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.
- name: Converge
hosts: all
roles:
- role: "tripleo_container_standalone"

View File

@ -0,0 +1,28 @@
---
driver:
name: podman
provisioner:
inventory:
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
name: ansible
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- check
- verify
- destroy
verifier:
name: testinfra

View File

@ -0,0 +1,21 @@
---
# Copyright 2020 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.
- name: Prepare
hosts: all
roles:
- role: test_deps

View File

@ -0,0 +1,59 @@
---
# Copyright 2022 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.
# "tripleo_container_standalone" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
- name: Create {{ tripleo_container_standalone_kolla_config_dir }}
copy:
content: "{{ item.value | to_nice_json }}"
dest: "{{ tripleo_container_standalone_kolla_config_dir ~ '/' ~ item.key ~ '.json' }}"
mode: 0600
loop: "{{ tripleo_container_standalone_kolla_config_files | dict2items }}"
- name: Create {{ tripleo_container_standalone_container_startup_config_dir }}/{{ tripleo_container_standalone_service }}
file:
path: "{{ tripleo_container_standalone_container_startup_config_dir }}/{{ tripleo_container_standalone_service }}"
state: directory
- name: Render {{ tripleo_container_standalone_service }} container definitions
copy:
content: "{{ item.value | to_nice_json }}"
dest: "{{ tripleo_container_standalone_container_startup_config_dir }}/{{ tripleo_container_standalone_service }}/{{ item.key }}.json"
loop: "{{ tripleo_container_standalone_container_defs | dict2items }}"
- name: Run {{ tripleo_container_standalone_service }} containers
include_role:
name: tripleo_container_manage
vars:
tripleo_container_manage_config: "{{ tripleo_container_standalone_container_startup_config_dir }}/{{ tripleo_container_standalone_service }}"
tripleo_container_manage_config_patterns: "*.json"
tripleo_container_manage_config_id: "{{ tripleo_container_standalone_service }}"

View File

@ -0,0 +1,22 @@
---
# Copyright 2020 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.
# While options found within the vars/ path can be overridden using extra
# vars, items within this path are considered part of the role and not
# intended to be modified.
# All variables within this role should have a prefix of "tripleo_container_standalone"

View File

@ -24,6 +24,7 @@
- tripleo-ansible-centos-8-molecule-tripleo_container_image_prepare
- tripleo-ansible-centos-8-molecule-tripleo_container_manage
- tripleo-ansible-centos-8-molecule-tripleo_container_rm
- tripleo-ansible-centos-8-molecule-tripleo_container_standalone
- tripleo-ansible-centos-8-molecule-tripleo_container_stop
- tripleo-ansible-centos-8-molecule-tripleo_container_tag
- tripleo-ansible-centos-8-molecule-tripleo_create_admin
@ -88,6 +89,7 @@
- tripleo-ansible-centos-8-molecule-tripleo_container_image_prepare
- tripleo-ansible-centos-8-molecule-tripleo_container_manage
- tripleo-ansible-centos-8-molecule-tripleo_container_rm
- tripleo-ansible-centos-8-molecule-tripleo_container_standalone
- tripleo-ansible-centos-8-molecule-tripleo_container_stop
- tripleo-ansible-centos-8-molecule-tripleo_container_tag
- tripleo-ansible-centos-8-molecule-tripleo_create_admin
@ -152,6 +154,7 @@
- tripleo-ansible-centos-8-molecule-tripleo_container_image_prepare
- tripleo-ansible-centos-8-molecule-tripleo_container_manage
- tripleo-ansible-centos-8-molecule-tripleo_container_rm
- tripleo-ansible-centos-8-molecule-tripleo_container_standalone
- tripleo-ansible-centos-8-molecule-tripleo_container_stop
- tripleo-ansible-centos-8-molecule-tripleo_container_tag
- tripleo-ansible-centos-8-molecule-tripleo_create_admin
@ -352,6 +355,13 @@
parent: tripleo-ansible-centos-8-base
vars:
tripleo_role_name: tripleo_container_rm
- job:
files:
- ^tripleo_ansible/roles/tripleo_container_standalone/(?!meta).*
name: tripleo-ansible-centos-8-molecule-tripleo_container_standalone
parent: tripleo-ansible-centos-8-base
vars:
tripleo_role_name: tripleo_container_standalone
- job:
files:
- ^tripleo_ansible/roles/tripleo_container_stop/(?!meta).*