install_packages.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: Install packages
  16. package:
  17. name: "{{ ipa_server_packages }}"
  18. state: present
  19. tags: install
  20. - name: Take a backup of /etc/resolv.conf
  21. copy:
  22. src: "{{ resolv_conf_path }}"
  23. dest: "{{ temp_resolv_conf_path }}"
  24. mode: "{{ file_mode }}"
  25. remote_src: yes
  26. - name: Add the domain name in /etc/resolv.conf
  27. lineinfile:
  28. path: "{{ temp_resolv_conf_path }}"
  29. regexp: "^search"
  30. line: "search {{ domain_name }}"
  31. register: replace_output
  32. - name: Add the domain name in /etc/resolv.conf when there is no domain name
  33. lineinfile:
  34. path: "{{ temp_resolv_conf_path }}"
  35. insertafter: "^# Generated by NetworkManager"
  36. line: "search {{ domain_name }}"
  37. when: replace_output.msg | length == 0