Browse Source

Update install_ipa_client.yml

Signed-off-by: abhishek-sa1 <abhishek.sa3@dell.com>
abhishek-sa1 3 years ago
parent
commit
52dc783fef
1 changed files with 15 additions and 3 deletions
  1. 15 3
      roles/login_node/tasks/install_ipa_client.yml

+ 15 - 3
roles/login_node/tasks/install_ipa_client.yml

@@ -27,18 +27,30 @@
     state: present
   tags: install
 
-- name: Set hostname of ipa server when MS has ipa server installed
+- name: Set hostname of ipa server when manager node has ipa server installed
   set_fact:
     required_ipa_admin_pwd: "{{ hostvars['127.0.0.1']['ipa_admin_password'] }}"
     required_server_hostname: "{{ hostvars[groups['manager'][0]]['server_hostname'] }}"
     required_domain_name: "{{ hostvars['127.0.0.1']['domain_name'] }}"
   when: not hostvars['127.0.0.1']['ipa_server_ms']
+  no_log: true
 
-- name: Set hostname of ipa server when manager node has ipa server installed
+- name: Set hostname of ipa server when MS has ipa server installed
   set_fact:
     required_ipa_admin_pwd: "{{ hostvars['127.0.0.1']['ms_ipa_admin_password'] }}"
     required_server_hostname: "{{ hostvars['127.0.0.1']['server_hostname'] }}"
     required_domain_name: "{{ hostvars['127.0.0.1']['server_domain'] }}"
+    ms_ip_address: "{{ hostvars['127.0.0.1']['ipaddress'] }}"
+  when: hostvars['127.0.0.1']['ipa_server_ms']
+  no_log: true
+
+- name: Add host name in hosts file
+  lineinfile:
+    dest: "{{ hosts_file_dest }}"
+    line: "{{ ms_ip_address  }} {{ required_server_hostname }}"
+    state: present
+    create: yes
+    mode: "{{ hosts_file_mode }}"
   when: hostvars['127.0.0.1']['ipa_server_ms']
 
 - name: Uninstall client if already installed
@@ -65,4 +77,4 @@
   when:
     - ( ansible_distribution | lower == os_centos ) or
       ( ansible_distribution | lower == os_rocky )
-    - ( ansible_distribution_version >= os_version )
+    - ( ansible_distribution_version >= os_version )