You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

31 lines
807B

  1. ---
  2. - name: hostname
  3. hostname:
  4. name: "{{inventory_hostname}}"
  5. when: not root_target_directory is defined
  6. - name: hostname file
  7. copy:
  8. content: "{{inventory_hostname}}"
  9. dest: "{{ root_target_directory }}/etc/hostname"
  10. when: root_target_directory is defined
  11. - name: hosts file
  12. file:
  13. path: "{{ root_target_directory }}/etc/hosts"
  14. state: touch
  15. when: root_target_directory is defined
  16. - name: localhost ipv4 entry
  17. lineinfile:
  18. dest: "{{ root_target_directory | default('') }}/etc/hosts"
  19. regexp: '^127\.0\.0\.1'
  20. line: "127.0.0.1 localhost {{inventory_hostname}}"
  21. - name: localhost ipv6 entry
  22. lineinfile:
  23. dest: "{{ root_target_directory | default('') }}/etc/hosts"
  24. regexp: '^::1'
  25. line: "::1 localhost ip6-localhost ip6-loopback {{inventory_hostname}}"