docker-compose for mavenrepo
Change-Id: I8d71ea73220480007e75a271c50ce3fcbe9af829
diff --git a/deploy-mavenrepo-playbook.yml b/deploy-mavenrepo-playbook.yml
new file mode 100644
index 0000000..19cd950
--- /dev/null
+++ b/deploy-mavenrepo-playbook.yml
@@ -0,0 +1,20 @@
+---
+# deploy-mavenrepo-playbook.yml
+# Deploys mavenrepo in Docker container on the CORD head node
+
+- name: Include vars
+ hosts: head
+ tasks:
+ - name: Include variables
+ include_vars: "{{ item }}"
+ with_items:
+ - "profile_manifests/{{ cord_profile }}.yml"
+ - profile_manifests/local_vars.yml
+
+- name: Deploy and start mavenrepo
+ hosts: head
+ roles:
+ - mavenrepo-install
+
+
+
diff --git a/roles/mavenrepo-install/defaults/main.yml b/roles/mavenrepo-install/defaults/main.yml
new file mode 100644
index 0000000..8fc31ac
--- /dev/null
+++ b/roles/mavenrepo-install/defaults/main.yml
@@ -0,0 +1,9 @@
+---
+# mavenrepo-install/tasks/main.yml
+
+head_mavenrepo_dir: /opt/mavenrepo
+
+# Docker related settings
+deploy_docker_registry: ""
+deploy_docker_tag: "candidate"
+
diff --git a/roles/mavenrepo-install/tasks/main.yml b/roles/mavenrepo-install/tasks/main.yml
new file mode 100644
index 0000000..3bf606b
--- /dev/null
+++ b/roles/mavenrepo-install/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+# mavenrepo-install/tasks/main.yml
+
+- name: Create mavenrepo directory
+ become: yes
+ file:
+ path: "{{ head_mavenrepo_dir }}"
+ state: directory
+ owner: "{{ ansible_user_id }}"
+ group: "{{ ansible_user_gid }}"
+ mode: 0755
+
+- name: Create docker-compose file for mavenrepo
+ template:
+ src: docker-compose.yml.j2
+ dest: "{{ head_mavenrepo_dir }}/docker-compose.yml"
+ owner: "{{ ansible_user_id }}"
+ group: "{{ ansible_user_gid }}"
+ mode: 0644
+
+- name: Start mavenrepo for onos-apps
+ docker_service:
+ project_name: "mavenrepo"
+ project_src: "{{ head_mavenrepo_dir }}"
+
diff --git a/roles/mavenrepo-install/templates/docker-compose.yml.j2 b/roles/mavenrepo-install/templates/docker-compose.yml.j2
new file mode 100644
index 0000000..1212431
--- /dev/null
+++ b/roles/mavenrepo-install/templates/docker-compose.yml.j2
@@ -0,0 +1,13 @@
+# docker-compose.yml for onos-apps mavenrepo
+version: '2'
+
+services:
+
+ mavenrepo:
+ image: {{ deploy_docker_registry }}opencord/mavenrepo:{{ deploy_docker_tag }}
+ container_name: mavenrepo
+ ports:
+ - "8080:80"
+ restart: unless-stopped
+
+