Merge "Replaced casablanca by tag 3.0.1-ONAP"
diff --git a/.gitignore b/.gitignore
index 8e695ec..f665d53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
doc
+/package.info
+/ansible/log/
diff --git a/ansible/.gitignore b/ansible/.gitignore
index 5cddc2e..521beaa 100644
--- a/ansible/.gitignore
+++ b/ansible/.gitignore
@@ -1 +1,2 @@
ansible_chroot
+application/*
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index cd8c7f5..2171562 100755
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -59,10 +59,6 @@
# Default value is to allow redeploy
redeploy_k8s_env: yes
-# Distribute offline rpm repository
-# Default value is to distribute rpm
-deploy_rpm_repository: yes
-
# Offline solution is deploying app specific rpm repository and requires some name
# also for k8s cluster
# e.g. app_name: onap
@@ -78,13 +74,17 @@
# prebuilt nexus blob in installation time.
# Component name must match with tar filename!
# e.g.
-# aaa-component-0.0.1.tar is expected in aux_data_path for aaa-component image
+# aaa/bbb-component-0.0.1.tar are expected in aux_data_path for component images.
#runtime_images:
-# aaa-component-0.0.1:
+# aaa-component-0.0.1:
# registry: "nexus3.onap.org:10001"
# path: "/onap/components/aaa-component"
# tag: "latest"
-runtime_images:
+# bbb-component-0.0.1:
+# registry: "nexus3.onap.org:10001"
+# path: "/onap/components/bbb-component"
+# tag: "latest"
+runtime_images: {}
###############################
# Application specific params #
diff --git a/ansible/infrastructure.yml b/ansible/infrastructure.yml
index e4715a9..382ffd5 100644
--- a/ansible/infrastructure.yml
+++ b/ansible/infrastructure.yml
@@ -1,31 +1,9 @@
---
- name: Perform common environment setup for nodes
hosts: infrastructure, kubernetes
- tasks:
- - name: Setup resolv.conf
- lineinfile:
- line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
- path: /etc/resolv.conf
- state: present
- insertbefore: BOF
- become: yes
- - name: Add application offline rpm repository
- yum_repository:
- name: "{{ app_name }}"
- file: "{{ app_name | lower }}"
- description: "{{ app_name }} offline repository"
- baseurl: "{{ 'http://repo.infra-server/rhel' if 'infrastructure' not in group_names else 'file://' + app_data_path + '/pkg/rhel' }}"
- gpgcheck: no
- enabled: yes
- when: deploy_rpm_repository
- become: yes
-
-- name: Setup firewall
- hosts: infrastructure, kubernetes
roles:
+ - package-repository
- role: firewall
- vars:
- state: disable
- name: Setup infrastructure servers
hosts: infrastructure
@@ -34,34 +12,8 @@
- docker
- dns
- vncserver
- - role: nexus
- vars:
- phase: install
- nginx
- tasks:
- - name: "wait for nexus to come up"
- uri:
- url: "{{ nexus_url }}/service/metrics/healthcheck"
- user: admin
- password: admin123
- force_basic_auth: yes
- method: GET
- register: nexus_wait
- until: not nexus_wait.failed
- retries: 30
- delay: 10
-
-- name: Nexus changes in runtime
- hosts: infrastructure
- roles:
- - role: nexus
- vars:
- phase: configure
- when: populate_nexus | bool
- - role: nexus
- vars:
- phase: runtime-populate
- when: runtime_images is defined and runtime_images is not none
+ - nexus
- name: Setup base for Kubernetes nodes
hosts: kubernetes
diff --git a/ansible/roles/firewall/defaults/main.yml b/ansible/roles/firewall/defaults/main.yml
new file mode 100644
index 0000000..7cc9ae9
--- /dev/null
+++ b/ansible/roles/firewall/defaults/main.yml
@@ -0,0 +1,6 @@
+---
+firewall:
+ state: disable
+ package_name:
+ RedHat: 'firewalld'
+ Debian: 'ufw'
diff --git a/ansible/roles/firewall/tasks/firewall-disable.yml b/ansible/roles/firewall/tasks/firewall-disable.yml
index 9a8a2c1..f406d94 100644
--- a/ansible/roles/firewall/tasks/firewall-disable.yml
+++ b/ansible/roles/firewall/tasks/firewall-disable.yml
@@ -1,16 +1,14 @@
---
-- name: Check if firewalld is installed
- yum:
- list: firewalld
- disablerepo: "*"
- register: firewalld_check
+- name: Get installed packages list
+ package_facts:
+ manager: "auto"
-- name: Stop and disable firewalld if exists
+- name: Stop and disable default OS firewall if exists
service:
- name: firewalld
+ name: "{{ firewall.package_name[ansible_facts.os_family] }}"
state: stopped
enabled: no
- when: firewalld_check.results|selectattr('yumstate', 'match', 'installed')|list|length != 0
+ when: firewall.package_name[ansible_facts.os_family] in ansible_facts.packages
- name: Flush iptables
iptables:
diff --git a/ansible/roles/firewall/tasks/main.yml b/ansible/roles/firewall/tasks/main.yml
index f7bb7c7..29ea195 100644
--- a/ansible/roles/firewall/tasks/main.yml
+++ b/ansible/roles/firewall/tasks/main.yml
@@ -1,2 +1,2 @@
---
-- include_tasks: "firewall-{{ state }}.yml"
+- include_tasks: "firewall-{{ firewall.state }}.yml"
diff --git a/ansible/roles/nexus/defaults/main.yml b/ansible/roles/nexus/defaults/main.yml
index 57a79f9..3776f44 100644
--- a/ansible/roles/nexus/defaults/main.yml
+++ b/ansible/roles/nexus/defaults/main.yml
@@ -1,2 +1,6 @@
-#Defaults to install, can be set to configure.
-phase: install
+---
+# By default prepopulated nexus binary blob used.
+populate_nexus: false
+# By dafault no additional docker images pushed to nexus at runtime
+# but all images are pre-populated either at buildtime or at install time (populate_nexus).
+runtime_images: {}
diff --git a/ansible/roles/nexus/tasks/configure.yml b/ansible/roles/nexus/tasks/configure.yml
index 66712d8..7e6c20e 100644
--- a/ansible/roles/nexus/tasks/configure.yml
+++ b/ansible/roles/nexus/tasks/configure.yml
@@ -3,7 +3,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script/configure"
method: GET
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
status_code: [200, 404]
@@ -13,7 +13,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script"
method: POST
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
body_format: json
@@ -26,7 +26,7 @@
uri:
url: "{{ nexus_url }}/service/rest/v1/script/configure/run"
method: POST
- force_basic_auth: yes
+ force_basic_auth: true
user: admin
password: admin123
body_format: raw
diff --git a/ansible/roles/nexus/tasks/insert-images.yml b/ansible/roles/nexus/tasks/insert-images.yml
index fb8d7d8..f71d699 100644
--- a/ansible/roles/nexus/tasks/insert-images.yml
+++ b/ansible/roles/nexus/tasks/insert-images.yml
@@ -14,6 +14,7 @@
docker_image:
name: "{{ runtime_images[component].registry }}{{ runtime_images[component].path }}"
tag: "{{ runtime_images[component].tag }}"
- push: yes
+ push: true
load_path: "{{ item.path }}"
timeout: 120
+ changed_when: false # for idenpotence
diff --git a/ansible/roles/nexus/tasks/install.yml b/ansible/roles/nexus/tasks/install.yml
index 1756b70..99d73dc 100644
--- a/ansible/roles/nexus/tasks/install.yml
+++ b/ansible/roles/nexus/tasks/install.yml
@@ -4,7 +4,7 @@
path: "{{ app_data_path }}/nexus_data"
owner: 200
group: 200
- recurse: yes
+ recurse: true
- name: Load nexus image
docker_image:
@@ -28,3 +28,15 @@
- "{{ app_data_path }}/nexus_data:/nexus-data:rw"
state: started
restart_policy: unless-stopped
+
+- name: Wait for nexus to come up
+ uri:
+ url: "{{ nexus_url }}/service/metrics/healthcheck"
+ user: admin
+ password: admin123
+ force_basic_auth: true
+ method: GET
+ retries: 30
+ delay: 10
+ register: nexus_wait
+ until: not nexus_wait.failed
diff --git a/ansible/roles/nexus/tasks/main.yml b/ansible/roles/nexus/tasks/main.yml
index c5905b1..c1d8351 100644
--- a/ansible/roles/nexus/tasks/main.yml
+++ b/ansible/roles/nexus/tasks/main.yml
@@ -1,2 +1,9 @@
---
-- include_tasks: "{{ phase }}.yml"
+- include_tasks: install.yml
+- include_tasks: configure.yml
+ when: populate_nexus | bool
+- include_tasks: runtime-populate.yml
+ when:
+ - runtime_images is defined
+ - runtime_images is not none
+ - runtime_images.keys() | length > 0
diff --git a/ansible/roles/nexus/tasks/runtime-populate.yml b/ansible/roles/nexus/tasks/runtime-populate.yml
index e22b650..ac947ec 100644
--- a/ansible/roles/nexus/tasks/runtime-populate.yml
+++ b/ansible/roles/nexus/tasks/runtime-populate.yml
@@ -9,4 +9,3 @@
# need to iterate over those tasks in include
- include: "insert-images.yml"
with_items: "{{ tar_images.files }}"
-
diff --git a/ansible/roles/nexus/vars/main.yml b/ansible/roles/nexus/vars/main.yml
index 6394416..5ec5186 100644
--- a/ansible/roles/nexus/vars/main.yml
+++ b/ansible/roles/nexus/vars/main.yml
@@ -1 +1,2 @@
+---
nexus_url: "https://nexus.{{ hostvars[groups.infrastructure[0]].ansible_nodename }}"
diff --git a/ansible/roles/nginx/defaults/main.yml b/ansible/roles/nginx/defaults/main.yml
new file mode 100644
index 0000000..7c9fa0b
--- /dev/null
+++ b/ansible/roles/nginx/defaults/main.yml
@@ -0,0 +1,21 @@
+---
+simulated_hosts:
+ git:
+ http:
+ nexus:
+all_simulated_hosts:
+ "{{ simulated_hosts.git + simulated_hosts.http + simulated_hosts.nexus }}"
+
+nginx:
+ ports:
+ - "80:80"
+ - "443:443"
+ - "10001:443"
+ volumes:
+ - "{{ app_data_path }}/cfg/nginx.conf:/etc/nginx/nginx.conf:ro"
+ - "{{ app_data_path }}/certs:/etc/nginx/certs:ro"
+ - "{{ app_data_path }}/git-repo:/srv/git:rw"
+ - "{{ app_data_path }}/http:/srv/http:rw"
+ - "{{ app_data_path }}/pkg/rhel:/srv/http/repo.infra-server/rhel:rw"
+ - "{{ app_data_path }}/pkg/ubuntu/xenial:/srv/http/repo.infra-server/ubuntu/xenial:rw"
+ - /var/log/nginx:/var/log/nginx:rw
diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/nginx/tasks/main.yml
index c59be75..1ec0adb 100644
--- a/ansible/roles/nginx/tasks/main.yml
+++ b/ansible/roles/nginx/tasks/main.yml
@@ -16,23 +16,18 @@
state: present
timeout: 120
+- name: Create nexus network
+ docker_network:
+ name: nexus_network
+ state: present
+
- name: Start nginx
docker_container:
name: own_nginx
image: own_nginx
networks:
- name: nexus_network
- ports:
- - "80:80"
- - "443:443"
- - "10001:443"
- volumes:
- - "{{ app_data_path }}/cfg/nginx.conf:/etc/nginx/nginx.conf:ro"
- - "{{ app_data_path }}/certs:/etc/nginx/certs:ro"
- - "{{ app_data_path }}/git-repo:/srv/git:rw"
- - "{{ app_data_path }}/http:/srv/http:rw"
- - "{{ app_data_path }}/pkg/rhel:/srv/http/repo.infra-server/rhel:rw"
- - "{{ app_data_path }}/pkg/ubuntu/xenial:/srv/http/repo.infra-server/ubuntu/xenial:rw"
- - /var/log/nginx:/var/log/nginx:rw
+ ports: "{{ nginx.ports }}"
+ volumes: "{{ nginx.volumes }}"
state: started
restart_policy: unless-stopped
diff --git a/ansible/roles/nginx/templates/nginx.conf.j2 b/ansible/roles/nginx/templates/nginx.conf.j2
index fb48565..ff9d2a9 100644
--- a/ansible/roles/nginx/templates/nginx.conf.j2
+++ b/ansible/roles/nginx/templates/nginx.conf.j2
@@ -12,14 +12,6 @@
proxy_send_timeout 120;
proxy_read_timeout 300;
- upstream nexus {
- server nexus:8081;
- }
-
- upstream registry {
- server nexus:8082;
- }
-
# http simulations
server {
listen 80;
@@ -38,6 +30,7 @@
# nexus simulations
server {
+ resolver 127.0.0.11 valid=30s;
listen 80;
listen 443 ssl;
server_name {% for host in simulated_hosts.nexus -%}
@@ -53,11 +46,13 @@
client_max_body_size 3G;
location / {
+ set $upstream_nexus nexus:8081;
+ set $upstream_registry nexus:8082;
# redirect to docker registry
if ($http_user_agent ~ docker ) {
- proxy_pass http://registry;
+ proxy_pass http://$upstream_registry;
}
- proxy_pass http://nexus;
+ proxy_pass http://$upstream_nexus;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
diff --git a/ansible/roles/package-repository/defaults/main.yml b/ansible/roles/package-repository/defaults/main.yml
new file mode 100644
index 0000000..678b6bd
--- /dev/null
+++ b/ansible/roles/package-repository/defaults/main.yml
@@ -0,0 +1,8 @@
+---
+package_repositories:
+ - name: "{{ app_name }}"
+ file: "{{ app_name | lower }}"
+ description: "{{ app_name | upper }} offline repository"
+ baseurl: "{{ 'http://repo.infra-server/rhel' if 'infrastructure' not in group_names else 'file://' + app_data_path + '/pkg/rhel' }}"
+ gpgcheck: false
+ enabled: true
diff --git a/ansible/roles/package-repository/tasks/main.yml b/ansible/roles/package-repository/tasks/main.yml
new file mode 100644
index 0000000..4949345
--- /dev/null
+++ b/ansible/roles/package-repository/tasks/main.yml
@@ -0,0 +1,47 @@
+---
+- name: Setup resolv.conf for node to find package repository by name from infra
+ lineinfile:
+ line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
+ path: /etc/resolv.conf
+ state: present
+ insertbefore: BOF
+ become: true
+
+- name: Disable all OS default repositories
+ block:
+ - name: Find repo files names
+ find:
+ paths: /etc/yum.repos.d
+ pattern: '*.repo'
+ register: repo_files
+
+ - name: Get all defined offline repo names
+ set_fact: package_repositories_names="{{ package_repositories | selectattr('name', 'defined') | map(attribute='name') | list }}"
+
+ - name: Backup repo files
+ copy:
+ remote_src: yes
+ src: "{{ item.path }}"
+ dest: "{{ item.path }}.disabled"
+ loop: "{{ repo_files.files }}"
+ when: "(item.path | basename | splitext)[0] not in package_repositories_names"
+
+ - name: Remove disabled repo files
+ file:
+ path: "{{ item.path }}"
+ state: absent
+ loop: "{{ repo_files.files }}"
+ when: "(item.path | basename | splitext)[0] not in package_repositories_names"
+ become: yes
+
+- name: Add application offline package repository
+ yum_repository:
+ name: "{{ item.name }}"
+ file: "{{ item.file }}"
+ description: "{{ item.description | default('') }}"
+ baseurl: "{{ item.baseurl | default('') }}"
+ gpgcheck: "{{ item.gpgcheck | default(true) }}"
+ enabled: "{{ item.enabled | default(false) }}"
+ state: "{{ item.state | default('present') }}"
+ loop: "{{ package_repositories }}"
+ become: true
diff --git a/build/creating_data/download-git-repos.sh b/build/creating_data/download-git-repos.sh
index bb4a79f..0219eb6 100755
--- a/build/creating_data/download-git-repos.sh
+++ b/build/creating_data/download-git-repos.sh
@@ -24,7 +24,7 @@
echo "Usage:"
echo -e "./$(basename $0) <repository list> [destination directory]\n"
echo "Examples:"
- echo " ./$(basename $0) onap_3.0.0 ./git-repo"
+ echo " ./$(basename $0) onap_3.0.0-git_repos.list ./git-repo"
}
LIST="${1}"
diff --git a/build/creating_data/save-docker-images.sh b/build/creating_data/save-docker-images.sh
index f4a5d3c..4c76455 100755
--- a/build/creating_data/save-docker-images.sh
+++ b/build/creating_data/save-docker-images.sh
@@ -27,7 +27,8 @@
. "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh
fi
-IMG_DIR="$1"
+LIST="${1}"
+IMG_DIR="${2}"
if [[ -z "$IMG_DIR" ]]; then
IMG_DIR="./images"
@@ -55,13 +56,11 @@
echo "Save all images"
line=1
-lines=$(docker images|grep -v 'IMAGE ID'|wc -l)
+lines=$(wc -l ${LIST})
while read -r image; do
echo "== pkg #$line of $lines =="
- name=$(echo $image|awk '{print $1}')
- tag=$(echo $image|awk '{print $2}')
- save_image "$name:$tag"
+ save_image "${image}"
line=$((line+1))
-done <<< "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s\n", $1, $2)}'|column -t)"
+done < "${LIST}"
diff --git a/build/data_lists/infra_docker_images.list b/build/data_lists/infra_docker_images.list
new file mode 100644
index 0000000..af156cf
--- /dev/null
+++ b/build/data_lists/infra_docker_images.list
@@ -0,0 +1,3 @@
+andyshinn/dnsmasq:2.76
+consol/centos-icewm-vnc:latest
+sonatype/nexus3:3.15.2
diff --git a/build/data_lists/onap_3.0.0-docker_images.list b/build/data_lists/onap_3.0.0-docker_images.list
index 2bb8245..589c6a5 100644
--- a/build/data_lists/onap_3.0.0-docker_images.list
+++ b/build/data_lists/onap_3.0.0-docker_images.list
@@ -2,7 +2,6 @@
library/alpine:3.6
library/busybox:latest
library/cassandra:2.1
-consol/centos-icewm-vnc:latest
library/consul:1.0.6
crunchydata/crunchy-pgpool:centos7-10.4-2.0.0
crunchydata/crunchy-postgres:centos7-10.3-1.8.2
diff --git a/build/data_lists/onap_3.0.1-docker_images.list b/build/data_lists/onap_3.0.1-docker_images.list
index cf8b11c..ec98a3e 100644
--- a/build/data_lists/onap_3.0.1-docker_images.list
+++ b/build/data_lists/onap_3.0.1-docker_images.list
@@ -3,7 +3,6 @@
library/busybox:latest
library/cassandra:2.1
cdposs/zookeeper:3.4.9
-consol/centos-icewm-vnc:latest
library/consul:1.0.6
crunchydata/crunchy-pgpool:centos7-10.4-2.0.0
crunchydata/crunchy-postgres:centos7-10.3-1.8.2
diff --git a/build/download_offline_data_by_lists.sh b/build/download_offline_data_by_lists.sh
index aede41d..741c204 100755
--- a/build/download_offline_data_by_lists.sh
+++ b/build/download_offline_data_by_lists.sh
@@ -47,7 +47,7 @@
CTOOLS="${LOCAL_PATH}/creating_data"
LISTS_DIR="${LOCAL_PATH}/data_lists"
DATA_DIR="${LOCAL_PATH}/../../resources"
-TOTAL=11
+TOTAL=12
CURR=1
message info "Downloading started: $(date)"
@@ -55,19 +55,22 @@
echo "[Step $((CURR++))/$TOTAL Download collected docker images]"
$CTOOLS/download-docker-images.sh "${LISTS_DIR}/${TAG}-docker_images.list"
+echo "[Step $((CURR++))/$TOTAL Download docker images for infra-server]"
+$CTOOLS/download-docker-images.sh "${LISTS_DIR}/infra_docker_images.list"
+
echo "[Step $((CURR++))/$TOTAL Build own nginx image]"
$CTOOLS/create_nginx_image/01create-image.sh
echo "[Step $((CURR++))/$TOTAL Save docker images from docker cache to tarfiles]"
-$CTOOLS/save-docker-images.sh "${DATA_DIR}/offline_data/docker_images_for_nexus"
+$CTOOLS/save-docker-images.sh "${LISTS_DIR}/${TAG}-docker_images.list" "${DATA_DIR}/offline_data/docker_images_for_nexus"
-echo "[Step $((CURR++))/$TOTAL move infra related images to infra folder]"
+echo "[Step $((CURR++))/$TOTAL Prepare infra related images to infra folder]"
mkdir -p "${DATA_DIR}/offline_data/docker_images_infra"
mv "${DATA_DIR}/offline_data/docker_images_for_nexus/own_nginx_latest.tar" "${DATA_DIR}/offline_data/docker_images_infra"
-mv "${DATA_DIR}/offline_data/docker_images_for_nexus/sonatype_nexus3_latest.tar" "${DATA_DIR}/offline_data/docker_images_infra"
+$CTOOLS/save-docker-images.sh "${LISTS_DIR}/infra_docker_images.list" "${DATA_DIR}/offline_data/docker_images_infra"
echo "[Step $((CURR++))/$TOTAL Download git repos]"
-$CTOOLS/download-git-repos.sh "${LISTS_DIR}/${TAG}" "${DATA_DIR}/git-repo"
+$CTOOLS/download-git-repos.sh "${LISTS_DIR}/${TAG}-git_repos.list" "${DATA_DIR}/git-repo"
echo "[Step $((CURR++))/$TOTAL Download http files]"
$CTOOLS/download-http-files.sh "${LISTS_DIR}/${TAG}-http_files.list" "${DATA_DIR}/http"
diff --git a/build/fetch_and_patch_charts.sh b/build/fetch_and_patch_charts.sh
index cde4265..2c1312e 100755
--- a/build/fetch_and_patch_charts.sh
+++ b/build/fetch_and_patch_charts.sh
@@ -37,7 +37,7 @@
usage () {
echo "Usage:"
echo -e "./$(basename $0) <helm charts repo> <commit/tag/branch> <patchfile> <target_dir>\n"
- echo "Example: ./$(basename $0) https://gerrit.onap.org/r/oom 3.0.0-ONAP /root/offline-installer/patches/casablanca_3.0.0.patch /root/offline-installer/ansible/application/helm_charts"
+ echo "Example: ./$(basename $0) https://gerrit.onap.org/r/oom 3.0.0-ONAP /root/offline-installer/patches/casablanca.patch /root/offline-installer/ansible/application/helm_charts"
}
if [ "$#" -ne 4 ]; then
diff --git a/docs/BuildGuide.rst b/docs/BuildGuide.rst
index 4cf8d97..96c1fbf 100644
--- a/docs/BuildGuide.rst
+++ b/docs/BuildGuide.rst
@@ -296,7 +296,7 @@
For example:
-``$ ./build/fetch_and_patch_charts.sh https://gerrit.onap.org/r/oom 3.0.0-ONAP /tmp/offline-installer/patches/casablanca_3.0.0.patch /tmp/oom-clone``
+``$ ./build/fetch_and_patch_charts.sh https://gerrit.onap.org/r/oom 3.0.0-ONAP /tmp/offline-installer/patches/casablanca.patch /tmp/oom-clone``
Part 5. Creating offline installation package
---------------------------------------------
diff --git a/patches/casablanca_3.0.0.patch b/patches/casablanca.patch
similarity index 100%
rename from patches/casablanca_3.0.0.patch
rename to patches/casablanca.patch
diff --git a/patches/onap-casablanca-patch-role/tasks/main.yml b/patches/onap-casablanca-patch-role/tasks/main.yml
index d3b92e5..00ee457 100644
--- a/patches/onap-casablanca-patch-role/tasks/main.yml
+++ b/patches/onap-casablanca-patch-role/tasks/main.yml
@@ -1,34 +1,48 @@
---
# This role contains patching logic for OOM charts
# and is valid until OOM-1610 is implemented
+- name: Check presence of files for NPM patching
+ stat:
+ path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ with_items:
+ - common/dgbuilder/templates/deployment.yaml
+ - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ register: npm_files_check
+
+- name: Check presence of dcae cloudify deployment chart file
+ stat:
+ path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ with_items:
+ - dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
+ register: dcae_files_check
+
- name: Patch OOM - nexus domain resolving
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)HOSTS_FILE_RECORD'
line: '\g<1>{{ cluster_ip }} {{ simulated_hosts.nexus | join(" ") }} >> /etc/hosts;'
backrefs: yes
state: present
- with_items:
- - common/dgbuilder/templates/deployment.yaml
- - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ with_items: "{{ npm_files_check.results }}"
+ when: item.stat.exists
- name: Patch OOM - set npm registry
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)NPM_REGISTRY_RECORD'
line: '\g<1>npm set registry "http://nexus.{{ ansible_nodename }}/repository/npm-private/";'
backrefs: yes
state: present
- with_items:
- - common/dgbuilder/templates/deployment.yaml
- - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ with_items: "{{ npm_files_check.results }}"
+ when: item.stat.exists
- name: Patch OOM - set cert path for cloudify
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)CERT_PATH'
line: '\g<1>/etc/pki/ca-trust/source/anchors'
backrefs: yes
state: present
- with_items:
- - dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
+ with_items: "{{ dcae_files_check.results }}"
+ when: item.stat.exists
+