-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New role * update * update * update * adding become block
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
= Set Host Public FQDN for Nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
|
||
# Public Domain name | ||
set_host_public_fqdn_domain_name: "{{ guid }}{{ subdomain_base_suffix }}" | ||
|
||
# List of host/nodes | ||
set_host_public_fqdn_host_list: "{{ groups['nodes'] }}" | ||
|
||
# Examples: | ||
# set_host_public_fqdn_host_list: | ||
# - "{{ groups['nodes'] }}" | ||
# - node1 | ||
# - node2 | ||
# - "{{ groups['controllers'] }}" | ||
# - "{{ groups['servers'] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
galaxy_info: | ||
author: Mitesh The Mouse | ||
description: Set public hostname for nodes useful for insights and satellite clients | ||
company: Red Hat | ||
version: 1.0.0 | ||
license: license (GPL-3.0) | ||
min_ansible_version: 2.14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Include set_fqdn for hosts | ||
ansible.builtin.include_tasks: | ||
file: set_fqdn.yml | ||
loop: "{{ set_host_public_fqdn_host_list }}" | ||
loop_control: | ||
loop_var: _host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Extract hostname | ||
ansible.builtin.set_fact: | ||
_hostname: "{{ _host.split('.')[0] }}" | ||
delegate_to: "{{ _host }}" | ||
|
||
- name: Create public fqdn | ||
ansible.builtin.set_fact: | ||
_host_public_fqdn: "{{ _hostname + '.' + set_host_public_fqdn_domain_name }}" | ||
delegate_to: "{{ _host }}" | ||
|
||
- name: Configure Public FQDN | ||
become: true | ||
block: | ||
- name: Set host public fqdn | ||
ansible.builtin.hostname: | ||
name: "{{ _host_public_fqdn }}" | ||
delegate_to: "{{ _host }}" | ||
|
||
- name: Configure public fqdn in hosts file | ||
ansible.builtin.lineinfile: | ||
dest: /etc/hosts | ||
state: present | ||
insertafter: EOF | ||
line: "{{ ansible_default_ipv4['address'] }} {{ _host_public_fqdn }}" | ||
delegate_to: "{{ _host }}" |