]> git.somenet.org - root/pub/somesible.git/blob - roles/base/hostname/tasks/main.yml
roles/service/nextcloud/defaults
[root/pub/somesible.git] / roles / base / hostname / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: set hostname
9   hostname: name="{{inventory_hostname}}"
10   when: inventory_hostname != "localhost"
11
12
13 - name: update /etc/hosts
14   template:
15     src: "{{item}}"
16     dest: "/etc/hosts"
17     mode: 0755
18     owner: "root"
19     group: "root"
20   with_first_found:
21     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/hosts.j2"
22     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/hosts.j2"
23     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/hosts.j2"
24     - "templates/hosts.j2"