install_ipa_server.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. - name: Authenticate as admin
  28. shell: set -o pipefail && echo $'{{ ms_kerberos_admin_password }}' | kinit {{ ms_ipa_admin_username }}
  29. no_log: true
  30. changed_when: false
  31. - name: Replace the /etc/resolv.conf file
  32. copy:
  33. src: "{{ temp_resolv_conf_path }}"
  34. dest: "{{ resolv_conf_path }}"
  35. mode: "{{ file_mode }}"
  36. remote_src: yes
  37. - name: Save the hostname
  38. copy:
  39. dest: "{{ server_file }}"
  40. content: |
  41. ipaddress: "{{ hpc_ip }}"
  42. server_hostname: "{{ server_hostname_ms }}"
  43. server_domain: "{{ domain_name }}"
  44. mode: "{{ file_mode }}"