summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/ansible.cfg1
-rw-r--r--ansible/docker/Dockerfile1
-rwxr-xr-xansible/docker/build_ansible_image.sh10
-rwxr-xr-xansible/group_vars/infrastructure.yml2
-rw-r--r--ansible/group_vars/kubernetes.yml2
-rw-r--r--ansible/infrastructure.yml4
-rw-r--r--ansible/inventory/hosts.yml4
-rw-r--r--ansible/roles/docker/tasks/main.yml2
-rw-r--r--ansible/roles/rancher/tasks/rancher_server.yml4
-rwxr-xr-xansible/run_playbook.sh6
-rwxr-xr-xpackage.sh10
11 files changed, 34 insertions, 12 deletions
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
index c2ee3ff3..0978b814 100644
--- a/ansible/ansible.cfg
+++ b/ansible/ansible.cfg
@@ -6,3 +6,4 @@
# relative path ./application is mapped into ansible container under
# /ansible/application where application roles should be found
roles_path = /ansible/application
+log_path = /ansible/log/ansible.log
diff --git a/ansible/docker/Dockerfile b/ansible/docker/Dockerfile
index b0172709..4cefa8b7 100644
--- a/ansible/docker/Dockerfile
+++ b/ansible/docker/Dockerfile
@@ -24,6 +24,7 @@ RUN apk --no-cache update \
&& pip3 install --no-cache-dir \
ansible==$ansible_version \
jmespath \
+ netaddr \
&& apk del build-dependencies && rm -rf /var/cache/apk/*
ENV ANSIBLE_HOST_KEY_CHECKING false
diff --git a/ansible/docker/build_ansible_image.sh b/ansible/docker/build_ansible_image.sh
index d54ddc43..49833be5 100755
--- a/ansible/docker/build_ansible_image.sh
+++ b/ansible/docker/build_ansible_image.sh
@@ -27,14 +27,12 @@ image_name="${2:-ansible:latest}"
script_path=$(readlink -f "$0")
script_dir=$(dirname "$script_path")
-git_commit=$(git rev-parse --revs-only HEAD)
+git_commit=$(git rev-parse --revs-only HEAD || true)
build_date=$(date -I)
-if [ -z "$ansible_version" ]; then
- docker build "$script_dir" -t "${image_name}" --label "git-commit=$git_commit" --label "build-date=$build_date"
-else
- docker build "$script_dir" -t "${image_name}" --label "git-commit=$git_commit" --label "build-date=$build_date" --build-arg ansible_version="$ansible_version"
-fi
+docker build "$script_dir" -t "${image_name}" --label "build-date=$build_date" \
+ ${git_commit:+--label git-commit=${git_commit}} \
+ ${ansible_version:+--build-arg ansible_version=${ansible_version}}
# Export docker image into chroot and tararchive it. It takes ~40M of space and is packaged together with sw.
if "${script_dir}"/create_docker_chroot.sh convert "${image_name}" "${script_dir}"/ansible_chroot ; then
diff --git a/ansible/group_vars/infrastructure.yml b/ansible/group_vars/infrastructure.yml
index ab314055..9fd88f25 100755
--- a/ansible/group_vars/infrastructure.yml
+++ b/ansible/group_vars/infrastructure.yml
@@ -1,5 +1,4 @@
---
-nfs_mount_path: /dockerdata-nfs
vnc_passwd: samsung
simulated_hosts:
git:
@@ -26,6 +25,7 @@ simulated_hosts:
all_simulated_hosts:
"{{ simulated_hosts.git + simulated_hosts.http + simulated_hosts.nexus }}"
rancher_server_url: "http://{{ hostvars[groups.infrastructure.0].ansible_host }}:8080"
+rancher_server_version: v1.6.22
rancher_remove_other_env: yes
rancher_redeploy_k8s_env: yes
populate_nexus: no
diff --git a/ansible/group_vars/kubernetes.yml b/ansible/group_vars/kubernetes.yml
new file mode 100644
index 00000000..869c35f3
--- /dev/null
+++ b/ansible/group_vars/kubernetes.yml
@@ -0,0 +1,2 @@
+---
+nfs_mount_path: /dockerdata-nfs
diff --git a/ansible/infrastructure.yml b/ansible/infrastructure.yml
index 789f8716..08667330 100644
--- a/ansible/infrastructure.yml
+++ b/ansible/infrastructure.yml
@@ -4,7 +4,7 @@
tasks:
- name: Setup resolv.conf
lineinfile:
- line: "nameserver {{ hostvars[groups.infrastructure[0]].ansible_host }}"
+ line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
path: /etc/resolv.conf
state: present
insertbefore: BOF
@@ -61,7 +61,7 @@
- role: nexus
vars:
phase: runtime-populate
- when: runtime_images is defined
+ when: runtime_images is defined and runtime_images is not none
- name: Setup base for Kubernetes nodes
hosts: kubernetes
diff --git a/ansible/inventory/hosts.yml b/ansible/inventory/hosts.yml
index f11ef7b1..a29072c5 100644
--- a/ansible/inventory/hosts.yml
+++ b/ansible/inventory/hosts.yml
@@ -20,12 +20,16 @@ all:
hosts:
infrastructure-server:
ansible_host: 10.8.8.13
+ #IP used for communication between infra and kubernetes nodes, must be specified.
+ cluster_ip: 10.8.8.13
# This is group of hosts which are/will be part of Kubernetes cluster.
kubernetes:
hosts:
kubernetes-node-1:
ansible_host: 10.8.8.19
+ #ip of the node that it uses for communication with k8s cluster.
+ cluster_ip: 10.8.8.19
nfs-server:
hosts:
diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml
index 9851d4dc..09e790a4 100644
--- a/ansible/roles/docker/tasks/main.yml
+++ b/ansible/roles/docker/tasks/main.yml
@@ -20,7 +20,7 @@
json_add:
path: /etc/docker/daemon.json
key: dns
- value: "{{ hostvars[groups.infrastructure[0]].ansible_default_ipv4.address }}"
+ value: "{{ hostvars[groups.infrastructure[0]].cluster_ip }}"
notify:
- Restart Docker
diff --git a/ansible/roles/rancher/tasks/rancher_server.yml b/ansible/roles/rancher/tasks/rancher_server.yml
index 9abf986b..64b35e4c 100644
--- a/ansible/roles/rancher/tasks/rancher_server.yml
+++ b/ansible/roles/rancher/tasks/rancher_server.yml
@@ -1,9 +1,9 @@
---
# DO NOT ADD SPACE AROUND ';'
-- name: Start rancher/server:v1.6.14
+- name: Start rancher/server:{{ rancher_server_version }}
docker_container:
name: rancher_server
- image: rancher/server:v1.6.14
+ image: rancher/server:{{ rancher_server_version }}
command: ["sh", "-c", "/usr/sbin/update-ca-certificates;/usr/bin/entry /usr/bin/s6-svscan /service"]
ports: 8080:8080
state: started
diff --git a/ansible/run_playbook.sh b/ansible/run_playbook.sh
index 9a2ca56f..2edbe358 100755
--- a/ansible/run_playbook.sh
+++ b/ansible/run_playbook.sh
@@ -25,6 +25,7 @@ script_path=$(readlink -f "$0")
script_name=$(basename "$script_path")
ANSIBLE_DIR=$(dirname "$script_path")
ANSIBLE_CHROOT="${ANSIBLE_DIR}/ansible_chroot"
+ANSIBLE_LOG_PATH="/ansible/log/ansible-$(date +%Y.%m.%d-%H%M%S).log"
#
@@ -82,6 +83,8 @@ REQUIREMENTS:
# run playbook
#
+export ANSIBLE_LOG_PATH
+
# if no arg then print help and exit
if [ -z "$1" ] ; then
help
@@ -101,6 +104,8 @@ if [ -n "$ANSIBLE_DOCKER_IMAGE" ] ; then
-v "$ANSIBLE_DIR:/ansible:ro" \
-v "$ANSIBLE_DIR/application:/ansible/application:rw" \
-v "$ANSIBLE_DIR/certs/:/certs:rw" \
+ -v "$ANSIBLE_DIR/log/:/ansible/log:rw" \
+ -e ANSIBLE_LOG_PATH \
-it "${ANSIBLE_DOCKER_IMAGE}" "$@"
fi
@@ -123,6 +128,7 @@ fi
--mount rw:"${HOME}/.ssh":/root/.ssh \
--mount ro:"$ANSIBLE_DIR":/ansible \
--mount rw:"$ANSIBLE_DIR"/application:/ansible/application \
+ --mount rw:"$ANSIBLE_DIR"/log:/ansible/log \
--mount rw:"$ANSIBLE_DIR"/certs:/certs \
--mount ro:/etc/resolv.conf:/etc/resolv.conf \
--mount ro:/etc/hosts:/etc/hosts \
diff --git a/package.sh b/package.sh
index 3a4d12bc..cb0782d2 100755
--- a/package.sh
+++ b/package.sh
@@ -79,6 +79,15 @@ function add_additions {
fi
}
+function build_sw_artifacts {
+ cd ansible/docker
+ ./build_ansible_image.sh
+ if [ $? -ne 0 ]; then
+ crash 5 "Building of ansible runner image failed."
+ fi
+ cd -
+}
+
function create_sw_package {
local pkg_root="${PACKAGING_TARGET_DIR}/onap"
@@ -204,6 +213,7 @@ whotest[0]='test' || (crash 3 "Arrays not supported in this version of bash.")
# Prepare output directory for our packaging and create all tars
rm -rf ${PACKAGING_TARGET_DIR}
+build_sw_artifacts
create_sw_package
create_resource_package