noheat: improvements for infra setup and Helm push plugin 45/131345/1
authorRado Chmiel <r.chmiel@partner.samsung.com>
Thu, 27 Jan 2022 11:54:54 +0000 (12:54 +0100)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Fri, 30 Sep 2022 11:25:02 +0000 (13:25 +0200)
* set remote_src in helm installation
* add umount to clean up nfs mountpoint
* fix pip executable error for Ubuntu 20.04
* make separate volume usage for instances optional
* add ability to set public DNS servers to network creation
* change installation method to command since current stable release of kubernetes.core doesnt support versioning
* hardcode helm push plugin version to 0.9.0

Issue-ID: INT-1601
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Change-Id: I5d374db779f6fc1f165eb5efe9b69b8a05c9f388

deployment/noheat/cluster-rke/ansible/roles/setup_helm/tasks/main.yml
deployment/noheat/cluster-rke/ansible/roles/setup_nfs/tasks/main.yml
deployment/noheat/infra-openstack/ansible/create.yml
deployment/noheat/infra-openstack/ansible/group_vars/all.yml.sample
deployment/noheat/infra-openstack/ansible/roles/create_hosts/tasks/create_host.yml
deployment/noheat/infra-openstack/ansible/roles/create_network/tasks/create_network.yml

index c742fff..93787be 100644 (file)
@@ -2,25 +2,23 @@
   get_url:
     url: "https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz"
     dest: "/tmp"
-    mode: '0400'
 
 - name: Unarchive helm
   unarchive:
     src: "/tmp/helm-v{{ helm_version }}-linux-amd64.tar.gz"
     dest: "/tmp/"
-    mode: '0500'
+    remote_src: yes
 
 - name: Copy helm binary to $PATH
   become: yes
   copy:
     src: "/tmp/linux-amd64/helm"
     dest: "/usr/local/bin/"
+    remote_src: yes
     mode: '0555'
 
 - name: Install Helm Push plugin
-  kubernetes.core.helm_plugin:
-    plugin_path: "https://github.com/chartmuseum/helm-push.git"
-    state: present
+  command: helm plugin install --version 0.9.0 https://github.com/chartmuseum/helm-push.git
 
 - name: Install Helm OOM Deploy plugin
   kubernetes.core.helm_plugin:
@@ -36,7 +34,7 @@
   get_url:
     url: "https://raw.githubusercontent.com/helm/chartmuseum/v{{ chartmuseum_version }}/scripts/get-chartmuseum"
     dest: "/tmp/"
-    mode: '0500'
+    mode: '700'
 
 - name: Install chartmuseum
   become: yes
index 398b563..2d8d0b0 100644 (file)
     state: present
   when: nfs_role is defined and nfs_role == "server"
 
+- name: Umount
+  ansible.posix.mount:
+    path: "{{ nfs_mountpoint }}"
+    state: unmounted
+  ignore_errors: yes
+
 - name: Remove leftovers
   file:
     path: "{{ nfs_mountpoint }}"
index 847efa2..825bee3 100644 (file)
@@ -68,6 +68,7 @@
           - openshift
           - pyyaml
           - kubernetes
+        executable: pip3
       become: yes
     - name: Add Ansible collection dependencies
       command: "ansible-galaxy collection install ansible.posix"
index f0e1b00..1b03b06 100644 (file)
@@ -2,6 +2,9 @@
 network:
   name: &network_name "onap_ci_lab"
   cidr: "192.168.1.0/24"
+  dns_servers:
+    # - x.x.x.x
+    # - y.y.y.y
 
 keypair:
   name: &keypair_name "onap_ci_lab"
@@ -28,6 +31,8 @@ operation:
       keypair: *keypair_name
       network: *network_name
       securitygroup: *securitygroup_name
+      boot_from_volume: true
+      terminate_volume: true
       volume_size: 5
 
 cluster:
@@ -39,4 +44,6 @@ cluster:
       keypair: *keypair_name
       network: *network_name
       securitygroup: *securitygroup_name
+      boot_from_volume: true
+      terminate_volume: true
       volume_size: 5
index c217aba..8fa4d07 100644 (file)
@@ -10,8 +10,8 @@
     security_groups:
       - "{{ host.securitygroup }}"
     auto_ip: "{{ host.auto_ip | default(true) }}"
-    boot_from_volume: true
-    terminate_volume: true
+    boot_from_volume: "{{ host.boot_from_volume | default(true) }}"
+    terminate_volume: "{{ host.terminate_volume | default(true) }}"
     volume_size: "{{ host.volume_size | default(10) }}"
     userdata: |
       #cloud-config
index 5d86858..81d8caa 100644 (file)
@@ -4,11 +4,17 @@
     name: "{{ net.name }}"
     state: present
 
+- name: Set nameservers list fact
+  set_fact:
+    dns_ips: "{{ network.dns_servers | list }}"
+  when: network.dns_servers[0] is defined
+
 - name: "Create {{ net.name }} subnet"
   os_subnet:
     name: "{{ net.name }}_subnet"
     network_name: "{{ net.name }}"
     cidr: "{{ net.cidr }}"
+    dns_nameservers: "{{ dns_ips if dns_ips is defined else omit }}"
     state: present
 
 - name: "Create {{ net.name }} router"