New CI job: add settings for containers registries
Support pulling containers from provider job registry. Change-Id: Ib85f3a61f20c60865362eea4d14e5ae6ab0ae46f
This commit is contained in:
parent
2aeff7e76b
commit
8c105f5581
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- name: Add the overcloud nodes to the generated inventory
|
||||
hosts: undercloud
|
||||
gather_facts: true
|
||||
tags:
|
||||
- standalone
|
||||
vars:
|
||||
inventory: multinode
|
||||
roles:
|
||||
- tripleo-inventory
|
||||
|
||||
- name: Prepare the undercloud for installation
|
||||
hosts: undercloud
|
||||
roles:
|
||||
- undercloud-setup
|
||||
tags:
|
||||
- standalone
|
||||
|
||||
- name: Run DLRN gate role and install repo
|
||||
hosts: undercloud
|
||||
vars:
|
||||
artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz"
|
||||
roles:
|
||||
- build-test-packages
|
||||
- {role: install-built-repo, when: compressed_gating_repo is defined}
|
||||
tags:
|
||||
- build
|
||||
|
||||
- name: Deploy Standalone
|
||||
hosts: undercloud
|
||||
tasks:
|
||||
- include_role:
|
||||
name: standalone
|
||||
tasks_from: containers
|
||||
apply:
|
||||
tags:
|
||||
- standalone
|
||||
tags:
|
||||
- standalone
|
|
@ -18,3 +18,9 @@ local_registry_ip: 127.0.0.1
|
|||
local_registry_port: 5001
|
||||
container_registry_namespace: tripleomaster
|
||||
container_tag: current-tripleo
|
||||
docker_prep_prefix: >-
|
||||
{% if job.build_container_images|default(false)|bool and not job.provider_job|default(false)|bool -%}
|
||||
openstack
|
||||
{%- else -%}
|
||||
{{ ansible_distribution | lower }}-binary
|
||||
{%- endif -%}
|
||||
|
|
|
@ -19,12 +19,19 @@
|
|||
podman_container:
|
||||
name: docker_registry
|
||||
image: registry:2
|
||||
net: host
|
||||
publish:
|
||||
- "{{ local_registry_port }}:{{ local_registry_port }}"
|
||||
env:
|
||||
REGISTRY_HTTP_ADDR: "{{ local_registry_ip }}:{{ local_registry_port }}"
|
||||
REGISTRY_HTTP_ADDR: "0.0.0.0:{{ local_registry_port }}"
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Open port for local registry
|
||||
become: true
|
||||
command: >-
|
||||
iptables -I INPUT -p tcp --dport {{ local_registry_port }} -j ACCEPT
|
||||
changed_when: true
|
||||
|
||||
- name: Set container_image_build_volumes fact
|
||||
set_fact:
|
||||
container_image_build_volumes:
|
||||
|
@ -56,3 +63,4 @@
|
|||
tripleo_container_image_build_registry: "{{ local_registry_ip }}:{{ local_registry_port }}"
|
||||
tripleo_container_image_build_volumes: "{{ container_image_build_volumes }}"
|
||||
tripleo_container_image_build_work_dir: "{{ working_dir }}/container-builds"
|
||||
tripleo_container_image_build_prefix: "{{ docker_prep_prefix }}"
|
||||
|
|
|
@ -40,7 +40,12 @@ docker_registry_host: docker.io
|
|||
docker_registry_namespace: "tripleo{{ release }}"
|
||||
docker_image_tag: current-tripleo
|
||||
# docker prefix
|
||||
docker_prep_prefix: "{{ job.build_container_images|default(false)|bool | ternary('openstack-', (ansible_distribution | lower) ~ '-binary-') }}"
|
||||
docker_prep_prefix: >-
|
||||
{% if job.build_container_images|default(false)|bool and not job.provider_job|default(false)|bool -%}
|
||||
openstack-
|
||||
{%- else -%}
|
||||
{{ ansible_distribution | lower }}-binary-
|
||||
{%- endif -%}
|
||||
# docker suffix
|
||||
docker_prep_suffix: ""
|
||||
docker_ceph_namespace: docker.io/ceph
|
||||
|
|
|
@ -8,7 +8,7 @@ ib_repo_image_inject: false
|
|||
ib_repo_image_path: "{{ ib_repo_workdir }}/overcloud-full.qcow2"
|
||||
ib_gating_repo_enabled: true
|
||||
ib_gating_repo_update: true
|
||||
ib_create_web_repo: false
|
||||
ib_create_web_repo: "{{ job.provider_job | default(false) }}"
|
||||
# Configure host where gate_repo files exists, if it's not the host
|
||||
# where this role is executed
|
||||
# ib_repo_host:
|
||||
|
|
|
@ -18,7 +18,12 @@ EOF
|
|||
ps -ef | grep -i python | grep SimpleHTTPServer | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
|
||||
pushd /opt/gating_repo
|
||||
iptables -I INPUT -p tcp --dport 8766 -j ACCEPT
|
||||
nohup python -m SimpleHTTPServer 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
|
||||
if command -v python3
|
||||
then
|
||||
nohup python3 -m http.server 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
|
||||
else
|
||||
nohup python -m SimpleHTTPServer 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
|
||||
fi
|
||||
popd
|
||||
cat > {{ working_dir }}//web-gating.repo << EOF
|
||||
[gating-repo]
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
---
|
||||
- name: Gather ansible distribution
|
||||
setup:
|
||||
gather_subset: "!min,distribution"
|
||||
when: ansible_distribution is not defined
|
||||
|
||||
- name: Cache tempest network cidr
|
||||
set_fact:
|
||||
tempest_cidr: "{{ undercloud_network_cidr }}"
|
||||
when: use_os_tempest is defined
|
||||
|
||||
# tasks file for all_in_one
|
||||
|
||||
- name: Set hostname
|
||||
hostname:
|
||||
name: "{{ standalone_hostname }}"
|
||||
become: true
|
||||
when: not enable_tls|default(false)|bool
|
||||
|
||||
- name: set virtual-control-ip for TLS deployments
|
||||
set_fact:
|
||||
standalone_control_virtual_ip: "{{ undercloud_network_cidr|nthhost(210) }}"
|
||||
cacheable: true
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
- name: Add DNS and NTP server settings for TLS deployments
|
||||
become: true
|
||||
blockinfile:
|
||||
path: "{{ overcloud_templates_path }}/ci/environments/standalone-ipa.yaml"
|
||||
insertafter: " HAProxyExternalNetwork: ctlplane"
|
||||
block: |
|
||||
# Custom IPA params
|
||||
DnsServers: ["{{ subnode_1_ip }}"]
|
||||
NtpServer: "{{ job.standalone_ntp_servers|default(['clock.redhat.com']) }}"
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
# standalone params
|
||||
- name: Create the standalone params
|
||||
template:
|
||||
src: "{{ standalone_config }}"
|
||||
dest: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
mode: 0755
|
||||
|
||||
- name: Remove settings that will be added with TLS
|
||||
lineinfile:
|
||||
path: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
regexp: "{{ item }}"
|
||||
state: absent
|
||||
backup: true
|
||||
with_items:
|
||||
- ' CloudName: 192.168.24.1'
|
||||
- ' CertmongerCA: local'
|
||||
- ' DnsServers: (.*)'
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
- name: Build and push containers into a local registry
|
||||
when:
|
||||
- job.build_container_images|default(false)|bool
|
||||
include_role:
|
||||
name: container-build
|
||||
vars:
|
||||
container_registry_namespace: "{{ docker_registry_namespace }}"
|
||||
container_tag: "{{ container_build_id }}"
|
||||
|
||||
- name: Run container prepare legacy
|
||||
when:
|
||||
- release in ['queens', 'rocky', 'stein', 'train']
|
||||
block:
|
||||
|
||||
- name: Create container parameters script
|
||||
template:
|
||||
src: "{{ standalone_container_prep_script }}"
|
||||
dest: "{{ working_dir }}/standalone-container-prep.sh"
|
||||
mode: "0755"
|
||||
|
||||
- name: Run container prepare
|
||||
shell: >
|
||||
set -o pipefail &&
|
||||
{{ working_dir }}/standalone-container-prep.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/{{ standalone_container_prep_log }}
|
||||
changed_when: true
|
||||
|
||||
- name: Run container prepare via tripleo-operator-ansible
|
||||
when:
|
||||
- release not in ['queens', 'rocky', 'stein', 'train']
|
||||
collections:
|
||||
- tripleo.operator
|
||||
include_role:
|
||||
name: tripleo_container_image_prepare_default
|
||||
vars:
|
||||
tripleo_container_image_prepare_default_debug: true
|
||||
tripleo_container_image_prepare_default_output_env_file: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
|
||||
# update the registry to rdo or docker.io
|
||||
- name: update registry if needed in container-prepare-parameters.yaml
|
||||
when:
|
||||
- docker_registry_host != '' and docker_registry_namespace != ''
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " namespace: (.*)"
|
||||
replace: " namespace: {{ docker_registry_host }}/{{ docker_registry_namespace }}"
|
||||
backup: true
|
||||
|
||||
# update the container tag to match dlrn hash
|
||||
- name: update container tag if needed in container-prepare-parameters.yaml
|
||||
when:
|
||||
- container_build_id != ''
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " tag: (.*)"
|
||||
replace: " tag: {{ container_build_id }}"
|
||||
backup: true
|
||||
|
||||
# in extra-common/defaults
|
||||
# docker_prep_prefix: "{{ ansible_distribution | lower }}-binary-"
|
||||
- name: update container name_prefix for the appropriate distro
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " name_prefix: (.*)"
|
||||
replace: " name_prefix: {{ docker_prep_prefix }}"
|
||||
backup: true
|
||||
|
||||
# ceph parameters
|
||||
- name: update container ceph parameters
|
||||
when:
|
||||
- standalone_container_ceph_updates|default(false)|bool
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " {{ item.original }}: (.*)"
|
||||
replace: " {{ item.replace }}"
|
||||
backup: true
|
||||
with_items:
|
||||
- {original: "ceph_namespace", replace: "ceph_namespace: {{ docker_ceph_namespace }}"}
|
||||
- {original: "ceph_image", replace: "ceph_image: {{ docker_ceph_image }}"}
|
||||
- {original: "ceph_tag", replace: "ceph_tag: {{ docker_ceph_tag }}"}
|
||||
|
||||
- name: update container custom ceph parameters, if required
|
||||
when:
|
||||
- standalone_container_ceph_updates|default(false)|bool
|
||||
- custom_ceph_parameters|default(false)|bool
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " {{ item.original }}: (.*)"
|
||||
replace: " {{ item.replace }}"
|
||||
backup: true
|
||||
with_items:
|
||||
- {original: "ceph_alertmanager_image", replace: "ceph_alertmanager_image: {{ custom_ceph_alertmanager_image }}"}
|
||||
- {original: "ceph_alertmanager_namespace", replace: "ceph_alertmanager_namespace: {{ custom_ceph_alertmanager_namespace }}"}
|
||||
- {original: "ceph_alertmanager_tag", replace: "ceph_alertmanager_tag: {{ custom_ceph_alertmanager_tag }}"}
|
||||
- {original: "ceph_grafana_image", replace: "ceph_grafana_image: {{ custom_ceph_grafana_image }}"}
|
||||
- {original: "ceph_grafana_namespace", replace: "ceph_grafana_namespace: {{ custom_ceph_grafana_namespace }}"}
|
||||
- {original: "ceph_grafana_tag", replace: "ceph_grafana_tag: {{ custom_ceph_grafana_tag }}"}
|
||||
- {original: "ceph_node_exporter_image", replace: "ceph_node_exporter_image: {{ custom_ceph_node_exporter_image }}"}
|
||||
- {original: "ceph_node_exporter_namespace", replace: "ceph_node_exporter_namespace: {{ custom_ceph_node_exporter_namespace }}"}
|
||||
- {original: "ceph_node_exporter_tag", replace: "ceph_node_exporter_tag: {{ custom_ceph_node_exporter_tag }}"}
|
||||
- {original: "ceph_prometheus_image", replace: "ceph_prometheus_image: {{ custom_ceph_prometheus_image }}"}
|
||||
- {original: "ceph_prometheus_namespace", replace: "ceph_prometheus_namespace: {{ custom_ceph_prometheus_namespace }}"}
|
||||
- {original: "ceph_prometheus_tag", replace: "ceph_prometheus_tag: {{ custom_ceph_prometheus_tag }}"}
|
||||
|
||||
- name: Set repos defined in the job to update
|
||||
when:
|
||||
- job.add_repos is defined
|
||||
- job.add_repos != []
|
||||
- standalone_container_prep_updates
|
||||
- not job.consumer_job | default(false) | bool
|
||||
block:
|
||||
- name: Create string of repos to update
|
||||
set_fact:
|
||||
add_repo_update_list: >-
|
||||
{% if job.add_repos[item|int].update_container|default(false) -%}
|
||||
{{ job.add_repos[item|int].reponame }}
|
||||
{% endif -%}
|
||||
with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}"
|
||||
register: add_repo_update_list_result
|
||||
|
||||
- debug:
|
||||
var: add_repo_update_list
|
||||
|
||||
- name: Add repos to update_repo
|
||||
set_fact:
|
||||
add_repos_update: "{{ add_repo_update_list_result.results | map(attribute='ansible_facts.add_repo_update_list') | list }}"
|
||||
cacheable: true
|
||||
when: add_repo_update_list_result|length > 0
|
||||
|
||||
- debug:
|
||||
var: add_repos_update
|
||||
|
||||
- name: Create string from list
|
||||
set_fact:
|
||||
add_repos_update: ",{{ add_repos_update | join(',') }}"
|
||||
when: add_repos_update|length > 0
|
||||
|
||||
- name: Load the container params file data
|
||||
slurp:
|
||||
src: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
register: containers_prepare_parameters
|
||||
|
||||
- name: Parse container params
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: "{{ containers_prepare_parameters['content'] | b64decode | from_yaml }}"
|
||||
|
||||
# update params for container update
|
||||
- name: Add updates to container-prepare-parameters.yaml
|
||||
when:
|
||||
- standalone_container_prep_updates
|
||||
- not job.build_container_images|default(false)|bool
|
||||
- not job.consumer_job | default(false) | bool
|
||||
block:
|
||||
- name: Generate modified containers file
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: |-
|
||||
{% set imageParams = [] %}
|
||||
{% for item in containers_prepare_parameters_yaml['parameter_defaults']['ContainerImagePrepare'] %}
|
||||
{% set _ = item.__setitem__("push_destination", local_docker_registry_host ~ ":8787") %}
|
||||
{% set _ = item.__setitem__("modify_role", "tripleo-modify-image") %}
|
||||
{% set _ = item.__setitem__("modify_append_tag", update_containers_append_tag) %}
|
||||
{% if not (osp_release is defined) %}
|
||||
{% if release in ['rocky', 'stein'] %}
|
||||
{% set _ = item.__setitem__("modify_only_with_labels", ["kolla_version"]) %}
|
||||
{% else %}
|
||||
{% set _ = item.__setitem__("modify_only_with_source", ["kolla", "tripleo"]) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% set _ = item.__setitem__(
|
||||
"modify_vars",
|
||||
{
|
||||
"tasks_from": "yum_update.yml",
|
||||
"yum_repos_dir_path": "/etc/yum.repos.d",
|
||||
"update_repo": standalone_container_prep_update_repo ~ add_repos_update | default('')
|
||||
}
|
||||
)
|
||||
%}
|
||||
{% set _ = item.pop("tag_from_label", "") %}
|
||||
{% set _ = imageParams.append(item) %}
|
||||
{% endfor %}
|
||||
{% set defaults = {"ContainerImagePrepare": imageParams} %}
|
||||
{{ {"parameter_defaults": defaults} }}
|
||||
|
||||
- name: Update rhel_containers value
|
||||
when:
|
||||
- ansible_distribution == 'RedHat'
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: |-
|
||||
{% set imageParams = [] %}
|
||||
{% for item in (containers_prepare_parameters_yaml | from_yaml)['parameter_defaults']['ContainerImagePrepare'] %}
|
||||
{% if "set" in item %}
|
||||
{% set _ = item['set'].__setitem__("rhel_containers", true) %}
|
||||
{% endif %}
|
||||
{% set _ = imageParams.append(item) %}
|
||||
{% endfor %}
|
||||
{% set defaults = {"ContainerImagePrepare": imageParams} %}
|
||||
{{ {"parameter_defaults": defaults} }}
|
||||
|
||||
- name: Write containers-prepare-parameters.yaml
|
||||
copy:
|
||||
content: "{{ containers_prepare_parameters_yaml | to_nice_yaml }}"
|
||||
dest: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
|
||||
- name: Modify the insecure registry value when using podman
|
||||
when:
|
||||
- standalone_container_prep_updates
|
||||
- ansible_distribution == 'RedHat'
|
||||
- ansible_distribution_major_version|int >= 8
|
||||
- release not in ['newton', 'ocata', 'pike', 'queens', 'rocky']
|
||||
replace:
|
||||
path: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
regexp: " - 192.168.24.1:8787"
|
||||
replace: " - 192.168.24.1"
|
||||
backup: true
|
|
@ -1,334 +1,3 @@
|
|||
---
|
||||
- name: Gather ansible distribution
|
||||
setup:
|
||||
gather_subset: "!min,distribution"
|
||||
when: ansible_distribution is not defined
|
||||
|
||||
- name: Cache tempest network cidr
|
||||
set_fact:
|
||||
tempest_cidr: "{{ undercloud_network_cidr }}"
|
||||
when: use_os_tempest is defined
|
||||
|
||||
# tasks file for all_in_one
|
||||
|
||||
- name: Set hostname
|
||||
hostname:
|
||||
name: "{{ standalone_hostname }}"
|
||||
become: true
|
||||
when: not enable_tls|default(false)|bool
|
||||
|
||||
- name: set virtual-control-ip for TLS deployments
|
||||
set_fact:
|
||||
standalone_control_virtual_ip: "{{ undercloud_network_cidr|nthhost(210) }}"
|
||||
cacheable: true
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
- name: Add DNS and NTP server settings for TLS deployments
|
||||
become: true
|
||||
blockinfile:
|
||||
path: "{{ overcloud_templates_path }}/ci/environments/standalone-ipa.yaml"
|
||||
insertafter: " HAProxyExternalNetwork: ctlplane"
|
||||
block: |
|
||||
# Custom IPA params
|
||||
DnsServers: ["{{ subnode_1_ip }}"]
|
||||
NtpServer: "{{ job.standalone_ntp_servers|default(['clock.redhat.com']) }}"
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
# standalone params
|
||||
- name: Create the standalone params
|
||||
template:
|
||||
src: "{{ standalone_config }}"
|
||||
dest: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
mode: 0755
|
||||
|
||||
- name: Remove settings that will be added with TLS
|
||||
lineinfile:
|
||||
path: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
regexp: "{{ item }}"
|
||||
state: absent
|
||||
backup: true
|
||||
with_items:
|
||||
- ' CloudName: 192.168.24.1'
|
||||
- ' CertmongerCA: local'
|
||||
- ' DnsServers: (.*)'
|
||||
when: enable_tls|default(false)|bool
|
||||
|
||||
- name: Build and push containers into a local registry
|
||||
when:
|
||||
- job.build_container_images|default(false)|bool
|
||||
include_role:
|
||||
name: container-build
|
||||
vars:
|
||||
container_registry_namespace: "{{ docker_registry_namespace }}"
|
||||
container_tag: "{{ container_build_id }}"
|
||||
|
||||
- name: Run container prepare legacy
|
||||
when:
|
||||
- release in ['queens', 'rocky', 'stein', 'train']
|
||||
block:
|
||||
|
||||
- name: Create container parameters script
|
||||
template:
|
||||
src: "{{ standalone_container_prep_script }}"
|
||||
dest: "{{ working_dir }}/standalone-container-prep.sh"
|
||||
mode: "0755"
|
||||
|
||||
- name: Run container prepare
|
||||
shell: >
|
||||
set -o pipefail &&
|
||||
{{ working_dir }}/standalone-container-prep.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/{{ standalone_container_prep_log }}
|
||||
changed_when: true
|
||||
|
||||
- name: Run container prepare via tripleo-operator-ansible
|
||||
when:
|
||||
- release not in ['queens', 'rocky', 'stein', 'train']
|
||||
collections:
|
||||
- tripleo.operator
|
||||
include_role:
|
||||
name: tripleo_container_image_prepare_default
|
||||
vars:
|
||||
tripleo_container_image_prepare_default_debug: true
|
||||
tripleo_container_image_prepare_default_output_env_file: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
|
||||
# update the registry to rdo or docker.io
|
||||
- name: update registry if needed in container-prepare-parameters.yaml
|
||||
when:
|
||||
- docker_registry_host != '' and docker_registry_namespace != ''
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " namespace: (.*)"
|
||||
replace: " namespace: {{ docker_registry_host }}/{{ docker_registry_namespace }}"
|
||||
backup: true
|
||||
|
||||
# update the container tag to match dlrn hash
|
||||
- name: update container tag if needed in container-prepare-parameters.yaml
|
||||
when:
|
||||
- container_build_id != ''
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " tag: (.*)"
|
||||
replace: " tag: {{ container_build_id }}"
|
||||
backup: true
|
||||
|
||||
# in extra-common/defaults
|
||||
# docker_prep_prefix: "{{ ansible_distribution | lower }}-binary-"
|
||||
- name: update container name_prefix for the appropriate distro
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " name_prefix: (.*)"
|
||||
replace: " name_prefix: {{ docker_prep_prefix }}"
|
||||
backup: true
|
||||
|
||||
# ceph parameters
|
||||
- name: update container ceph parameters
|
||||
when:
|
||||
- standalone_container_ceph_updates|default(false)|bool
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " {{ item.original }}: (.*)"
|
||||
replace: " {{ item.replace }}"
|
||||
backup: true
|
||||
with_items:
|
||||
- { original: "ceph_namespace", replace: "ceph_namespace: {{ docker_ceph_namespace }}" }
|
||||
- { original: "ceph_image", replace: "ceph_image: {{ docker_ceph_image }}" }
|
||||
- { original: "ceph_tag", replace: "ceph_tag: {{ docker_ceph_tag }}" }
|
||||
|
||||
- name: update container custom ceph parameters, if required
|
||||
when:
|
||||
- standalone_container_ceph_updates|default(false)|bool
|
||||
- custom_ceph_parameters|default(false)|bool
|
||||
replace:
|
||||
path: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
regexp: " {{ item.original }}: (.*)"
|
||||
replace: " {{ item.replace }}"
|
||||
backup: true
|
||||
with_items:
|
||||
- { original: "ceph_alertmanager_image", replace: "ceph_alertmanager_image: {{ custom_ceph_alertmanager_image }}" }
|
||||
- { original: "ceph_alertmanager_namespace", replace: "ceph_alertmanager_namespace: {{ custom_ceph_alertmanager_namespace }}" }
|
||||
- { original: "ceph_alertmanager_tag", replace: "ceph_alertmanager_tag: {{ custom_ceph_alertmanager_tag }}" }
|
||||
- { original: "ceph_grafana_image", replace: "ceph_grafana_image: {{ custom_ceph_grafana_image }}" }
|
||||
- { original: "ceph_grafana_namespace", replace: "ceph_grafana_namespace: {{ custom_ceph_grafana_namespace }}" }
|
||||
- { original: "ceph_grafana_tag", replace: "ceph_grafana_tag: {{ custom_ceph_grafana_tag }}" }
|
||||
- { original: "ceph_node_exporter_image", replace: "ceph_node_exporter_image: {{ custom_ceph_node_exporter_image }}" }
|
||||
- { original: "ceph_node_exporter_namespace", replace: "ceph_node_exporter_namespace: {{ custom_ceph_node_exporter_namespace }}" }
|
||||
- { original: "ceph_node_exporter_tag", replace: "ceph_node_exporter_tag: {{ custom_ceph_node_exporter_tag }}" }
|
||||
- { original: "ceph_prometheus_image", replace: "ceph_prometheus_image: {{ custom_ceph_prometheus_image }}" }
|
||||
- { original: "ceph_prometheus_namespace", replace: "ceph_prometheus_namespace: {{ custom_ceph_prometheus_namespace }}" }
|
||||
- { original: "ceph_prometheus_tag", replace: "ceph_prometheus_tag: {{ custom_ceph_prometheus_tag }}" }
|
||||
|
||||
- name: Set repos defined in the job to update
|
||||
when:
|
||||
- job.add_repos is defined
|
||||
- job.add_repos != []
|
||||
- standalone_container_prep_updates
|
||||
block:
|
||||
- name: Create string of repos to update
|
||||
set_fact:
|
||||
add_repo_update_list: >-
|
||||
{% if job.add_repos[item|int].update_container|default(false) -%}
|
||||
{{ job.add_repos[item|int].reponame }}
|
||||
{% endif -%}
|
||||
with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}"
|
||||
register: add_repo_update_list_result
|
||||
|
||||
- debug:
|
||||
var: add_repo_update_list
|
||||
|
||||
- name: Add repos to update_repo
|
||||
set_fact:
|
||||
add_repos_update: "{{ add_repo_update_list_result.results | map(attribute='ansible_facts.add_repo_update_list') | list }}"
|
||||
cacheable: true
|
||||
when: add_repo_update_list_result|length > 0
|
||||
|
||||
- debug:
|
||||
var: add_repos_update
|
||||
|
||||
- name: Create string from list
|
||||
set_fact:
|
||||
add_repos_update: ",{{ add_repos_update | join(',') }}"
|
||||
when: add_repos_update|length > 0
|
||||
|
||||
- name: Load the container params file data
|
||||
slurp:
|
||||
src: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
register: containers_prepare_parameters
|
||||
|
||||
- name: Parse container params
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: "{{ containers_prepare_parameters['content'] | b64decode | from_yaml }}"
|
||||
|
||||
# update params for container update
|
||||
- name: Add updates to container-prepare-parameters.yaml
|
||||
when:
|
||||
- standalone_container_prep_updates
|
||||
- not job.build_container_images|default(false)|bool
|
||||
block:
|
||||
- name: Generate modified containers file
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: |-
|
||||
{% set imageParams = [] %}
|
||||
{% for item in containers_prepare_parameters_yaml['parameter_defaults']['ContainerImagePrepare'] %}
|
||||
{% set _ = item.__setitem__("push_destination", local_docker_registry_host ~ ":8787") %}
|
||||
{% set _ = item.__setitem__("modify_role", "tripleo-modify-image") %}
|
||||
{% set _ = item.__setitem__("modify_append_tag", update_containers_append_tag) %}
|
||||
{% if not (osp_release is defined) %}
|
||||
{% if release in ['rocky', 'stein'] %}
|
||||
{% set _ = item.__setitem__("modify_only_with_labels", ["kolla_version"]) %}
|
||||
{% else %}
|
||||
{% set _ = item.__setitem__("modify_only_with_source", ["kolla", "tripleo"]) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% set _ = item.__setitem__(
|
||||
"modify_vars",
|
||||
{
|
||||
"tasks_from": "yum_update.yml",
|
||||
"yum_repos_dir_path": "/etc/yum.repos.d",
|
||||
"update_repo": standalone_container_prep_update_repo ~ add_repos_update | default('')
|
||||
}
|
||||
)
|
||||
%}
|
||||
{% set _ = item.pop("tag_from_label", "") %}
|
||||
{% set _ = imageParams.append(item) %}
|
||||
{% endfor %}
|
||||
{% set defaults = {"ContainerImagePrepare": imageParams} %}
|
||||
{{ {"parameter_defaults": defaults} }}
|
||||
|
||||
- name: Update rhel_containers value
|
||||
when:
|
||||
- ansible_distribution == 'RedHat'
|
||||
set_fact:
|
||||
containers_prepare_parameters_yaml: |-
|
||||
{% set imageParams = [] %}
|
||||
{% for item in (containers_prepare_parameters_yaml | from_yaml)['parameter_defaults']['ContainerImagePrepare'] %}
|
||||
{% if "set" in item %}
|
||||
{% set _ = item['set'].__setitem__("rhel_containers", true) %}
|
||||
{% endif %}
|
||||
{% set _ = imageParams.append(item) %}
|
||||
{% endfor %}
|
||||
{% set defaults = {"ContainerImagePrepare": imageParams} %}
|
||||
{{ {"parameter_defaults": defaults} }}
|
||||
|
||||
- name: Write containers-prepare-parameters.yaml
|
||||
copy:
|
||||
content: "{{ containers_prepare_parameters_yaml | to_nice_yaml }}"
|
||||
dest: "{{ working_dir }}/containers-prepare-parameters.yaml"
|
||||
|
||||
- name: Modify the insecure registry value when using podman
|
||||
when:
|
||||
- standalone_container_prep_updates
|
||||
- ansible_distribution == 'RedHat'
|
||||
- ansible_distribution_major_version|int >= 8
|
||||
- release not in ['newton', 'ocata', 'pike', 'queens', 'rocky']
|
||||
replace:
|
||||
path: "{{ working_dir }}/standalone_parameters.yaml"
|
||||
regexp: " - 192.168.24.1:8787"
|
||||
replace: " - 192.168.24.1"
|
||||
backup: true
|
||||
|
||||
- name: Run dstat on the standalone prior to standalone deploy
|
||||
include_role:
|
||||
name: validate-perf
|
||||
|
||||
- name: Check whether control plane defaults to HA
|
||||
set_fact:
|
||||
tripleo_deploy_ha_control_plane: "{{ release not in ['newton', 'ocata', 'pike', 'queens', 'rocky', 'stein', 'train'] }}"
|
||||
|
||||
- name: Run standalone via tripleo-operator-ansible
|
||||
collections:
|
||||
- tripleo.operator
|
||||
include_role:
|
||||
name: tripleo_deploy
|
||||
vars:
|
||||
tripleo_deploy_debug: true
|
||||
tripleo_deploy_debug_arg: "{{ standalone_tripleo_deploy_debug_arg }}"
|
||||
tripleo_deploy_local_ip: "{{ standalone_ip }}/{{ standalone_network_prefix }}"
|
||||
tripleo_deploy_control_virtual_ip: >-
|
||||
{% if standalone_control_virtual_ip is not defined and tripleo_deploy_ha_control_plane|default(false)|bool -%}
|
||||
{{ standalone_ha_control_virtual_ip|default() }}
|
||||
{%- else -%}
|
||||
{{ standalone_control_virtual_ip|default() }}
|
||||
{%- endif -%}
|
||||
tripleo_deploy_roles_file: "{{ overcloud_templates_path }}/roles/{{ standalone_role }}"
|
||||
tripleo_deploy_output_dir: "{{ working_dir }}"
|
||||
tripleo_deploy_environment_files: |-
|
||||
{% set env_files = [overcloud_templates_path + '/environments/standalone/standalone-tripleo.yaml',
|
||||
working_dir + '/containers-prepare-parameters.yaml',
|
||||
working_dir + '/standalone_parameters.yaml']%}
|
||||
{% if standalone_custom_env_files %}
|
||||
{% set env_files = env_files + standalone_custom_env_files %}
|
||||
{% endif %}
|
||||
{{ env_files }}
|
||||
|
||||
- when: standalone_ansible_lint|default(false)|bool
|
||||
vars:
|
||||
quickstart_venv: "{{ lookup('env','OPT_WORKDIR') }}"
|
||||
block:
|
||||
- name: Install ansible-lint
|
||||
# noqa 403
|
||||
pip:
|
||||
name: ansible-lint
|
||||
state: latest
|
||||
virtualenv: "{{ quickstart_venv }}"
|
||||
|
||||
- name: List playbooks
|
||||
shell: "find $(ls -rtd {{ working_dir }}/undercloud-ansible-* | tail -1)/ -name '*playbook*.yaml'"
|
||||
register: playbooks
|
||||
|
||||
# We ignore (for now) the lint (rc==2), only catch syntax error
|
||||
# (rc==1).
|
||||
- name: Lint playbooks
|
||||
shell: >
|
||||
source {{ quickstart_venv }}/bin/activate;
|
||||
exec 1>>{{ working_dir }}/{{ standalone_ansible_lint_log }};
|
||||
exec 2>&1;
|
||||
echo LINTING {{ item }};
|
||||
ansible-lint -v {{ item }};
|
||||
rc=$?;
|
||||
echo DONE rc=$rc;
|
||||
exit $rc
|
||||
register: lint_result
|
||||
environment:
|
||||
ANSIBLE_LIBRARY: |
|
||||
/usr/share/ansible-modules/:{{ lookup('env', 'ANSIBLE_LIBRARY') }}
|
||||
with_items: "{{ playbooks.stdout_lines }}"
|
||||
failed_when: lint_result.rc == 1
|
||||
- include_tasks: containers.yml
|
||||
- include_tasks: standalone-install.yml
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
- name: Run dstat on the standalone prior to standalone deploy
|
||||
include_role:
|
||||
name: validate-perf
|
||||
|
||||
- name: Check whether control plane defaults to HA
|
||||
set_fact:
|
||||
tripleo_deploy_ha_control_plane: "{{ release not in ['newton', 'ocata', 'pike', 'queens', 'rocky', 'stein', 'train'] }}"
|
||||
|
||||
- name: Run standalone via tripleo-operator-ansible
|
||||
collections:
|
||||
- tripleo.operator
|
||||
include_role:
|
||||
name: tripleo_deploy
|
||||
vars:
|
||||
tripleo_deploy_debug: true
|
||||
tripleo_deploy_debug_arg: "{{ standalone_tripleo_deploy_debug_arg }}"
|
||||
tripleo_deploy_local_ip: "{{ standalone_ip }}/{{ standalone_network_prefix }}"
|
||||
tripleo_deploy_control_virtual_ip: >-
|
||||
{% if standalone_control_virtual_ip is not defined and tripleo_deploy_ha_control_plane|default(false)|bool -%}
|
||||
{{ standalone_ha_control_virtual_ip|default() }}
|
||||
{%- else -%}
|
||||
{{ standalone_control_virtual_ip|default() }}
|
||||
{%- endif -%}
|
||||
tripleo_deploy_roles_file: "{{ overcloud_templates_path }}/roles/{{ standalone_role }}"
|
||||
tripleo_deploy_output_dir: "{{ working_dir }}"
|
||||
tripleo_deploy_environment_files: |-
|
||||
{% set env_files = [overcloud_templates_path + '/environments/standalone/standalone-tripleo.yaml',
|
||||
working_dir + '/containers-prepare-parameters.yaml',
|
||||
working_dir + '/standalone_parameters.yaml']%}
|
||||
{% if standalone_custom_env_files %}
|
||||
{% set env_files = env_files + standalone_custom_env_files %}
|
||||
{% endif %}
|
||||
{{ env_files }}
|
||||
|
||||
- when: standalone_ansible_lint|default(false)|bool
|
||||
vars:
|
||||
quickstart_venv: "{{ lookup('env','OPT_WORKDIR') }}"
|
||||
block:
|
||||
- name: Install ansible-lint
|
||||
# noqa 403
|
||||
pip:
|
||||
name: ansible-lint
|
||||
state: latest
|
||||
virtualenv: "{{ quickstart_venv }}"
|
||||
|
||||
- name: List playbooks
|
||||
shell: "find $(ls -rtd {{ working_dir }}/undercloud-ansible-* | tail -1)/ -name '*playbook*.yaml'"
|
||||
register: playbooks
|
||||
|
||||
# We ignore (for now) the lint (rc==2), only catch syntax error
|
||||
# (rc==1).
|
||||
- name: Lint playbooks
|
||||
shell: >
|
||||
source {{ quickstart_venv }}/bin/activate;
|
||||
exec 1>>{{ working_dir }}/{{ standalone_ansible_lint_log }};
|
||||
exec 2>&1;
|
||||
echo LINTING {{ item }};
|
||||
ansible-lint -v {{ item }};
|
||||
rc=$?;
|
||||
echo DONE rc=$rc;
|
||||
exit $rc
|
||||
register: lint_result
|
||||
environment:
|
||||
ANSIBLE_LIBRARY: |
|
||||
/usr/share/ansible-modules/:{{ lookup('env', 'ANSIBLE_LIBRARY') }}
|
||||
with_items: "{{ playbooks.stdout_lines }}"
|
||||
failed_when: lint_result.rc == 1
|
|
@ -12,9 +12,12 @@ parameter_defaults:
|
|||
{% if standalone_container_prep_updates is defined and standalone_container_prep_updates %}
|
||||
DockerInsecureRegistryAddress:
|
||||
- {{ standalone_ip }}:8787
|
||||
{% if job.build_container_images|default(false)|bool %}
|
||||
{% if job.build_container_images|default(false)|bool or job.consumer_job|default(false)|bool %}
|
||||
- {{ local_registry_ip }}:{{ local_registry_port }}
|
||||
{% endif %}
|
||||
{% if job.registry_ip_address is defined %}
|
||||
- {{ job.registry_ip_address }}:{{ local_registry_port }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if undercloud_docker_registry_mirror is defined and undercloud_docker_registry_mirror %}
|
||||
DockerRegistryMirror: {{undercloud_docker_registry_mirror}}
|
||||
|
|
Loading…
Reference in New Issue