summaryrefslogtreecommitdiffstats
path: root/roles/hostnames/tasks
diff options
context:
space:
mode:
authorTomas Sedovic <tomas@sedovic.cz>2017-06-14 16:28:00 +0200
committerTomas Sedovic <tomas@sedovic.cz>2017-06-14 16:28:00 +0200
commit6241e33432ea88cf9c5bc67db6d09c90b2e891ba (patch)
tree4e82fafc32a598d9cf5c1c72b9c20e83268b0251 /roles/hostnames/tasks
parent672f8e155bdc7244d4bf0cbcca5e4be5f063d55f (diff)
parent22e88c9ce8f81cb13c3d050455d332161a1acd83 (diff)
downloadopenshift-6241e33432ea88cf9c5bc67db6d09c90b2e891ba.tar.gz
openshift-6241e33432ea88cf9c5bc67db6d09c90b2e891ba.tar.bz2
openshift-6241e33432ea88cf9c5bc67db6d09c90b2e891ba.tar.xz
openshift-6241e33432ea88cf9c5bc67db6d09c90b2e891ba.zip
Merge redhat-cop/casl-ansible into openstack-provider
This imports the openstack provisioning bits of: https://github.com/redhat-cop/casl-ansible taking care to preserve the original history of those files.
Diffstat (limited to 'roles/hostnames/tasks')
-rw-r--r--roles/hostnames/tasks/main.yaml26
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/hostnames/tasks/main.yaml b/roles/hostnames/tasks/main.yaml
new file mode 100644
index 000000000..bf142d653
--- /dev/null
+++ b/roles/hostnames/tasks/main.yaml
@@ -0,0 +1,26 @@
+---
+- name: Setting Hostname Fact
+ set_fact:
+ new_hostname: "{{ custom_hostname | default(inventory_hostname_short) }}"
+
+- name: Setting FQDN Fact
+ set_fact:
+ new_fqdn: "{{ new_hostname }}.{{ full_dns_domain }}"
+
+- name: Setting hostname and DNS domain
+ hostname: name="{{ new_fqdn }}"
+
+- name: Check for cloud.cfg
+ stat: path=/etc/cloud/cloud.cfg
+ register: cloud_cfg
+
+- name: Prevent cloud-init updates of hostname/fqdn (if applicable)
+ lineinfile:
+ dest: /etc/cloud/cloud.cfg
+ state: present
+ regexp: "{{ item.regexp }}"
+ line: "{{ item.line }}"
+ with_items:
+ - { regexp: '^ - set_hostname', line: '# - set_hostname' }
+ - { regexp: '^ - update_hostname', line: '# - update_hostname' }
+ when: cloud_cfg.stat.exists == True