|
@@ -0,0 +1,65 @@
|
|
|
+# 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.
|
|
|
+# You may obtain a copy of the License at
|
|
|
+#
|
|
|
+# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
+#
|
|
|
+# Unless required by applicable law or agreed to in writing, software
|
|
|
+# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
+# See the License for the specific language governing permissions and
|
|
|
+# limitations under the License.
|
|
|
+---
|
|
|
+
|
|
|
+- name: Initialize freeipa_status
|
|
|
+ set_fact:
|
|
|
+ freeipa_status: false
|
|
|
+
|
|
|
+- name: Fetch hostname
|
|
|
+ command: hostname
|
|
|
+ register: new_serv_hostname
|
|
|
+ changed_when: false
|
|
|
+
|
|
|
+- name: Set fact for server hostname
|
|
|
+ set_fact:
|
|
|
+ server_hostname_ms: "{{ new_serv_hostname.stdout }}"
|
|
|
+
|
|
|
+- name: Create files directory
|
|
|
+ file:
|
|
|
+ path: "{{ role_path }}/files"
|
|
|
+ state: directory
|
|
|
+ mode: "{{ file_mode }}"
|
|
|
+
|
|
|
+- name: Save the hostname
|
|
|
+ copy:
|
|
|
+ dest: "{{ server_file }}"
|
|
|
+ content: |
|
|
|
+ ipaddress: "{{ public_ip }}"
|
|
|
+ server_hostname: "{{ server_hostname_ms }}"
|
|
|
+ server_domain: "{{ domain_name }}"
|
|
|
+ owner: root
|
|
|
+ mode: "{{ file_mode }}"
|
|
|
+
|
|
|
+- name: Check freeipa ui accessible or not
|
|
|
+ uri:
|
|
|
+ url: "https://{{ server_hostname_ms }}"
|
|
|
+ status_code: "{{ return_status }}"
|
|
|
+ return_content: true
|
|
|
+ register: freeipa_ui_status
|
|
|
+ failed_when: false
|
|
|
+
|
|
|
+- name: Check freeipa admin authentication
|
|
|
+ shell: set -o pipefail && echo $'{{ ipa_admin_password }}' | kinit {{ ipa_admin_username }}
|
|
|
+ register: freeipa_authentication
|
|
|
+ no_log: true
|
|
|
+ changed_when: false
|
|
|
+ failed_when: false
|
|
|
+
|
|
|
+- name: Modify freeipa_status
|
|
|
+ set_fact:
|
|
|
+ freeipa_status: true
|
|
|
+ when:
|
|
|
+ - freeipa_authentication.rc == 0
|
|
|
+ - freeipa_ui_status.status == return_status
|