fix(security,common)!: moved sysctl and resolvconf tasks from common to security role to fix DNS resolution fail due to firewall rules
This commit is contained in:
parent
b7ba39bce9
commit
3701ea6276
13 changed files with 57 additions and 55 deletions
|
@ -2,7 +2,6 @@
|
|||
common_apt_packages: []
|
||||
common_apt_source_components: ["contrib", "non-free", "non-free-firmware"]
|
||||
common_apt_use_deb822_format: false
|
||||
common_configure_resolve_conf: false
|
||||
common_git_email: ""
|
||||
common_git_enabled: false
|
||||
common_git_force_sign: false
|
||||
|
@ -10,5 +9,4 @@ common_git_signing_key: ""
|
|||
common_git_username: ""
|
||||
common_github_token: "{{ custom_github_token | default('') }}"
|
||||
common_install_fonts: false
|
||||
common_sysctl_configuration: {}
|
||||
common_user_account: "{{ custom_base_user_account }}"
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
---
|
||||
- name: '[system] reload sysctl configuration'
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: sysctl --system
|
||||
|
|
|
@ -1,35 +1,4 @@
|
|||
---
|
||||
- name: '[system] setup DNS server'
|
||||
block:
|
||||
- name: disable resolv.conf updates from dhclient
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate
|
||||
content: |
|
||||
#!/bin/sh
|
||||
make_resolv_conf(){
|
||||
:
|
||||
}
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
- name: update resolv.conf
|
||||
ansible.builtin.template:
|
||||
src: ../templates/system/resolv.conf.j2
|
||||
dest: /etc/resolv.conf
|
||||
mode: '0644'
|
||||
owner: root
|
||||
group: root
|
||||
become: true
|
||||
when: common_configure_resolve_conf is truthy
|
||||
|
||||
- name: '[system] re-allow DHCP client to setup DNS resolvers'
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate
|
||||
state: absent
|
||||
failed_when: false
|
||||
when : common_configure_resolve_conf is falsy
|
||||
|
||||
- name: '[apt] verify components of default sources'
|
||||
become: true
|
||||
block:
|
||||
|
@ -135,18 +104,6 @@
|
|||
cmds:
|
||||
- dpkg -i {asset_dirname}/{asset_filename}
|
||||
|
||||
- name: '[system] add sysctl tweaks'
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: ../templates/system/sysctld.local.conf.j2
|
||||
dest: /etc/sysctl.d/local.conf
|
||||
mode: '0644'
|
||||
when: common_sysctl_configuration is truthy
|
||||
vars:
|
||||
sysctl_values: "{{ common_sysctl_configuration }}"
|
||||
notify:
|
||||
- 'common : [system] reload sysctl configuration'
|
||||
|
||||
- name: '[apt] install custom packages'
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{% set dns4_servers = hostvars[inventory_hostname]["global_dns_{}_dns4".format(global_dns_type)] | default([]) %}
|
||||
{% set dns6_servers = hostvars[inventory_hostname]["global_dns_{}_dns6".format(global_dns_type)] | default([]) %}
|
||||
{% if dns4_servers is defined and dns4_servers | length > 0 -%}
|
||||
{% for server in dns4_servers -%}
|
||||
nameserver {{ server }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if global_ip_dualstack | default(false) and dns6_servers is defined and dns6_servers | length > 0 -%}
|
||||
{% for server in dns6_servers -%}
|
||||
nameserver {{ server }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
|
@ -1,3 +0,0 @@
|
|||
{% for item in common_sysctl_configuration.keys() -%}
|
||||
{{ item }} = {{ common_sysctl_configuration[item] }}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue