set hostname during update_hosts.yml playbook

This commit is contained in:
2022-08-21 09:57:50 -04:00
parent 42c80b4894
commit bcbca14816
7 changed files with 82 additions and 43 deletions

View File

@@ -27,43 +27,43 @@
become: true
- role: rsyslog
become: true
- role: datadog.datadog
become: true
when: ansible_architecture != 'armv7l'
datadog_checks:
reboot_required:
init_config:
instances:
-
oom_kill:
init_config:
instances:
-
systemd:
- unit_names:
- cron.service
- k3s.service
- named.service
- ssh.servce
- apt-daily-upgrade.timer
# - role: datadog.datadog
# become: true
# when: ansible_architecture != 'armv7l'
# datadog_checks:
# reboot_required:
# init_config:
# instances:
# -
# oom_kill:
# init_config:
# instances:
# -
# systemd:
# - unit_names:
# - cron.service
# - k3s.service
# - named.service
# - ssh.servce
# - apt-daily-upgrade.timer
#
# bind9:
# init_config:
# instances:
# - url: "http://ns01:8053/"
# - url: "http://ns02:8053/"
#
# datadog_integration:
# datadog-reboot_required:
# action: install
# version: 1.0.0
# third_party: true
# datadog-bind9:
# action: install
# version: 1.0.0
# third_party: true
bind9:
init_config:
instances:
- url: "http://ns01:8053/"
- url: "http://ns02:8053/"
datadog_integration:
datadog-reboot_required:
action: install
version: 1.0.0
third_party: true
datadog-bind9:
action: install
version: 1.0.0
third_party: true
- role: datadog.datadog
become: true
datadog_agent_flavor: datadog-iot-agent
when: ansible_architecture == 'armv7l'
# - role: datadog.datadog
# become: true
# datadog_agent_flavor: datadog-iot-agent
# when: ansible_architecture == 'armv7l'

View File

@@ -16,8 +16,15 @@ machines:
remove: []
cubox-m:
fstab:
add: []
remove: []
home:
fstab:
add: []
remove: []

View File

@@ -6,6 +6,7 @@
upgrade: dist
update_cache: yes
cache_valid_time: 3600
autoremove: yes
when: ansible_os_family == "Debian"
- name: check for reboot required

View File

@@ -1,14 +1,18 @@
---
- name: update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
state: latest
with_items:
- htop
- attr
- python3-psutil
- acl
- bind9-dnsutils
- iputils-ping
when: ansible_os_family == "Debian"

View File

@@ -1,12 +1,16 @@
---
- include_tasks: set_hostname.yml
- include_tasks: install_tools.yml
# update packages to latest
- include_tasks: apply_updates.yml
- name: update login screen
include_tasks: motd.yml
#- name: update login screen
# include_tasks: motd.yml
- name: update fstab
include_tasks: update_fstab.yml

View File

@@ -0,0 +1,14 @@
---
#Try and setup correct hostnames
- name: Set hostname to {{inventory_hostname}}
ansible.builtin.hostname:
name: "{{inventory_hostname}}"
- name: Template a file to /etc/file.conf
ansible.builtin.template:
src: hosts.j2
dest: /etc/hosts
owner: root
group: root
mode: '0644'

View File

@@ -0,0 +1,9 @@
127.0.0.1 localhost
127.0.1.1 {{inventory_hostname}}
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
#fe00::0 ip6-localnet #missing on debian?
#ff00::0 ip6-mcastprefix #missing on debian?
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters