refactor!: switch hosts variables to a flat layout

This commit is contained in:
NaeiKinDus 2024-01-21 00:00:00 +00:00
parent f669dea62a
commit 779f2766f2
Signed by: WoodSmellParticle
GPG key ID: 8E52ADFF7CA8AE56
33 changed files with 270 additions and 322 deletions

View file

@ -1,9 +1,4 @@
---
- name: '[setup] merge with custom vars'
ansible.builtin.set_fact:
common: "{{ common | combine(custom_common, recursive=recursive_combine) }}"
changed_when: false
- name: '[system] setup DNS server'
block:
- name: disable resolv.conf updates from dhclient
@ -25,7 +20,7 @@
owner: root
group: root
become: true
when: common.configure_resolv_conf is truthy
when: common_configure_resolve_conf is truthy
- name: '[system] re-allow DHCP client to setup DNS resolvers'
become: true
@ -33,7 +28,7 @@
path: /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate
state: absent
failed_when: false
when : common.configure_resolv_conf is falsy
when : common_configure_resolve_conf is falsy
- name: '[apt] verify components of default sources'
become: true
@ -43,15 +38,15 @@
path: '/etc/apt/sources.list'
regexp: '^(deb((?!{{ item }}).)+)$'
replace: '\1 {{ item }}'
when: not common.apt.deb822_format | bool
loop: '{{ common.apt.source_components }}'
loop: '{{ common_apt_source_components }}'
when: common_apt_use_deb822_format is falsy
- name: '[apt] default deb822 debian.sources'
ansible.builtin.replace:
path: '/etc/apt/sources.list.d/debian.sources'
regexp: '^(Components: ((?!{{ item }}).)+)$'
replace: '\1 {{ item }}'
loop: '{{ common.apt.source_components }}'
when: common.apt.deb822_format | bool
loop: '{{ common_apt_source_components }}'
when: common_apt_use_deb822_format is truthy
- name: '[apt] install dependencies and tools'
become: true
@ -98,7 +93,7 @@
asset_type: "{{ item.asset_type }}"
cmds: "{{ item.cmds | default([]) }}"
creates: "{{ item.creates | default('') }}"
github_token: "{{ common.github_token }}"
github_token: "{{ common_github_token }}"
repository: "{{ item.repository }}"
version: "{{ item.version | default('') }}"
loop:
@ -144,9 +139,9 @@
src: ../templates/system/sysctld.local.conf.j2
dest: /etc/sysctl.d/local.conf
mode: '0644'
when: common.sysctl is truthy
when: common_sysctl_configuration is truthy
vars:
sysctl_values: "{{ common.sysctl }}"
sysctl_values: "{{ common_sysctl_configuration }}"
notify:
- 'common : [system] reload sysctl configuration'
@ -156,8 +151,7 @@
update_cache: true
force_apt_get: true
cache_valid_time: 3600
pkg:
"{{ common.apt.packages }}"
pkg: "{{ common_apt_packages }}"
- include_tasks: home_setup.yml