Compare commits
No commits in common. "d752b8064b404fe10a022b0d69a1a298427f02c6" and "7d3a8d8f77c96a64dd9b677e90b57a916cad5d64" have entirely different histories.
d752b8064b
...
7d3a8d8f77
@ -8,7 +8,7 @@ namespace: jchristianh
|
|||||||
name: baseos
|
name: baseos
|
||||||
|
|
||||||
# The version of the collection. Must be compatible with semantic versioning
|
# The version of the collection. Must be compatible with semantic versioning
|
||||||
version: 1.0.21
|
version: 1.0.20
|
||||||
|
|
||||||
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
||||||
readme: README.md
|
readme: README.md
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
hostname_project_author : Chris Hammer
|
|
||||||
hostname_project_email : chris@thezengarden.net
|
|
||||||
hostname_project_repo : https://github.com/jchristianh-ansible-collections/baseos
|
|
||||||
|
|
||||||
hostname_template_header : The Zen Garden
|
|
||||||
|
|
||||||
hostname_hostname_file : /etc/hostname
|
|
||||||
hostname_hostname_version : 1.0.0
|
|
||||||
hostname_hostname_revision : 240228
|
|
||||||
|
|
||||||
|
|
||||||
...
|
|
@ -1,40 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
- name: Set hostname for host
|
||||||
- name: Use hostname module to set hostname, or failback to command module
|
ansible.builtin.hostname:
|
||||||
block:
|
name: "{{ inventory_hostname }}"
|
||||||
- name: Set hostname for host using hostname module
|
notify:
|
||||||
ansible.builtin.hostname:
|
- "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
|
||||||
name: "{{ inventory_hostname }}"
|
|
||||||
notify:
|
|
||||||
- "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
|
|
||||||
|
|
||||||
rescue:
|
|
||||||
- name: Ensure hostname package is present
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: hostname
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Set hostname file if running in container
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
hostname_hostname_file: "{{ hostname_hostname_file }}.container"
|
|
||||||
when:
|
|
||||||
- ansible_virtualization_type | regex_search("docker|podman|container")
|
|
||||||
|
|
||||||
- name: Add entry into hostname file
|
|
||||||
ansible.builtin.lineinfile:
|
|
||||||
path: "{{ hostname_hostname_file }}"
|
|
||||||
line: "{{ inventory_hostname }}"
|
|
||||||
state: present
|
|
||||||
create: true
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Update hostname from /etc/hostname
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "hostname -F {{ hostname_hostname_file }}"
|
|
||||||
notify:
|
|
||||||
- "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
|
|
||||||
when:
|
|
||||||
- not ansible_virtualization_type | regex_search("docker|podman|container")
|
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Set resolv.conf if running in container
|
- name: Set resolv_conf_file if running in container
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.container"
|
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.docker"
|
||||||
when:
|
when:
|
||||||
- ansible_virtualization_type | regex_search("docker|podman|container")
|
- ansible_virtualization_type | regex_search("docker|podman|container")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user