#####################################
### someone's ansible provisioner ###
#####################################
# Part of: https://git.somenet.org/root/pub/somesible.git
# 2017-2026 by someone <someone@somenet.org>
#
---
- name: set hostname
  hostname: name="{{inventory_hostname}}"
  when: inventory_hostname != "localhost"


- name: update /etc/hosts
  template:
    src: "{{item}}"
    dest: "/etc/hosts"
    mode: 0755
    owner: "root"
    group: "root"
  with_first_found:
    - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/hosts.j2"
    - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/hosts.j2"
    - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/hosts.j2"
    - "templates/hosts.j2"
