]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Remove localdomain from rhel7 hostnames on setup
authorAndrew Schoen <aschoen@redhat.com>
Mon, 16 Mar 2015 21:18:42 +0000 (16:18 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 24 Mar 2015 00:18:48 +0000 (17:18 -0700)
This is a rhel7.0 specific thing so I moved it to it's own file as well
as stopping firewalld which is also rhel7 specific.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
roles/common/tasks/redhat/rhel_7.0.yml [new file with mode: 0644]
roles/common/tasks/setup-redhat.yml

diff --git a/roles/common/tasks/redhat/rhel_7.0.yml b/roles/common/tasks/redhat/rhel_7.0.yml
new file mode 100644 (file)
index 0000000..7621eba
--- /dev/null
@@ -0,0 +1,20 @@
+---
+- name: Stop firewalld
+  service:
+    name: firewalld
+    state: stopped
+
+- name: Get hostname.
+  command: hostname
+  register: existing_hostname
+  changed_when: false
+
+- name: Remove lab domain from hostname.
+  shell: hostname | cut -d'.' -f1
+  register: new_hostname
+  when: existing_hostname.stdout.find("{{ lab_domain | mandatory }}") != -1
+
+- name: Set hostname.
+  hostname:
+     name: "{{ new_hostname.stdout }}"
+  when: existing_hostname.stdout.find("{{ lab_domain | mandatory }}") != -1
index fdd1133b638a8fc3397077828fe7a4ad228c49e7..5e9f947e354ef7bb46703b0f1bfe27b766ad9f41 100644 (file)
   tags:
     - packages
 
-- name: Stop firewalld
-  service:
-    name: firewalld
-    state: stopped
-
 - name: Create remote.conf
   template:
     src: remote.conf
@@ -31,3 +26,7 @@
     group: root
     owner: root
     mode: 0644
+
+- name: Include version specific tasks.
+  include: redhat/rhel_7.0.yml
+  when: ansible_distribution_version == "7.0"