summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/application/README.md12
-rwxr-xr-xansible/group_vars/all.yml6
-rw-r--r--ansible/rke.yml7
-rw-r--r--ansible/roles/rke/defaults/main.yml40
-rw-r--r--ansible/roles/rke/molecule/default/prepare.yml3
-rw-r--r--ansible/roles/rke/tasks/rke_etcd.yml9
-rw-r--r--ansible/roles/rke/templates/cluster.yml.j27
-rw-r--r--ansible/test/roles/prepare-rke/tasks/infra.yml6
8 files changed, 71 insertions, 19 deletions
diff --git a/ansible/application/README.md b/ansible/application/README.md
index 36f69bd5..0e12da42 100644
--- a/ansible/application/README.md
+++ b/ansible/application/README.md
@@ -1,7 +1,7 @@
# Application specific configuration
This directory is **empty** on purpose in git. Content in this folder is
-populated packaging time (see package.sh/package.conf) and can be modified if needed
+populated in packaging time by build/package.py and can be modified if needed
also on target server where package is installed.
## Application configuration
@@ -29,8 +29,6 @@ Helm charts transfer from packaging up to the target infra server.
Installer supports optional custom pre and post install roles. Custom roles' code folders
are placed into this directory at packaging time and names of those folders shall be configured in
application_configuration.yml with variable `application_pre_install_role` and `application_post_install_role`.
-Note that these directory names must correspond to those configured in APP_CONFIGURATION inside package.conf
-during package build time.
Example:
```
@@ -44,7 +42,7 @@ inventory file in git ansible/inventory/hosts.yml cannot be directly used anyway
and at least ip addresses need to be changed according to target servers after
installer installation and before starting installer execution.
-So it's better to place also hosts.yml to this application directory and edit it here.
-That can be done either at packaging time same way as application_configuration.yml
-or after package has been installed to server where ansible process are run just
-before lauching any playbooks.
+So it's better to place also hosts.yml to this application directory and edit it there.
+That can be done either at packaging time same way as in application_configuration.yml
+or after package has been installed to the install server where ansible process are run just
+before launching any playbooks.
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index d8fe37dd..d3cdfc1d 100755
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -9,14 +9,11 @@
resources_dir:
# tarfile name within resources_dir directory with offline infrastructure binaries.
-# Content of APP_BINARY_RESOURCES_DIR (defined in package.conf) packaged by package.sh to single tar file.
resources_filename:
# tarfile name within resources_dir directory with auxiliary resources.
-# Content of APP_AUX_BINARIES (defined in package.conf) packaged by package.sh to single tar file.
# the purpose of auxiliary resources is to provide user an interface
# to distribute to infra node tar file with application specific files.
-# Docker images in tar format are currently the only supported content of aux_resources package.
aux_resources_filename:
# resources can be exported via nfs
@@ -101,9 +98,6 @@ runtime_images: {}
# Helm repository.
# Content of the folder must be Helm chart directories of the app with Makefile.
# In case of ONAP OOM it would be <oom_repo>/kubernetes folder content.
-# NOTE: This default value should not be changed if not really needed and it
-# must match with the variable "HELM_CHARTS_DIR_IN_PACKAGE" value in package.sh
-# script!
app_helm_charts_install_directory: application/helm_charts
# Specify target dir where helm charts are copied into on infra node.
diff --git a/ansible/rke.yml b/ansible/rke.yml
index 13e7bb5b..ab6c0bb5 100644
--- a/ansible/rke.yml
+++ b/ansible/rke.yml
@@ -2,6 +2,13 @@
- name: Gather facts for all hosts
hosts: all
+- name: Configure etcd (RKE)
+ hosts: kubernetes-etcd
+ roles:
+ - role: rke
+ vars:
+ mode: etcd
+
- name: Configure kubernetes cluster (RKE)
hosts: infrastructure
roles:
diff --git a/ansible/roles/rke/defaults/main.yml b/ansible/roles/rke/defaults/main.yml
index 2f160fc2..d9c044b6 100644
--- a/ansible/roles/rke/defaults/main.yml
+++ b/ansible/roles/rke/defaults/main.yml
@@ -6,6 +6,46 @@ kube_config_dir: "{{ ansible_env.HOME }}/.kube"
cluster_config_dir: "{{ app_data_path }}/cluster"
# Whether dashboard is exposed.
rke_dashboard_exposed: true
+rke_etcd:
+ # By default rke creates bind mount:
+ # /var/lib/etcd -> /var/lib/rancher/etcd
+ # These parameters provide means of modifying it:
+ # - custom bind mount
+ # - option to use volatile storage
+
+ # Custom bind mount
+ #
+ # I did not find a proper way (in the docs) how to override the
+ # defaults so I just abuse the extra_* args for the rke etcd
+ # service. It means that it will create another mount point in the
+ # container and you should use different pathnames than default...
+ #
+ # The custom bind mount is by default disabled.
+ enabled_custom_etcd_storage: false
+
+ # Applicated only if custom mount is enabled.
+ # Paths must be absolute (start with '/')
+ #
+ # Path on the kubernetes/etcd node
+ storage_path: /var/lib/etcd-custom
+ # Path inside the container where it is mounted.
+ storage_mountpoint: /var/lib/rancher/etcd-custom
+
+ # On top of it (with or without custom mount) you can use tmpfs
+ # as a volatile storage.
+ #
+ # CAUTION: This will create temporary filesystem (in the memory)
+ # so if an etcd node will be poweroff then all etcd data will be
+ # lost!!!
+ #
+ # Don't use unless you don't care about your cluster!
+ #
+ # This is intended as an attempt to make deployment little bit
+ # more faster...by default it is disabled.
+ enabled_unsafe_volatile_storage: false
+ # Size of the volatile storage - tmpfs (this will eat your RAM)
+ tmpfs_size: 5G
+
rke:
# rke (rancher) images
etcd: rancher/coreos-etcd:v3.2.24-rancher1
diff --git a/ansible/roles/rke/molecule/default/prepare.yml b/ansible/roles/rke/molecule/default/prepare.yml
index 6bad2b80..b012790a 100644
--- a/ansible/roles/rke/molecule/default/prepare.yml
+++ b/ansible/roles/rke/molecule/default/prepare.yml
@@ -13,3 +13,6 @@
- role: prepare-rke
vars:
mode: infra
+ - role: prepare-kubectl
+ vars:
+ kubectl_install: true
diff --git a/ansible/roles/rke/tasks/rke_etcd.yml b/ansible/roles/rke/tasks/rke_etcd.yml
new file mode 100644
index 00000000..3dddf9e8
--- /dev/null
+++ b/ansible/roles/rke/tasks/rke_etcd.yml
@@ -0,0 +1,9 @@
+---
+- name: "Mount tmpfs as etcd storage - non-persistent data (BEWARE)"
+ mount:
+ path: "{{ rke_etcd.storage_path if rke_etcd.enabled_custom_etcd_storage else '/var/lib/etcd' }}"
+ src: tmpfs
+ fstype: tmpfs
+ opts: "defaults,size={{ rke_etcd.tmpfs_size }},mode=700"
+ state: mounted
+ when: rke_etcd.enabled_unsafe_volatile_storage
diff --git a/ansible/roles/rke/templates/cluster.yml.j2 b/ansible/roles/rke/templates/cluster.yml.j2
index 2012ab92..737d306f 100644
--- a/ansible/roles/rke/templates/cluster.yml.j2
+++ b/ansible/roles/rke/templates/cluster.yml.j2
@@ -25,8 +25,15 @@ nodes:
services:
etcd:
image: ""
+{% if rke_etcd.enabled_custom_etcd_storage %}
+ extra_args:
+ data-dir: "{{ rke_etcd.storage_mountpoint }}"
+ extra_binds:
+ - "{{ rke_etcd.storage_path }}:{{ rke_etcd.storage_mountpoint }}"
+{% else %}
extra_args: {}
extra_binds: []
+{% endif %}
extra_env: []
external_urls: []
ca_cert: ""
diff --git a/ansible/test/roles/prepare-rke/tasks/infra.yml b/ansible/test/roles/prepare-rke/tasks/infra.yml
index e9971f77..6e7bcb96 100644
--- a/ansible/test/roles/prepare-rke/tasks/infra.yml
+++ b/ansible/test/roles/prepare-rke/tasks/infra.yml
@@ -8,9 +8,3 @@
get_url:
url: "https://github.com/rancher/rke/releases/download/v{{ rke_version }}/rke_linux-amd64"
dest: "{{ app_data_path }}/downloads/rke_linux-amd64"
-
-- name: "Install kubectl-{{ kubectl_version }}"
- get_url:
- url: "https://storage.googleapis.com/kubernetes-release/release/v{{ kubectl_version }}/bin/linux/amd64/kubectl"
- dest: "/usr/local/bin/kubectl"
- mode: 0755