summaryrefslogtreecommitdiffstats
path: root/roles/hostnames/tasks/main.yaml
diff options
context:
space:
mode:
authorRyan Cook <rcook@redhat.com>2017-06-16 10:27:41 -0700
committerGitHub <noreply@github.com>2017-06-16 10:27:41 -0700
commitaa0c8c910a0b8c29afb83d1562c252affcd4a2cb (patch)
treefbde420c20e6f18fcc8063e268a1525f8848c8d0 /roles/hostnames/tasks/main.yaml
parent7ba2ef768b25b99f628c88a8e6348a8d0df630a0 (diff)
parent9369c9dfd722e697f83a225d78c2c1dcd1247976 (diff)
downloadopenshift-aa0c8c910a0b8c29afb83d1562c252affcd4a2cb.tar.gz
openshift-aa0c8c910a0b8c29afb83d1562c252affcd4a2cb.tar.bz2
openshift-aa0c8c910a0b8c29afb83d1562c252affcd4a2cb.tar.xz
openshift-aa0c8c910a0b8c29afb83d1562c252affcd4a2cb.zip
Merge pull request #466 from tomassedovic/openstack-provider
Openstack provider
Diffstat (limited to 'roles/hostnames/tasks/main.yaml')
-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..c49852210
--- /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