Add server and client metadata for Rundeck

Change-Id: Iaba8ed9b932cf587db2d27853f37d352f03a98e1
diff --git a/devops_portal/service/rundeck.yml b/devops_portal/service/rundeck.yml
index 1a15473..82fd764 100644
--- a/devops_portal/service/rundeck.yml
+++ b/devops_portal/service/rundeck.yml
@@ -5,8 +5,9 @@
         rundeck:
           configure_proxy: true
           credentials:
-            username: admin
+            username: ${_param:rundeck_admin_username}
             password: ${_param:rundeck_admin_password}
+            token: ${_param:rundeck_admin_token}
           endpoint:
             address: ${_param:haproxy_rundeck_bind_host}
             port: ${_param:haproxy_rundeck_bind_port}
diff --git a/docker/swarm/service/rundeck.yml b/docker/swarm/service/rundeck.yml
index baad94a..cc871dd 100644
--- a/docker/swarm/service/rundeck.yml
+++ b/docker/swarm/service/rundeck.yml
@@ -1,8 +1,7 @@
 parameters:
   _param:
     docker_rundeck_replicas: 1
-    docker_image_rundeck: docker-sandbox.sandbox.mirantis.net/ikharin/oss/rundeck:latest
-    rundeck_admin_password: password
+    docker_image_rundeck: docker-sandbox.sandbox.mirantis.net/ikharin/oss/rundeck:devel
   docker:
     client:
       service:
@@ -17,10 +16,14 @@
           ports:
             - 14440:4440
           volume:
-            etc:
+            framework.properties:
               type: bind
-              source: /srv/volumes/rundeck/etc
-              destination: /etc/rundeck
+              source: /srv/volumes/rundeck/config/framework.properties
+              destination: /etc/rundeck/framework.properties
+            tokens.properties:
+              type: bind
+              source: /srv/volumes/rundeck/config/tokens.properties
+              destination: /etc/rundeck/tokens.properties
             rundeck:
               type: bind
               source: /srv/volumes/rundeck/rundeck
diff --git a/docker/swarm/stack/rundeck.yml b/docker/swarm/stack/rundeck.yml
index b0951a4..f89619a 100644
--- a/docker/swarm/stack/rundeck.yml
+++ b/docker/swarm/stack/rundeck.yml
@@ -1,15 +1,11 @@
 parameters:
   _param:
     docker_rundeck_replicas: 1
-    docker_image_rundeck: docker-sandbox.sandbox.mirantis.net/ikharin/oss/rundeck:latest
-    rundeck_admin_password: password
+    docker_image_rundeck: docker-sandbox.sandbox.mirantis.net/ikharin/oss/rundeck:devel
   docker:
     client:
       stack:
         rundeck:
-          environment:
-            SERVER_URL: "http://${_param:haproxy_rundeck_bind_host}:${_param:haproxy_rundeck_bind_port}"
-            RUNDECK_ADMIN_PASSWORD: ${_param:rundeck_admin_password}
           service:
             rundeck:
               image: ${_param:docker_image_rundeck}
@@ -20,9 +16,11 @@
               ports:
                 - 14440:4440
               volumes:
-                - /srv/volumes/rundeck/etc:/etc/rundeck
+                - /srv/volumes/rundeck/etc/framework.properties:/etc/rundeck/framework.properties
+                - /srv/volumes/rundeck/etc/tokens.properties:/etc/rundeck/tokens.properties
+                - /srv/volumes/rundeck/etc/realm.properties:/etc/rundeck/realm.properties
+                - /srv/volumes/rundeck/etc/rundeck-config.properties:/etc/rundeck/rundeck-config.properties
                 - /srv/volumes/rundeck/rundeck:/var/rundeck
-                - /srv/volumes/rundeck/mysql:/var/lib/mysql
                 - /srv/volumes/rundeck/log:/var/log/rundeck
                 - /srv/volumes/rundeck/logs:/var/lib/rundeck/logs
                 - /srv/volumes/rundeck/plugins:/opt/rundeck-plugins
diff --git a/rundeck/client/init.yml b/rundeck/client/init.yml
new file mode 100644
index 0000000..31b7ee9
--- /dev/null
+++ b/rundeck/client/init.yml
@@ -0,0 +1,19 @@
+classes:
+  - service.rundeck.client
+parameters:
+  _param:
+    rundeck_client_host: ${_param:haproxy_rundeck_bind_host}
+    rundeck_client_port: ${_param:haproxy_rundeck_bind_port}
+    rundeck_client_https: ${_param:haproxy_rundeck_ssl:enabled}
+    rundeck_client_username: ${_param:rundeck_admin_username}
+    rundeck_client_password: ${_param:rundeck_admin_password}
+  rundeck:
+    client:
+      server:
+        endpoint:
+          host: ${_param:rundeck_client_host}
+          port: ${_param:rundeck_client_port}
+          https: ${_param:rundeck_client_https}
+        credentials:
+          username: ${_param:rundeck_client_username}
+          password: ${_param:rundeck_client_password}
diff --git a/rundeck/client/project/cicd.yml b/rundeck/client/project/cicd.yml
new file mode 100644
index 0000000..e33fcae
--- /dev/null
+++ b/rundeck/client/project/cicd.yml
@@ -0,0 +1,22 @@
+parameters:
+  rundeck:
+    client:
+      project:
+        cicd:
+          description: "CI/CD Runbooks"
+          node:
+            node01:
+              nodename: ${_param:cluster_node01_name}.${_param:cluster_domain}
+              hostname: ${_param:cluster_node01_address}
+              username: ${_param:rundeck_runbook_user}
+              tags: [cicd, docker]
+            node02:
+              nodename: ${_param:cluster_node02_name}.${_param:cluster_domain}
+              hostname: ${_param:cluster_node02_address}
+              username: ${_param:rundeck_runbook_user}
+              tags: [cicd, docker]
+            node03:
+              nodename: ${_param:cluster_node03_name}.${_param:cluster_domain}
+              hostname: ${_param:cluster_node03_address}
+              username: ${_param:rundeck_runbook_user}
+              tags: [cicd, docker]
diff --git a/rundeck/client/runbook.yml b/rundeck/client/runbook.yml
new file mode 100644
index 0000000..cb94025
--- /dev/null
+++ b/rundeck/client/runbook.yml
@@ -0,0 +1,22 @@
+classes:
+  - service.rundeck.common
+parameters:
+  linux:
+    system:
+      user:
+        runbook:
+          enabled: true
+          name: ${_param:rundeck_runbook_user}
+          system: true
+          sudo: true
+          full_name: Rundeck Remote
+          home: /var/lib/runbook
+  openssh:
+    server:
+      enabled: true
+      user:
+        runbook:
+          enabled: true
+          public_keys:
+            - key: ${_param:rundeck_runbook_public_key}
+          user: ${linux:system:user:runbook}
diff --git a/rundeck/server/docker.yml b/rundeck/server/docker.yml
new file mode 100644
index 0000000..3406b6a
--- /dev/null
+++ b/rundeck/server/docker.yml
@@ -0,0 +1,19 @@
+classes:
+  - service.rundeck.common
+  - service.rundeck.server.single
+parameters:
+  rundeck:
+    server:
+      user:
+        uid: 550
+        gid: 550
+      home_dir: /srv/volumes/rundeck
+      root_dir: /srv/volumes/rundeck
+      api:
+        host: ${_param:haproxy_rundeck_bind_host}
+        port: ${_param:haproxy_rundeck_bind_port}
+        https: ${_param:haproxy_rundeck_ssl:enabled}
+      ssh:
+        user: ${_param:rundeck_runbook_user}
+        private_key: ${_param:rundeck_runbook_private_key}
+        public_key: ${_param:rundeck_runbook_public_key}