Преглед изворни кода

Issue #610: Updated provision_password.yml

Signed-off-by: abhishek-s-a <a_sa@dellteam.com>
abhishek-s-a пре 3 година
родитељ
комит
bc428faf22
1 измењених фајлова са 65 додато и 25 уклоњено
  1. 65 25
      control_plane/roles/provision_cobbler/tasks/provision_password.yml

+ 65 - 25
control_plane/roles/provision_cobbler/tasks/provision_password.yml

@@ -38,19 +38,55 @@
   no_log: true
   tags: install
 
-- name: Create the kickstart file
-  copy:
-    src: "{{ role_path }}/files/temp_centos7.ks"
-    dest: "{{ role_path }}/files/centos7.ks"
-    mode: 0775
-  tags: install
+- name: Kickstart configuration - centos
+  block:
+    - name: Create the kickstart file
+      copy:
+        src: "{{ role_path }}/files/temp_centos7.ks"
+        dest: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        mode: 0775
+      tags: install
 
-- name: Configure kickstart file- IP
-  replace:
-    path: "{{ role_path }}/files/centos7.ks"
-    regexp: '^url --url http://ip/cblr/links/CentOS7-x86_64/'
-    replace: url --url http://{{ hpc_ip }}/cblr/links/CentOS7-x86_64/
-  tags: install
+    - name: Configure kickstart file - IP
+      replace:
+        path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        regexp: '^url --url http://ip/cblr/links/centos-x86_64/'
+        replace: url --url http://{{ hpc_ip }}/cblr/links/CentOS7-x86_64/
+      tags: install
+
+    - name: Configure kickstart file - nic
+      lineinfile:
+        path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        insertafter: '^network  --bootproto=dhcp --device=link --onboot=on --activate'
+        line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'
+      tags: install
+      with_items: "{{ centos_host_nic }}"
+  when: provision_os == os_supported_centos
+
+- name: Kickstart configuration - rocky
+  block:
+    - name: Create the kickstart file
+      copy:
+        src: "{{ role_path }}/files/temp_rocky8.ks"
+        dest: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        mode: 0775
+      tags: install
+
+    - name: Configure kickstart file - IP
+      replace:
+        path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        regexp: '^url --url http://ip/cblr/links/rocky-x86_64/'
+        replace: url --url http://{{ hpc_ip }}/cblr/links/Rocky8-x86_64/
+      tags: install
+
+    - name: Configure kickstart file - nic
+      lineinfile:
+        path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+        insertafter: '^network  --bootproto=dhcp --device=link --onboot=on --activate'
+        line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'
+      tags: install
+      with_items: "{{ rocky_host_nic }}"
+  when: provision_os == os_supported_rocky
 
 - name: Random phrase generation
   command: openssl rand -base64 12
@@ -80,25 +116,29 @@
   no_log: true
   tags: install
 
-- name: Configure kickstart file- Password
+- name: Configure kickstart file - Password
   replace:
-    path: "{{ role_path }}/files/centos7.ks"
-    regexp: '^rootpw --iscrypted password'
+    path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+    regexp: '^rootpw --iscrypted ks_password'
     replace: 'rootpw --iscrypted {{ login_pass.stdout }}'
   no_log: true
   tags: install
 
-- name: Configure kickstart file- nic
-  lineinfile:
-    path: "{{ role_path }}/files/centos7.ks"
-    insertafter: '^network  --bootproto=dhcp --device=link --onboot=on --activate'
-    line: 'network  --bootproto=dhcp --device={{ item }} --onboot=on --activate'
-  tags: install
-  with_items: "{{ host_nic }}"
-
-- name: Configure kickstart file- timezone
+- name: Configure kickstart file - timezone
   replace:
-    path: "{{ role_path }}/files/centos7.ks"
+    path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
     regexp: '^timezone --utc ks_timezone'
     replace: 'timezone --utc {{ timezone }}'
   tags: install
+
+- name: Configure kickstart file - language
+  replace:
+    path: "{{ role_path }}/files/{{ cobbler_kickstart_file }}"
+    regexp: '^lang ks_language'
+    replace: 'lang {{ language }}'
+  tags: install
+
+- name: Remove ^M characters
+  command: dos2unix {{ role_path }}/files/{{ cobbler_kickstart_file }}
+  changed_when: false
+  failed_when: false