install_ipa_server.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright 2021 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. - name: Include common vars
  16. include_vars: ../../login_common/vars/main.yml
  17. - name: Fetch hostname
  18. command: hostname
  19. register: new_serv_hostname
  20. changed_when: false
  21. - name: Set fact for server hostname
  22. set_fact:
  23. server_hostname: "{{ new_serv_hostname.stdout }}"
  24. - name: Uninstall server if it is already installed
  25. command: ipa-server-install --uninstall -U
  26. changed_when: false
  27. failed_when: false
  28. - name: Install ipa server
  29. command: >-
  30. ipa-server-install -n '{{ hostvars['127.0.0.1']['domain_name'] }}' --hostname='{{ server_hostname }}' -a '{{ hostvars['127.0.0.1']['ipa_admin_password'] }}'
  31. -p '{{ hostvars['127.0.0.1']['directory_manager_password'] }}' -r '{{ hostvars['127.0.0.1']['realm_name'] }}' --setup-dns --auto-forwarders --auto-reverse -U
  32. changed_when: true
  33. no_log: true
  34. - name: Authenticate as admin
  35. shell: set -o pipefail && echo $'{{ hostvars['127.0.0.1']['ipa_admin_password'] }}' | kinit admin
  36. no_log: true
  37. changed_when: false
  38. - name: Replace the /etc/resolv.conf file
  39. copy:
  40. src: "{{ temp_resolv_conf_path }}"
  41. dest: "{{ resolv_conf_path }}"
  42. mode: "{{ file_mode }}"
  43. remote_src: yes