summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/.gitignore1
-rw-r--r--ansible/application/README.md58
-rw-r--r--ansible/setup.yml26
3 files changed, 85 insertions, 0 deletions
diff --git a/ansible/.gitignore b/ansible/.gitignore
new file mode 100644
index 00000000..5cddc2eb
--- /dev/null
+++ b/ansible/.gitignore
@@ -0,0 +1 @@
+ansible_chroot
diff --git a/ansible/application/README.md b/ansible/application/README.md
new file mode 100644
index 00000000..342240be
--- /dev/null
+++ b/ansible/application/README.md
@@ -0,0 +1,58 @@
+# Application specific configuration
+
+This directory is **empty** on purpose in git. Content in this folder is
+placed on installer packaging time and can be modified by user on target
+server where installer package is installed.
+
+## Application configuration
+
+All application related configuration variables are defined in file
+`application_configuration.yml` in this folder. The name of configuration file
+does not matter but it must be given to ansible run as command line variable file.
+
+Example:
+```
+./run_playbook.sh application.yml -i application/hosts.yml -e @application/application_configuration.yml
+```
+
+## Application Helm charts
+
+Application helm charts must be available on infra node before application playbook is executed.
+That folder on infra node is specified within `app_helm_charts_infra_directory` variable.
+
+Helm charts folder name is configured on `application_configuration.yml` file
+with `app_helm_charts_directory` variable - it is the path on remote infrastructure server.
+
+Example:
+```
+app_helm_charts_directory: /opt/application/helm_charts
+```
+
+It is expected that helm charts are available from packaging script as a part of installer SW package.
+Such source directory of helm charts is specified by `app_helm_charts_install_directory` variable
+
+Example:
+```
+app_helm_charts_install_directory: ansible/application/helm_charts/kubernetes
+```
+
+## Application specific roles
+
+Installer supports optional custom pre and post install roles. Custom roles' code folders
+need to be placed to this directory and name of those folders are configured in
+application.yml with variable `application_pre_install_role` and `application_post_install_role`.
+
+Example:
+```
+application_pre_install_role: "{{ project_configuration }}-patch-role"
+```
+
+
+## Inventory hosts
+
+Ansible inventory file is least application specific but in practice example
+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.
diff --git a/ansible/setup.yml b/ansible/setup.yml
new file mode 100644
index 00000000..ec572973
--- /dev/null
+++ b/ansible/setup.yml
@@ -0,0 +1,26 @@
+---
+- hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: "Check and generate key if needed"
+ block:
+ - stat:
+ path: '{{ private_key }}.pub'
+ register: p
+
+ - command: ssh-keygen -f {{ private_key }} -t rsa -N ''
+ when: not p.stat.exists
+ vars:
+ private_key: /root/.ssh/offline_ssh_key
+
+- hosts: all
+ gather_facts: false
+ tasks:
+ - name: Setup authorized_keys file
+ authorized_key:
+ user: root
+ state: present
+ key: "{{ lookup('file', public_key) }}"
+ become: true
+ vars:
+ public_key: /root/.ssh/offline_ssh_key.pub