Selaa lähdekoodia

Merge pull request #780 from abhishek-sa1/idrac

Issue #778: iDRAC changes for nic activation
Sujit Jadhav 3 vuotta sitten
vanhempi
commit
3e33869d19

+ 7 - 0
control_plane/roles/control_plane_customiso/files/temp_leap15.xml

@@ -34,6 +34,13 @@
       <hostname>localhost.localdomain</hostname>
       <resolv_conf_policy>auto</resolv_conf_policy>
     </dns>
+    <interfaces config:type="list">
+      <interface>
+        <bootproto>dhcp</bootproto>
+        <name>link</name>
+        <startmode>auto</startmode>
+      </interface>
+    </interfaces>
   </networking>
   <services-manager t="map">
     <services t="map">

+ 4 - 16
control_plane/roles/control_plane_customiso/tasks/check_prerequisites.yml

@@ -14,46 +14,37 @@
 ---
 
 - name: Include control_plane_common vars
-  include_vars: ../../control_plane_common/vars/main.yml
-  tags: install
+  include_vars: ../../control_plane_common/vars/main.yml  
 
 - name: Include provision_cobbler vars
   include_vars: ../../provision_cobbler/vars/main.yml
-  tags: install
 
 - name: Install xorriso package - rocky
   package:
     name: "{{ iso_package }}"
     state: present
-  tags: install
-  when:
-    - ansible_distribution | lower == os_supported_centos or
-      ansible_distribution | lower == os_supported_rocky
+  when: os_supported_leap not in mgmt_os
 
 - name: Install xorriso package - leap
   zypper:
     name: "{{ iso_package }}"
     state: present
-  tags: install
-  when: os_supported_leap in ansible_distribution | lower
+  when: os_supported_leap in mgmt_os
 
 - name: Install ansible-galaxy modules
   command: ansible-galaxy collection install {{ item }}
   changed_when: true
-  tags: install
   with_items: "{{ idrac_collections }}"
 
 - name: Install omsdk using pip
   pip:
     name: omsdk
     state: present
-  tags: install
 
 - name: Check iso mount folder
   stat:
     path: "{{ iso_mount_path }}{{ grub_cfg_path }}"
   register: check_mount_iso
-  tags: install
 
 - name: Include provision_cobbler vars
   include_tasks: ../../provision_cobbler/tasks/mount_iso.yml
@@ -64,7 +55,6 @@
     path: "{{ iso_mount_path }}{{ grub_cfg_path }}"
   register: recheck_mount_iso
   when: not check_mount_iso.stat.exists
-  tags: install
 
 - name: Incorrect iso mount
   fail:
@@ -72,8 +62,7 @@
   when:
     - not check_mount_iso.stat.exists
     - not recheck_mount_iso.stat.exists
-  register: iso_mount_fail
-  tags: install
+  register: iso_mount_fail 
 
 - name: Copy management station ip to {{ management_station_ip_file }}
   lineinfile:
@@ -81,4 +70,3 @@
     line: "{{ mngmnt_network_ip }}"
     mode: "{{ file_permission }}"
     create: yes
-  tags: install

+ 0 - 3
control_plane/roles/control_plane_customiso/tasks/create_unattended_iso_centos.yml

@@ -19,7 +19,6 @@
     -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -J -R -V "CentOS 7 x86_64"  {{ tmp_iso_dir }}
   changed_when: true
   register: centos_iso_status
-  tags: install
   args:
     chdir: "{{ tmp_iso_dir }}"
 
@@ -30,10 +29,8 @@
       - custom_iso_success_keyword2 in centos_iso_status.stderr
     success_msg: "{{ custom_iso_success_msg }}"
     fail_msg: "{{ custom_iso_fail_msg }}"
-  tags: install
 
 - name: Remove the kickstart file
   file:
     path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
     state: absent
-  tags: install

+ 0 - 3
control_plane/roles/control_plane_customiso/tasks/create_unattended_iso_leap.yml

@@ -19,7 +19,6 @@
     -c boot/x86_64/loader/boot.cat -eltorito-alt-boot -e boot/x86_64/efi -no-emul-boot -o {{ nfs_share_offline_repo }}/{{ leap_iso_filename }} {{ tmp_iso_dir }}
   changed_when: true
   register: leap_iso_status
-  tags: install
   args:
     chdir: "{{ tmp_iso_dir }}"
 
@@ -30,10 +29,8 @@
       - custom_iso_success_keyword2 in leap_iso_status.stderr
     success_msg: "{{ custom_iso_success_msg }}"
     fail_msg: "{{ custom_iso_fail_msg }}"
-  tags: install
   
 - name: Remove the kickstart file
   file:
     path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
     state: absent
-  tags: install

+ 0 - 3
control_plane/roles/control_plane_customiso/tasks/create_unattended_iso_rocky.yml

@@ -24,7 +24,6 @@
     -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -J -R -V {{ rocky_profile_name.stdout.split(' ')[4] | replace("'","") }}  {{ tmp_iso_dir }}
   changed_when: true
   register: rocky_iso_status
-  tags: install
   args:
     chdir: "{{ tmp_iso_dir }}"
 
@@ -35,10 +34,8 @@
       - custom_iso_success_keyword2 in rocky_iso_status.stderr
     success_msg: "{{ custom_iso_success_msg }}"
     fail_msg: "{{ custom_iso_fail_msg }}"
-  tags: install
 
 - name: Remove the kickstart file
   file:
     path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
     state: absent
-  tags: install

+ 41 - 46
control_plane/roles/control_plane_customiso/tasks/edit_iso_config.yml

@@ -17,7 +17,6 @@
   command: openssl rand -base64 12
   changed_when: false
   register: generate_random_phrase
-  tags: install
   no_log: true
 
 - name: Encrypt login password
@@ -25,21 +24,18 @@
   no_log: true
   changed_when: false
   register: encrypt_login_pass
-  tags: install
 
 - name: Create a tmp iso directory
   file:
     path: "{{ tmp_iso_dir }}"
     state: directory
     mode: "{{ file_permission }}"
-  tags: install
 
 - name: Copy files to tmp folder
   command:  rsync -AHPSXav {{ iso_mount_path }} {{ tmp_iso_dir }}
   changed_when: true
   args:
-    warn: false
-  tags: install
+    warn: false 
 
 - name: Kickstart file changes rocky and centos
   block:
@@ -47,28 +43,24 @@
       block:
         - name: Set centos kickstart file name
           set_fact:
-            idrac_kickstart_file: "{{ idrac_centos_ks }}"
-          tags: install
+            idrac_kickstart_file: "{{ idrac_centos_ks }}"     
 
         - name: Remove the kickstart file if exists
           file:
             path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
-            state: absent
-          tags: install
+            state: absent     
 
         - name: Create the centos kickstart file
           copy:
             src: "{{ role_path }}/files/temp_centos7.cfg"
             dest: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
-            mode: "{{ file_permission }}"
-          tags: install
+            mode: "{{ file_permission }}"       
 
-        - name: Configure kickstart file centos - nic
+        - name: Configure kickstart file - nic
           lineinfile:
             path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
             insertafter: '^network  --bootproto=dhcp --device=link --onboot=on --activate'
-            line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'
-          tags: install
+            line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'    
           with_items: "{{ centos_host_nic }}"
       when: provision_os == os_supported_centos
 
@@ -76,28 +68,24 @@
       block:
         - name: Set rocky kickstart file name
           set_fact:
-            idrac_kickstart_file: "{{ idrac_rocky_ks }}"
-          tags: install
+            idrac_kickstart_file: "{{ idrac_rocky_ks }}"      
 
         - name: Remove the kickstart file if exists
           file:
             path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
-            state: absent
-          tags: install
+            state: absent        
 
         - name: Create the rocky kickstart file
           copy:
             src: "{{ role_path }}/files/temp_rocky8.cfg"
             dest: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
-            mode: "{{ file_permission }}"
-          tags: install
+            mode: "{{ file_permission }}"       
 
-        - name: Configure kickstart file rocky - nic
+        - name: Configure kickstart file - nic
           lineinfile:
             path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
             insertafter: '^network  --bootproto=dhcp --device=link --onboot=on --activate'
-            line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'
-          tags: install
+            line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'         
           with_items: "{{ rocky_host_nic }}"
       when: provision_os == os_supported_rocky
 
@@ -106,29 +94,25 @@
         path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         regexp: '^rootpw --iscrypted ks_password'
         replace: 'rootpw --iscrypted {{ encrypt_login_pass.stdout }}'
-      no_log: true
-      tags: install
+      no_log: true     
 
     - name: Configure kickstart file - timezone
       replace:
         path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         regexp: '^timezone --utc ks_timezone'
-        replace: 'timezone --utc {{ timezone }}'
-      tags: install
+        replace: 'timezone --utc {{ timezone }}'  
 
     - name: Configure kickstart file - language
       replace:
         path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         regexp: '^lang ks_language'
-        replace: 'lang {{ language }}'
-      tags: install
+        replace: 'lang {{ language }}' 
 
     - name: Copy kickstart file to iso mount path
       copy:
         src: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         dest: "{{ tmp_iso_dir }}{{ idrac_kickstart_file }}"
-        mode: preserve
-      tags: install
+        mode: preserve   
 
     - name: Remove ^M characters
       command: dos2unix {{ tmp_iso_dir }}{{ idrac_kickstart_file }}
@@ -142,8 +126,7 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "append initrd=initrd.img", replace: "append initrd=initrd.img ks=cdrom:/{{ idrac_kickstart_file }}" }
-        - { regexp: "rd.live.check quiet", replace: "" }
-      tags: install
+        - { regexp: "rd.live.check quiet", replace: "" }    
 
     - name: Edit grub.cfg
       replace:
@@ -154,8 +137,7 @@
         - { regexp: "timeout=60", replace: "timeout=5" }
         - { regexp: "kernel /images/pxeboot/vmlinuz", replace: "kernel /images/pxeboot/vmlinuz ks=cdrom:/{{ idrac_kickstart_file }}" }
         - { regexp: "linuxefi /images/pxeboot/vmlinuz", replace: "linuxefi /images/pxeboot/vmlinuz ks=cdrom:/{{ idrac_kickstart_file }}" }
-        - { regexp: "rd.live.check quiet", replace: "" }
-      tags: install
+        - { regexp: "rd.live.check quiet", replace: "" } 
   when:
     - provision_os == os_supported_rocky or
       provision_os == os_supported_centos
@@ -164,37 +146,51 @@
   block:
     - name: Set leap kickstart file name
       set_fact:
-        idrac_kickstart_file: "{{ idrac_leap_ks }}"
-      tags: install
+        idrac_kickstart_file: "{{ idrac_leap_ks }}"  
   
     - name: Create the leap kickstart file
       copy:
         src: "{{ role_path }}/files/temp_leap15.xml"
         dest: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
-        mode: "{{ file_permission }}"
-      tags: install
+        mode: "{{ file_permission }}"    
 
     - name: Configure kickstart file - Password
       replace:
         path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         regexp: '      <user_password>ks_password</user_password>'
         replace: '      <user_password>{{ encrypt_login_pass.stdout }}</user_password>'
-      no_log: true
-      tags: install
+      no_log: true  
 
     - name: Configure kickstart file - timezone
       replace:
         path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         regexp: '    <timezone>ks_timezone</timezone>'
-        replace: '    <timezone>{{ timezone }}</timezone>'
-      tags: install
+        replace: '    <timezone>{{ timezone }}</timezone>'  
+    
+    - name: Configure kickstart file - nic
+      lineinfile:
+        path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
+        insertafter: '      </interface>'
+        line: >4
+                  <interface>
+                    <bootproto>dhcp</bootproto>
+                    <name>{{ item }}</name>
+                    <startmode>auto</startmode>
+                  </interface>
+      with_items: "{{ centos_host_nic }}"
+
+    - name: Remove blank lines
+      lineinfile:
+        path: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
+        regexp: '^\s*$'
+        state: absent
+      changed_when: false
 
     - name: Copy kickstart file to iso mount path
       copy:
         src: "{{ role_path }}/files/{{ idrac_kickstart_file }}"
         dest: "/tmp/leap/{{ idrac_kickstart_file }}"
-        mode: preserve
-      tags: install
+        mode: preserve  
 
     - name: Edit grub.cfg
       replace:
@@ -203,5 +199,4 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "  timeout=60", replace: "  timeout=5" }
-      tags: install
   when: provision_os == os_supported_leap

+ 2 - 2
control_plane/roles/control_plane_customiso/vars/main.yml

@@ -20,8 +20,8 @@ iso_mount_path: /mnt/{{ provision_os }}/
 iso_mount_check_fail_msg: "ISO file not mounted successfully. Ensure /mnt/{{ provision_os }} path is mounted with {{ provision_os }} ISO file."
 management_station_ip_file: "management_station_ip.txt"
 idrac_collections:
-  - community.general
-  - dellemc.openmanage
+  - community.general:4.4.0
+  - dellemc.openmanage:4.4.0
 iso_package: xorriso
 
 # Usage: edit_iso_config.yml

+ 10 - 5
control_plane/roles/webui_awx/files/requirements.yml

@@ -1,7 +1,12 @@
 ---
 collections:
-  - community.general
-  - dellemc.openmanage
-  - dellemc.os10
-  - kubernetes.core
-  - community.grafana
+  - name: community.general
+    version: 4.4.0
+  - name: dellemc.openmanage
+    version: 4.4.0
+  - name: dellemc.os10
+    version: 1.1.1
+  - name: kubernetes.core
+    version: 2.2.3
+  - name: community.grafana
+    version: 1.3.0

+ 3 - 3
control_plane/roles/webui_grafana/vars/main.yml

@@ -1,4 +1,4 @@
-#  Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
+#  Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
 #
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
 
 # Usage: pre-requisites.yml
 collections_name:
-  - kubernetes.core
-  - community.grafana
+  - kubernetes.core:2.2.3
+  - community.grafana:1.3.0
 directory_mode: '0774'
 
 # Usage: secrets.yml