install_ipa_client.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. - name: Include ipa server variables
  16. include_vars: ../../login_common/vars/main.yml
  17. - name: Fetch hostname
  18. command: hostname
  19. register: loginnode_hostname
  20. changed_when: false
  21. - name: Install freeipa client package
  22. package:
  23. name: "{{ ipa_client_package }}"
  24. state: present
  25. tags: install
  26. - name: Set hostname of ipa server when MS has ipa server installed
  27. set_fact:
  28. required_ipa_admin_pwd: "{{ hostvars['127.0.0.1']['ipa_admin_password'] }}"
  29. required_server_hostname: "{{ hostvars[groups['manager'][0]]['server_hostname'] }}"
  30. required_domain_name: "{{ hostvars['127.0.0.1']['domain_name'] }}"
  31. when: not hostvars['127.0.0.1']['ipa_server_ms']
  32. - name: Set hostname of ipa server when manager node has ipa server installed
  33. set_fact:
  34. required_ipa_admin_pwd: "{{ hostvars['127.0.0.1']['ms_ipa_admin_password'] }}"
  35. required_server_hostname: "{{ hostvars['127.0.0.1']['server_hostname'] }}"
  36. required_domain_name: "{{ hostvars['127.0.0.1']['server_domain'] }}"
  37. when: hostvars['127.0.0.1']['ipa_server_ms']
  38. - name: Uninstall client if already installed
  39. command: ipa-client-install --uninstall -U
  40. changed_when: false
  41. failed_when: false
  42. - name: Install ipa client in CentOS 7.9
  43. command: >-
  44. ipa-client-install --domain '{{ required_domain_name }}' --server '{{ required_server_hostname }}'
  45. --principal admin --password '{{ required_ipa_admin_pwd }}' --force-join --enable-dns-updates --force-ntpd -U
  46. changed_when: true
  47. no_log: true
  48. when:
  49. - ( ansible_distribution | lower == os_centos )
  50. - ( ansible_distribution_version < os_version )
  51. - name: Install ipa client in Rocky 8.4
  52. command: >-
  53. ipa-client-install --domain '{{ required_domain_name }}' --server '{{ required_server_hostname }}'
  54. --principal admin --password '{{ required_ipa_admin_pwd }}' --force-join --enable-dns-updates --no-ntp -U
  55. changed_when: true
  56. no_log: true
  57. when:
  58. - ( ansible_distribution | lower == os_centos ) or
  59. ( ansible_distribution | lower == os_rocky )
  60. - ( ansible_distribution_version >= os_version )