Compare commits

..

No commits in common. "d752b8064b404fe10a022b0d69a1a298427f02c6" and "7d3a8d8f77c96a64dd9b677e90b57a916cad5d64" have entirely different histories.

4 changed files with 8 additions and 52 deletions

View File

@ -8,7 +8,7 @@ namespace: jchristianh
name: baseos
# 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
readme: README.md

View File

@ -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
...

View File

@ -1,40 +1,9 @@
---
- name: Use hostname module to set hostname, or failback to command module
block:
- name: Set hostname for host using hostname module
ansible.builtin.hostname:
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")
- name: Set hostname for host
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
notify:
- "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}"
...

View File

@ -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:
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.container"
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.docker"
when:
- ansible_virtualization_type | regex_search("docker|podman|container")