Add the infrastructure playbook to setup cluster 10/74910/1
authorPetr Ospalý <p.ospaly@partner.samsung.com>
Wed, 19 Dec 2018 13:52:07 +0000 (14:52 +0100)
committerPetr Ospalý <p.ospaly@partner.samsung.com>
Wed, 19 Dec 2018 13:54:52 +0000 (14:54 +0100)
It will make arrangements to make offline
installation possible - especially:
dns handling
nexus repository
package installation

Issue-ID: OOM-1551
Change-Id: I3c60efd413f558454d63d4e79948bcc421f7bcd1
Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
ansible/infrastructure.yml [new file with mode: 0644]

diff --git a/ansible/infrastructure.yml b/ansible/infrastructure.yml
new file mode 100644 (file)
index 0000000..789f871
--- /dev/null
@@ -0,0 +1,71 @@
+---
+- name: Perform common environment setup for nodes
+  hosts: infrastructure, kubernetes
+  tasks:
+    - name: Setup resolv.conf
+      lineinfile:
+        line: "nameserver {{ hostvars[groups.infrastructure[0]].ansible_host }}"
+        path: /etc/resolv.conf
+        state: present
+        insertbefore: BOF
+      become: yes
+    - name: Add application offline rpm repository
+      yum_repository:
+        name: "{{ app_name }}"
+        file: "{{ app_name | lower }}"
+        description: "{{ app_name }} offline repository"
+        baseurl: "{{ 'http://repo.infra-server' if 'infrastructure' not in group_names else 'file://' + app_data_path + '/pkg/rhel' }}"
+        gpgcheck: no
+        enabled: yes
+      when: deploy_rpm_repository
+      become: yes
+
+- name: Setup firewall
+  hosts: infrastructure, kubernetes
+  roles:
+    - role: firewall
+      vars:
+        state: disable
+
+- name: Setup infrastructure servers
+  hosts: infrastructure
+  roles:
+    - certificates
+    - docker
+    - dns
+    - vncserver
+    - role: nexus
+      vars:
+        phase: install
+    - nginx
+  tasks:
+    - name: "wait for nexus to come up"
+      uri:
+        url: "{{ nexus_url }}/service/metrics/healthcheck"
+        user: admin
+        password: admin123
+        force_basic_auth: yes
+        method: GET
+      register: nexus_wait
+      until: not nexus_wait.failed
+      retries: 30
+      delay: 10
+
+- name: Nexus changes in runtime
+  hosts: infrastructure
+  roles:
+    - role: nexus
+      vars:
+        phase: configure
+      when: populate_nexus | bool
+    - role: nexus
+      vars:
+        phase: runtime-populate
+      when: runtime_images is defined
+
+- name: Setup base for Kubernetes nodes
+  hosts: kubernetes
+  roles:
+    - docker
+  tasks:
+    - import_tasks: roles/certificates/tasks/upload_root_ca.yml