summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/application/tasks/install.yml7
-rw-r--r--ansible/roles/helm/molecule/default/molecule.yml2
l---------ansible/roles/helm/molecule/ubuntu/group_vars1
-rw-r--r--ansible/roles/helm/molecule/ubuntu/molecule.yml38
-rw-r--r--ansible/roles/package-repository-check/tasks/Debian.yml34
-rw-r--r--ansible/roles/package-repository-check/tasks/main.yml1
6 files changed, 82 insertions, 1 deletions
diff --git a/ansible/roles/application/tasks/install.yml b/ansible/roles/application/tasks/install.yml
index 5cffdd07..81e145a7 100644
--- a/ansible/roles/application/tasks/install.yml
+++ b/ansible/roles/application/tasks/install.yml
@@ -46,6 +46,13 @@
when: "'local' not in helm_repo_list.stdout"
changed_when: true # when executed its a changed type of action
+# Make utility is missing in Ubuntu by default and it's necessary for building local helm repository
+- name: Install build-essential
+ package:
+ name: build-essential
+ state: present
+ when: ansible_os_family == "Debian"
+
- name: Build local helm repository
make:
chdir: "{{ app_helm_charts_infra_directory }}"
diff --git a/ansible/roles/helm/molecule/default/molecule.yml b/ansible/roles/helm/molecule/default/molecule.yml
index 869f87f6..0d46c2d4 100644
--- a/ansible/roles/helm/molecule/default/molecule.yml
+++ b/ansible/roles/helm/molecule/default/molecule.yml
@@ -26,6 +26,8 @@ provisioner:
app_name: onap
app_data_path: "/opt/{{ app_name }}"
helm_bin_dir: /usr/local/bin
+scenario:
+ name: default
verifier:
name: testinfra
lint:
diff --git a/ansible/roles/helm/molecule/ubuntu/group_vars b/ansible/roles/helm/molecule/ubuntu/group_vars
new file mode 120000
index 00000000..5ce8257f
--- /dev/null
+++ b/ansible/roles/helm/molecule/ubuntu/group_vars
@@ -0,0 +1 @@
+../default/group_vars/ \ No newline at end of file
diff --git a/ansible/roles/helm/molecule/ubuntu/molecule.yml b/ansible/roles/helm/molecule/ubuntu/molecule.yml
new file mode 100644
index 00000000..a375a32d
--- /dev/null
+++ b/ansible/roles/helm/molecule/ubuntu/molecule.yml
@@ -0,0 +1,38 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04}
+ pre_build_image: True
+ privileged: true
+ override_command: False
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+ inventory:
+ group_vars:
+ all:
+ app_name: onap
+ app_data_path: "/opt/{{ app_name }}"
+ helm_bin_dir: /usr/local/bin
+scenario:
+ name: ubuntu
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ directory: ../default/tests
diff --git a/ansible/roles/package-repository-check/tasks/Debian.yml b/ansible/roles/package-repository-check/tasks/Debian.yml
new file mode 100644
index 00000000..8fb37848
--- /dev/null
+++ b/ansible/roles/package-repository-check/tasks/Debian.yml
@@ -0,0 +1,34 @@
+---
+- name: verify
+ block:
+ # Clean cache prior to refreshing
+ - name: Clean apt cache
+ command: apt clean && apt autoclean
+ args:
+ warn: false
+ # Refresh cache to ensure repo is reachable
+ - name: Update apt cache
+ apt:
+ update_cache: yes
+ state: latest
+ tags:
+ - skip_ansible_lint # Prevent '[403] Package installs should not use latest' ansible lint task rule
+ rescue:
+ - name: Fail if apt cache updating failed
+ fail:
+ msg: "Couldn't refresh apt cache, repositories not configured properly. Check ansible logs for details."
+ become: true
+
+- name: Install resolvconf
+ package:
+ name: resolvconf
+ state: present
+
+- name: Add a line to a file if the file does not exist, without passing regexp
+ lineinfile:
+ path: /etc/resolvconf/resolv.conf.d/head
+ line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
+ create: yes
+
+- name: Make DNS settings permanent
+ command: service resolvconf restart
diff --git a/ansible/roles/package-repository-check/tasks/main.yml b/ansible/roles/package-repository-check/tasks/main.yml
index ac63eceb..11fb3296 100644
--- a/ansible/roles/package-repository-check/tasks/main.yml
+++ b/ansible/roles/package-repository-check/tasks/main.yml
@@ -9,4 +9,3 @@
#Set of tasks designated to failing fast if configured repos are not functioning properly
- include_tasks: "{{ ansible_os_family }}.yml"
- when: ansible_os_family == 'RedHat'