install_ipa_server.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - block:
  16. - name: Install ipa server in CentOS or Rocky
  17. command: >-
  18. ipa-server-install -n '{{ domain_name }}' --hostname='{{ server_hostname_ms }}' -a '{{ ms_kerberos_admin_password }}'
  19. -p '{{ ms_directory_manager_password }}' -r '{{ realm_name }}' --setup-dns --no-forwarders --no-reverse --no-ntp -U
  20. changed_when: true
  21. no_log: true
  22. register: install_ipa_server
  23. rescue:
  24. - name: Install ipa server failed
  25. fail:
  26. msg: "Error: {{ install_ipa_server.stderr_lines }}"
  27. - block:
  28. - name: Authenticate as admin
  29. shell: set -o pipefail && echo $'{{ ms_kerberos_admin_password }}' | kinit {{ ms_ipa_admin_username }}
  30. no_log: true
  31. changed_when: false
  32. register: authenticate_admin
  33. rescue:
  34. - name: Authenticate as admin failed
  35. fail:
  36. msg: "Error: {{ authenticate_admin.stderr }}"
  37. - name: Replace the /etc/resolv.conf file
  38. copy:
  39. src: "{{ temp_resolv_conf_path }}"
  40. dest: "{{ resolv_conf_path }}"
  41. mode: "{{ file_mode }}"
  42. remote_src: yes
  43. - name: Save the hostname
  44. copy:
  45. dest: "{{ server_file }}"
  46. content: |
  47. ipaddress: "{{ hpc_ip }}"
  48. server_hostname: "{{ server_hostname_ms }}"
  49. server_domain: "{{ domain_name }}"
  50. mode: "{{ file_mode }}"