Compare commits

..

No commits in common. "441a7b8e243dc83c17b11f372e12e9fe8bd79d36" and "c4093d24014f32ea317513810d1de63437592444" have entirely different histories.

9 changed files with 26 additions and 70 deletions

View File

@ -2,9 +2,3 @@
nsf_mount__default: []
nfs_mounts: "{{ vars | dict2items | selectattr('key', 'match', '^nfs_mounts__.*') | map(attribute='value') | list | flatten | unique }}"
nfs_mounts_install_pkg: >-
{{
((nfs_mounts|d(false, true)) != false)
| ternary(true, false)
}}

View File

@ -8,7 +8,7 @@
role_config:
nfs_mounts: "{{ nfs_mounts }}"
tasks:
- "Ensure nfs-client packages are installed: {{ nfs_mounts_install_pkg }}"
- Ensure nfs-client packages are installed
- "Create {{ nfs_mounts | length }} mounts directories"
- "Ensure {{ nfs_mounts | length }} mounts are in fstab"
tags:
@ -19,7 +19,6 @@
package:
name: "{{ item }}"
state: present
when: nfs_mounts_install_pkg
with_items:
- nfs-common

View File

@ -13,6 +13,4 @@ system_packages: "{{ vars | dict2items | selectattr('key', 'match', '^system_pac
system_hostname: "{{ inventory_hostname | split('.') | first }}"
system_domain: "{{ (inventory_hostname | split('.'))[1:] | join('.') }}"
# system_domain: "lan.test"
system_fqdn: "{{ system_hostname }}.{{ system_domain }}"
system_real_fqdn:
system_real_address:
system_fqdn: "{{ system_hostname }}.{{ system_domain }}"

View File

@ -27,21 +27,10 @@
- name: Configure system hostname in /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
regexp: '^127\.0\.1\.1 '
line: '127.0.1.1 {{ system_fqdn }} {{ system_hostname }}'
state: present
register: machine_name_changed
loop:
- regexp: '^127\.0\.1\.1(\t\s)*'
line: '127.0.1.1 {{ system_fqdn }} {{ system_hostname }}'
state: present
- regexp: '^{{ system_real_address }}(\t\s)*'
line: "{{ system_real_address }} {{ system_real_fqdn }} {{ system_real_fqdn|split('.')|first }}"
state: >-
{{
( system_real_address|d('') != '' )
| ternary('present', 'absent')
}}
- name: "Apply system hostname (changed={{ machine_name_changed.changed }})"
ansible.builtin.shell:
@ -63,7 +52,7 @@
- wheel
- sudo
loop_control:
label: "Ensure group: {{ item }}"
label: "Install package: {{ item }}"
- name: Create users
user:
@ -104,28 +93,19 @@
# Configure package manager
# ==========================
#- name: Configure APT preferences
# copy:
# dest: "/etc/apt/apt.conf.d/{{ item.name }}"
# content: "{{ item.content }}"
# loop:
# - name: 01-norecommend
# content: |
# APT::Install-Recommends "{{ system_packages_norecommend | bool | ternary(0, 1) }}";
# - name: 02-suggest
# content: |
# APT::Install-Suggests "{{ system_packages_nosuggest | bool | ternary(0, 1) }}";
# loop_control:
# label: "Ensure APT preference: {{ item.content }}"
- name: Ensure apt only install minimal packages
- name: Configure APT preferences
copy:
dest: /etc/apt/apt.conf.d/90_install_mode
content: |
# Ansible managed
APT::Install-Recommends "{{ system_packages_norecommend | bool | ternary(1, 0) }}";
APT::Install-Suggests "{{ system_packages_nosuggest | bool | ternary(1, 0) }}";
dest: "/etc/apt/apt.conf.d/{{ item.name }}"
content: "{{ item.content }}"
loop:
- name: 01-norecommend
content: |
APT::Install-Recommends "{{ system_packages_norecommend | bool | ternary(0, 1) }}";
- name: 02-suggest
content: |
APT::Install-Suggests "{{ system_packages_nosuggest | bool | ternary(0, 1) }}";
loop_control:
label: "Ensure APT preference: {{ item.content }}"
- name: Install base tools
package:

View File

@ -6,8 +6,3 @@ disks_lv__default: []
disks_vg: "{{ vars | dict2items | selectattr('key', 'match', '^disks_vg__.*') | map(attribute='value') | list | flatten | unique }}"
disks_lv: "{{ vars | dict2items | selectattr('key', 'match', '^disks_lv__.*') | map(attribute='value') | list | flatten | unique }}"
disks_install_lvm_pkg: >-
{{
((pv|d(vg|d(lv|d(false, true)))) != false)
| ternary(true, false)
}}

View File

@ -9,7 +9,7 @@
disks_vg: "{{ disks_vg }}"
disks_lv: "{{ disks_lv }}"
tasks:
- "Ensure lvm packages are installed: {{ disks_install_lvm_pkg }}"
- Ensure lvm packages are installed
- Copy lvm detector script
- "Ensure all PVs and {{ disks_vg | length }} VGs are correctly setup"
- "Ensure all {{ disks_lv | length }} LVs are in correct state"
@ -24,7 +24,6 @@
- lvm2
- parted
state: present
when: disks_install_lvm_pkg
# This should be the way, as it is not possible with cloudinit ...
- name: Copy lvm volume detector script
@ -32,7 +31,6 @@
src: setup_lvm_devices.sh
dest: /usr/local/sbin/setup_lvm_devices.sh
mode: "755"
when: disks_install_lvm_pkg
- name: Ensure presence of all VG
community.general.lvg:

View File

@ -15,7 +15,7 @@ systemd_networkd_cleanup: false
systemd_networkd_cleanup_patterns: []
systemd_networkd_cleanup_patterns_use_regex: false
systemd_networkd_manage_nsswitch_config: false
systemd_networkd_manage_nsswitch_config: true
systemd_networkd_nsswitch_passwd: files systemd
systemd_networkd_nsswitch_group: files systemd
systemd_networkd_nsswitch_shadow: files systemd

View File

@ -1,13 +0,0 @@
tweaks_install_pkg:
- vim
- htop
- iftop
- iotop
- bash-completion
- lsof
- tree
- psmisc
- git

View File

@ -6,7 +6,7 @@
vars:
base_config:
tasks:
- "install custom packages: {{ tweaks_install_pkg|join(' ') }}"
- install custom packages
- configure bash
- configure git
- configure vim
@ -15,7 +15,12 @@
- name: Ensure base packages are installed
package:
name: "{{ tweaks_install_pkg }}"
name:
- vim
- htop
- iftop
- iotop
- bash-completion
state: present