From 3d91b4d7528060d2634a7c59925fe0d60089f024 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 17 Jun 2020 09:16:08 -0500 Subject: [PATCH] Configure hostnames oh boy here we go --- roles/common/tasks/main.yml | 12 +++++++++ roles/common/templates/hosts | 10 ++++++++ roles/desktop/tasks/main.yml | 1 - roles/desktop/templates/hosts | 48 ----------------------------------- 4 files changed, 22 insertions(+), 49 deletions(-) create mode 100644 roles/common/templates/hosts delete mode 100644 roles/desktop/templates/hosts diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 97f5ed8..bacc1a1 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -21,6 +21,16 @@ - openssh-server - python3-apt - vim + - name: Copy system configs + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + loop: + - { src: "hosts", dest: "/etc/hosts", mode: "0644" } + - name: Set hostname + hostname: + name: "{{ inventory_hostname }}" - name: Set timezone timezone: name: "America/Chicago" @@ -49,4 +59,6 @@ - "97-overlayroot" - name: Configure Ansible user include_tasks: ansibleuser.yml + - name: Configure hostname + include_tasks: hostname.yml become: yes diff --git a/roles/common/templates/hosts b/roles/common/templates/hosts new file mode 100644 index 0000000..8b3937d --- /dev/null +++ b/roles/common/templates/hosts @@ -0,0 +1,10 @@ +127.0.0.1 localhost +127.0.0.1 {{ ansible_facts['nodename'] }} + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts diff --git a/roles/desktop/tasks/main.yml b/roles/desktop/tasks/main.yml index db3f390..1d0f846 100644 --- a/roles/desktop/tasks/main.yml +++ b/roles/desktop/tasks/main.yml @@ -23,7 +23,6 @@ dest: "{{ item.dest }}" mode: "{{ item.mode }}" loop: - - { src: "hosts", dest: "/etc/hosts", mode: "0644" } - { src: "sshd_config", dest: "/etc/ssh/sshd_config", mode: "0644" } - { src: "nomouseaccel.conf", dest: "/etc/X11/xorg.conf.d/90-mouse-acceleration.conf", mode: "0644" } - { src: "i3.desktop", dest: "/usr/share/xsessions/i3-custom.desktop", mode: "0644" } diff --git a/roles/desktop/templates/hosts b/roles/desktop/templates/hosts deleted file mode 100644 index b38ff78..0000000 --- a/roles/desktop/templates/hosts +++ /dev/null @@ -1,48 +0,0 @@ -127.0.0.1 localhost -127.0.0.1 {{ ansible_facts['nodename'] }} - -# Fuck off, Spotify -#0.0.0.0 adclick.g.doublecklick.net -#0.0.0.0 adeventtracker.spotify.com -#0.0.0.0 ads-fa.spotify.com -#0.0.0.0 analytics.spotify.com -#0.0.0.0 audio2.spotify.com -#0.0.0.0 b.scorecardresearch.com -#0.0.0.0 bounceexchange.com -#0.0.0.0 bs.serving-sys.com -#0.0.0.0 content.bitsontherun.com -#0.0.0.0 core.insightexpressai.com -#0.0.0.0 crashdump.spotify.com -#0.0.0.0 d2gi7ultltnc2u.cloudfront.net -#0.0.0.0 d3rt1990lpmkn.cloudfront.net -#0.0.0.0 desktop.spotify.com -#0.0.0.0 doubleclick.net -#0.0.0.0 ds.serving-sys.com -#0.0.0.0 googleadservices.com -#0.0.0.0 googleads.g.doubleclick.net -#0.0.0.0 gtssl2-ocsp.geotrust.com -#0.0.0.0 js.moatads.com -#0.0.0.0 log.spotify.com -#0.0.0.0 media-match.com -#0.0.0.0 omaze.com -#0.0.0.0 open.spotify.com -#0.0.0.0 pagead46.l.doubleclick.net -#0.0.0.0 pagead2.googlesyndication.com -#0.0.0.0 partner.googleadservices.com -#0.0.0.0 pubads.g.doubleclick.net -#0.0.0.0 redirector.gvt1.com -#0.0.0.0 s0.2mdn.net -#0.0.0.0 securepubads.g.doubleclick.net -#0.0.0.0 spclient.wg.spotify.com -#0.0.0.0 tpc.googlesyndication.com -#0.0.0.0 v.jwpcdn.com -#0.0.0.0 video-ad-stats.googlesyndication.com -#0.0.0.0 weblb-wg.gslb.spotify.com -#0.0.0.0 www.googleadservices.com -#0.0.0.0 www.googletagservices.com -#0.0.0.0 www.omaze.com - -# The following lines are desirable for IPv6 capable hosts -::1 localhost ip6-localhost ip6-loopback -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters