Main target is now Debian 13 instead of Ubuntu 24.04
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
common_search_strings: []
|
||||
common_default_packages: []
|
||||
common_proxy_server: null
|
||||
|
||||
4
seb4itik/byow/roles/common/handlers/main.yml
Normal file
4
seb4itik/byow/roles/common/handlers/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: Restart systemd-resolved
|
||||
ansible.builtin.service:
|
||||
name: "systemd-resolved"
|
||||
state: "restarted"
|
||||
@@ -1,7 +1,11 @@
|
||||
- name: Setup hosts file
|
||||
ansible.builtin.include_tasks: "setup_hosts.yml"
|
||||
|
||||
- name: Setup resolved
|
||||
ansible.builtin.include_tasks: "setup_resolved.yml"
|
||||
|
||||
- name: Setup proxy client
|
||||
when: "common_proxy_server != None"
|
||||
ansible.builtin.include_tasks: "setup_proxy_client.yml"
|
||||
|
||||
- name: Setup packages
|
||||
when: "common_default_packages | length > 0"
|
||||
ansible.builtin.include_tasks: "setup_packages.yml"
|
||||
|
||||
25
seb4itik/byow/roles/common/tasks/setup_hosts.yml
Normal file
25
seb4itik/byow/roles/common/tasks/setup_hosts.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- name: Check if /etc/cloud/cloud.cfg exists
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
register: common_out_cloud_cfg
|
||||
|
||||
- name: Disable /etc/hosts management by cloud-init
|
||||
when: "common_out_cloud_cfg.stat.exists"
|
||||
block:
|
||||
- name: Disable /etc/hosts management by cloud-init (manage_etc_hosts)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
search_string: 'manage_etc_hosts:'
|
||||
line: "manage_etc_hosts: false"
|
||||
insertafter: "preserve_hostname:"
|
||||
- name: Disable /etc/hosts management by cloud-init (update_etc_hosts)
|
||||
ansible.builtin.replace:
|
||||
path: "/etc/cloud/cloud.cfg"
|
||||
regexp: '^([^#]*update_etc_hosts.*)$'
|
||||
replace: '# \\1'
|
||||
|
||||
- name: Configure /etc/hosts file
|
||||
ansible.builtin.template:
|
||||
src: "templates/hosts"
|
||||
dest: "/etc/hosts"
|
||||
mode: "0644"
|
||||
@@ -4,6 +4,7 @@
|
||||
upgrade: "safe"
|
||||
|
||||
- name: Install default packages
|
||||
when: "common_default_packages | length > 0"
|
||||
ansible.builtin.apt:
|
||||
name: "{{ common_default_packages }}"
|
||||
autoclean: true
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
- name: Create 00proxy.conf file
|
||||
when: "common_proxy_server != None"
|
||||
ansible.builtin.template:
|
||||
src: "templates/apt_proxy.conf"
|
||||
dest: "/etc/apt/apt.conf.d/00proxy.conf"
|
||||
@@ -7,6 +8,7 @@
|
||||
group: "root"
|
||||
|
||||
- name: Add http_proxy and https_proxy variable to file /etc/environment
|
||||
when: "common_proxy_server != None"
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/environment"
|
||||
regexp: '^{{ item.key }}='
|
||||
|
||||
8
seb4itik/byow/roles/common/tasks/setup_resolved.yml
Normal file
8
seb4itik/byow/roles/common/tasks/setup_resolved.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
- name: Add multipass in search domains
|
||||
when: "common_search_domains | length > 0"
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/systemd/resolved.conf"
|
||||
search_string: 'Domains='
|
||||
line: "Domains={{ common_search_domains | join(' ') }}"
|
||||
notify:
|
||||
- "Restart systemd-resolved"
|
||||
9
seb4itik/byow/roles/common/templates/hosts
Normal file
9
seb4itik/byow/roles/common/templates/hosts
Normal file
@@ -0,0 +1,9 @@
|
||||
127.0.0.1 localhost
|
||||
{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}
|
||||
|
||||
# The following lines are desirable for IPv6 capable hosts
|
||||
::1 ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
Reference in New Issue
Block a user