install_ipa_client.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 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: Uninstall client if already installed
  27. command: ipa-client-install --uninstall -U
  28. changed_when: false
  29. failed_when: false
  30. - name: Install ipa client in CentOS 7.9
  31. command: >-
  32. ipa-client-install --domain '{{ hostvars['127.0.0.1']['domain_name'] }}' --server '{{ hostvars[groups['manager'][0]]['server_hostname'] }}'
  33. --principal admin --password '{{ hostvars['127.0.0.1']['ipa_admin_password'] }}' --force-join --enable-dns-updates --force-ntpd -U
  34. changed_when: true
  35. no_log: true
  36. when:
  37. - ( ansible_distribution | lower == os_centos )
  38. - ( ansible_distribution_version < os_version )
  39. - name: Install ipa client in Rocky 8.4
  40. command: >-
  41. ipa-client-install --domain '{{ hostvars['127.0.0.1']['domain_name'] }}' --server '{{ hostvars[groups['manager'][0]]['server_hostname'] }}'
  42. --principal admin --password '{{ hostvars['127.0.0.1']['ipa_admin_password'] }}' --force-join --enable-dns-updates --no-ntp -U
  43. changed_when: true
  44. no_log: true
  45. when:
  46. - ( ansible_distribution | lower == os_centos ) or
  47. ( ansible_distribution | lower == os_rocky )
  48. - ( ansible_distribution_version >= os_version )