Browse Source

add hostname

panda 4 years ago
parent
commit
e27c8503b3
3 changed files with 18 additions and 1 deletions
  1. 13 1
      common.yml
  2. 4 0
      roles/tincvpn/tasks/main.yml
  3. 1 0
      variables.yml

+ 13 - 1
common.yml

@@ -4,7 +4,7 @@
   hosts: thismachine
   connection: local
 
-- name: Include all .json and .jsn files in vars/all and all nested directories (2.3)
+- name: Include variables
   include_vars:
     file: "variables.yml"
 
@@ -13,6 +13,18 @@
 #    - testuser
 
   tasks:
+    - name: change hostname to myserver
+      hostname:
+        name: {{ hostname }}
+
+    - name: add myself to /etc/hosts
+      lineinfile:
+        dest: /etc/hosts
+        regexp: '^127\.0\.0\.1[ \t]+localhost'
+        line: '127.0.0.1 localhost {{ hostname }}'
+        state: present
+
+
     - name: Set timezone to Europe/Rome
       timezone:
         name: Europe/Rome

+ 4 - 0
roles/tincvpn/tasks/main.yml

@@ -1,3 +1,7 @@
+- name: Include variables                                                            
+  include_vars:
+    file: "../../../variables.yml"
+
 - name: create tincvpn folder
   file:
     path: /etc/tinc/{{ tinc_vpn }}

+ 1 - 0
variables.yml

@@ -1,3 +1,4 @@
 users:
   - commonuser
 tinc_vpn: vpn
+hostname: common_hostname