From e27c8503b354ab26159c52763f8cef6374f3a568 Mon Sep 17 00:00:00 2001 From: panda Date: Sat, 14 Mar 2020 00:24:47 +0100 Subject: [PATCH] add hostname --- common.yml | 14 +++++++++++++- roles/tincvpn/tasks/main.yml | 4 ++++ variables.yml | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/common.yml b/common.yml index f559f23..19a175d 100644 --- a/common.yml +++ b/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 diff --git a/roles/tincvpn/tasks/main.yml b/roles/tincvpn/tasks/main.yml index 060d087..9b789f9 100644 --- a/roles/tincvpn/tasks/main.yml +++ b/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 }} diff --git a/variables.yml b/variables.yml index c817917..4e216c7 100644 --- a/variables.yml +++ b/variables.yml @@ -1,3 +1,4 @@ users: - commonuser tinc_vpn: vpn +hostname: common_hostname