From 672cbe3f8c9194e55f2de38d97238d5a8c855056 Mon Sep 17 00:00:00 2001 From: Daroc Alden Date: Tue, 10 May 2016 18:37:35 -0400 Subject: [PATCH 1/2] Removed use of IPs for hosts. Made /etc/hosts a managed file. --- common/files/hosts | 3 +++ common/init.sls | 19 ++++++++++++------- common/map.jinja | 9 --------- 3 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 common/files/hosts diff --git a/common/files/hosts b/common/files/hosts new file mode 100644 index 00000000..55eb3dc3 --- /dev/null +++ b/common/files/hosts @@ -0,0 +1,3 @@ +127.0.0.1 localhost +::1 localhost +255.255.255.255 broadcasthost diff --git a/common/init.sls b/common/init.sls index 4963ba0a..2326ff59 100644 --- a/common/init.sls +++ b/common/init.sls @@ -40,16 +40,21 @@ servo: - shell: /bin/bash - home: {{ common.servo_home }} -{% for hostname, ip in common.hosts.items() %} -host-{{ hostname }}: - host.present: - - name: {{ hostname }} - - ip: {{ ip }} -{% endfor %} - {% for ssh_user in common.ssh_users %} sshkey-{{ ssh_user }}: ssh_auth.present: - user: root - source: salt://{{ tpldir }}/ssh/{{ ssh_user }}.pub {% endfor %} + +hosts-file: + file.managed: + - name: /etc/hosts + - user: root + - mode: 644 + {% if grains['os'] == 'MacOS' %} + - group: wheel + {% elif grains['os'] == 'Ubuntu' %} + - group: root" + {% endif %} + - location: /common/files/hosts diff --git a/common/map.jinja b/common/map.jinja index 52f99f44..f13d97b6 100644 --- a/common/map.jinja +++ b/common/map.jinja @@ -2,15 +2,6 @@ set common = salt['grains.filter_by']({ 'defaults': { 'servo_home': '/home/servo', - 'hosts': { - 'servo-master': '96.126.125.232', - 'servo-linux1': '66.228.48.56', - 'servo-linux2': '173.255.201.95', - 'servo-linux3': '45.79.167.177', - 'servo-linux-android1': '72.14.176.110', - 'servo-mac1': '208.52.161.130', - 'servo-mac3': '63.135.170.19', - }, 'ssh_users': [ 'ajeffrey', 'aneeshusa', From 71cbb62c57fb19f414a16bf1d21d27c5cf68947d Mon Sep 17 00:00:00 2001 From: Daroc Alden Date: Thu, 9 Jun 2016 00:05:52 +0000 Subject: [PATCH 2/2] Made changes suggested in comments. --- common/init.sls | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/init.sls b/common/init.sls index 2326ff59..acba0c39 100644 --- a/common/init.sls +++ b/common/init.sls @@ -47,14 +47,13 @@ sshkey-{{ ssh_user }}: - source: salt://{{ tpldir }}/ssh/{{ ssh_user }}.pub {% endfor %} -hosts-file: +/etc/hosts: file.managed: - - name: /etc/hosts - user: root - mode: 644 {% if grains['os'] == 'MacOS' %} - group: wheel {% elif grains['os'] == 'Ubuntu' %} - - group: root" + - group: root {% endif %} - - location: /common/files/hosts + - source: salt://{{ tlpdir }}/files/hosts