Skip to content
Snippets Groups Projects
Commit 75817050 authored by Matthew Mosesohn's avatar Matthew Mosesohn Committed by GitHub
Browse files

Merge pull request #1185 from intelsdi-x/hostname

Use hostname module to set hostname, and do it for all Os not only Co…
parents 742a1681 61b2d754
No related branches found
No related tags found
No related merge requests found
...@@ -50,11 +50,3 @@ ...@@ -50,11 +50,3 @@
name: "{{ item }}" name: "{{ item }}"
with_items: "{{pip_python_modules}}" with_items: "{{pip_python_modules}}"
- name: Check configured hostname
shell: hostname
register: configured_hostname
check_mode: no
- name: Assign inventory name to unconfigured hostnames
shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
when: (configured_hostname.stdout == 'localhost')
...@@ -17,3 +17,14 @@ ...@@ -17,3 +17,14 @@
- set_fact: - set_fact:
is_atomic: "{{ ostree.stat.exists }}" is_atomic: "{{ ostree.stat.exists }}"
- name: Gather nodes hostnames
setup:
gather_subset: '!all'
filter: ansible_hostname
- name: Assign inventory name to unconfigured hostnames
hostname:
name: "{{inventory_hostname}}"
when: ansible_hostname == 'localhost'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment