Compare commits
No commits in common. "441a7b8e243dc83c17b11f372e12e9fe8bd79d36" and "c4093d24014f32ea317513810d1de63437592444" have entirely different histories.
441a7b8e24
...
c4093d2401
@ -2,9 +2,3 @@
|
|||||||
nsf_mount__default: []
|
nsf_mount__default: []
|
||||||
nfs_mounts: "{{ vars | dict2items | selectattr('key', 'match', '^nfs_mounts__.*') | map(attribute='value') | list | flatten | unique }}"
|
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)
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
role_config:
|
role_config:
|
||||||
nfs_mounts: "{{ nfs_mounts }}"
|
nfs_mounts: "{{ nfs_mounts }}"
|
||||||
tasks:
|
tasks:
|
||||||
- "Ensure nfs-client packages are installed: {{ nfs_mounts_install_pkg }}"
|
- Ensure nfs-client packages are installed
|
||||||
- "Create {{ nfs_mounts | length }} mounts directories"
|
- "Create {{ nfs_mounts | length }} mounts directories"
|
||||||
- "Ensure {{ nfs_mounts | length }} mounts are in fstab"
|
- "Ensure {{ nfs_mounts | length }} mounts are in fstab"
|
||||||
tags:
|
tags:
|
||||||
@ -19,7 +19,6 @@
|
|||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
when: nfs_mounts_install_pkg
|
|
||||||
with_items:
|
with_items:
|
||||||
- nfs-common
|
- nfs-common
|
||||||
|
|
||||||
|
|||||||
@ -14,5 +14,3 @@ system_hostname: "{{ inventory_hostname | split('.') | first }}"
|
|||||||
system_domain: "{{ (inventory_hostname | split('.'))[1:] | join('.') }}"
|
system_domain: "{{ (inventory_hostname | split('.'))[1:] | join('.') }}"
|
||||||
# system_domain: "lan.test"
|
# system_domain: "lan.test"
|
||||||
system_fqdn: "{{ system_hostname }}.{{ system_domain }}"
|
system_fqdn: "{{ system_hostname }}.{{ system_domain }}"
|
||||||
system_real_fqdn:
|
|
||||||
system_real_address:
|
|
||||||
|
|||||||
@ -27,21 +27,10 @@
|
|||||||
- name: Configure system hostname in /etc/hosts
|
- name: Configure system hostname in /etc/hosts
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "{{ item.regexp }}"
|
regexp: '^127\.0\.1\.1 '
|
||||||
line: "{{ item.line }}"
|
|
||||||
state: present
|
|
||||||
register: machine_name_changed
|
|
||||||
loop:
|
|
||||||
- regexp: '^127\.0\.1\.1(\t\s)*'
|
|
||||||
line: '127.0.1.1 {{ system_fqdn }} {{ system_hostname }}'
|
line: '127.0.1.1 {{ system_fqdn }} {{ system_hostname }}'
|
||||||
state: present
|
state: present
|
||||||
- regexp: '^{{ system_real_address }}(\t\s)*'
|
register: machine_name_changed
|
||||||
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 }})"
|
- name: "Apply system hostname (changed={{ machine_name_changed.changed }})"
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
@ -63,7 +52,7 @@
|
|||||||
- wheel
|
- wheel
|
||||||
- sudo
|
- sudo
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "Ensure group: {{ item }}"
|
label: "Install package: {{ item }}"
|
||||||
|
|
||||||
- name: Create users
|
- name: Create users
|
||||||
user:
|
user:
|
||||||
@ -104,28 +93,19 @@
|
|||||||
# Configure package manager
|
# Configure package manager
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|
||||||
#- name: Configure APT preferences
|
- 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
|
|
||||||
copy:
|
copy:
|
||||||
dest: /etc/apt/apt.conf.d/90_install_mode
|
dest: "/etc/apt/apt.conf.d/{{ item.name }}"
|
||||||
|
content: "{{ item.content }}"
|
||||||
|
loop:
|
||||||
|
- name: 01-norecommend
|
||||||
content: |
|
content: |
|
||||||
# Ansible managed
|
APT::Install-Recommends "{{ system_packages_norecommend | bool | ternary(0, 1) }}";
|
||||||
APT::Install-Recommends "{{ system_packages_norecommend | bool | ternary(1, 0) }}";
|
- name: 02-suggest
|
||||||
APT::Install-Suggests "{{ system_packages_nosuggest | bool | ternary(1, 0) }}";
|
content: |
|
||||||
|
APT::Install-Suggests "{{ system_packages_nosuggest | bool | ternary(0, 1) }}";
|
||||||
|
loop_control:
|
||||||
|
label: "Ensure APT preference: {{ item.content }}"
|
||||||
|
|
||||||
- name: Install base tools
|
- name: Install base tools
|
||||||
package:
|
package:
|
||||||
|
|||||||
@ -6,8 +6,3 @@ disks_lv__default: []
|
|||||||
disks_vg: "{{ vars | dict2items | selectattr('key', 'match', '^disks_vg__.*') | map(attribute='value') | list | flatten | unique }}"
|
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_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)
|
|
||||||
}}
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
disks_vg: "{{ disks_vg }}"
|
disks_vg: "{{ disks_vg }}"
|
||||||
disks_lv: "{{ disks_lv }}"
|
disks_lv: "{{ disks_lv }}"
|
||||||
tasks:
|
tasks:
|
||||||
- "Ensure lvm packages are installed: {{ disks_install_lvm_pkg }}"
|
- Ensure lvm packages are installed
|
||||||
- Copy lvm detector script
|
- Copy lvm detector script
|
||||||
- "Ensure all PVs and {{ disks_vg | length }} VGs are correctly setup"
|
- "Ensure all PVs and {{ disks_vg | length }} VGs are correctly setup"
|
||||||
- "Ensure all {{ disks_lv | length }} LVs are in correct state"
|
- "Ensure all {{ disks_lv | length }} LVs are in correct state"
|
||||||
@ -24,7 +24,6 @@
|
|||||||
- lvm2
|
- lvm2
|
||||||
- parted
|
- parted
|
||||||
state: present
|
state: present
|
||||||
when: disks_install_lvm_pkg
|
|
||||||
|
|
||||||
# This should be the way, as it is not possible with cloudinit ...
|
# This should be the way, as it is not possible with cloudinit ...
|
||||||
- name: Copy lvm volume detector script
|
- name: Copy lvm volume detector script
|
||||||
@ -32,7 +31,6 @@
|
|||||||
src: setup_lvm_devices.sh
|
src: setup_lvm_devices.sh
|
||||||
dest: /usr/local/sbin/setup_lvm_devices.sh
|
dest: /usr/local/sbin/setup_lvm_devices.sh
|
||||||
mode: "755"
|
mode: "755"
|
||||||
when: disks_install_lvm_pkg
|
|
||||||
|
|
||||||
- name: Ensure presence of all VG
|
- name: Ensure presence of all VG
|
||||||
community.general.lvg:
|
community.general.lvg:
|
||||||
|
|||||||
@ -15,7 +15,7 @@ systemd_networkd_cleanup: false
|
|||||||
systemd_networkd_cleanup_patterns: []
|
systemd_networkd_cleanup_patterns: []
|
||||||
systemd_networkd_cleanup_patterns_use_regex: false
|
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_passwd: files systemd
|
||||||
systemd_networkd_nsswitch_group: files systemd
|
systemd_networkd_nsswitch_group: files systemd
|
||||||
systemd_networkd_nsswitch_shadow: files systemd
|
systemd_networkd_nsswitch_shadow: files systemd
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
tweaks_install_pkg:
|
|
||||||
- vim
|
|
||||||
- htop
|
|
||||||
- iftop
|
|
||||||
- iotop
|
|
||||||
- bash-completion
|
|
||||||
- lsof
|
|
||||||
- tree
|
|
||||||
- psmisc
|
|
||||||
- git
|
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
vars:
|
vars:
|
||||||
base_config:
|
base_config:
|
||||||
tasks:
|
tasks:
|
||||||
- "install custom packages: {{ tweaks_install_pkg|join(' ') }}"
|
- install custom packages
|
||||||
- configure bash
|
- configure bash
|
||||||
- configure git
|
- configure git
|
||||||
- configure vim
|
- configure vim
|
||||||
@ -15,7 +15,12 @@
|
|||||||
|
|
||||||
- name: Ensure base packages are installed
|
- name: Ensure base packages are installed
|
||||||
package:
|
package:
|
||||||
name: "{{ tweaks_install_pkg }}"
|
name:
|
||||||
|
- vim
|
||||||
|
- htop
|
||||||
|
- iftop
|
||||||
|
- iotop
|
||||||
|
- bash-completion
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user