fix(security): find controllers IP from SSH connection, not from hostname lookup
This commit is contained in:
parent
d65aa3e6cc
commit
3659c15749
2 changed files with 13 additions and 5 deletions
|
@ -5,6 +5,17 @@
|
|||
- distribution
|
||||
- virtualization_type
|
||||
|
||||
- name: get supervisor IP address
|
||||
ansible.builtin.shell: "echo $SSH_CLIENT | tr -s '[:blank:]' ' ' | cut -d ' ' -f 1"
|
||||
register: ssh_client
|
||||
changed_when: false
|
||||
failed_when: ssh_client.stdout is falsy
|
||||
|
||||
- name: set fact
|
||||
ansible.builtin.set_fact:
|
||||
supervisor_ip: "{{ ssh_client.stdout }}"
|
||||
changed_when: false
|
||||
|
||||
- name: install and configure nftables
|
||||
when: security.firewall.enable is truthy
|
||||
become: true
|
||||
|
@ -33,9 +44,6 @@
|
|||
src: "../templates/system/{{ ansible_facts['distribution'] | lower }}/nftables.conf.j2"
|
||||
dest: /etc/nftables.conf
|
||||
mode: '0700'
|
||||
vars:
|
||||
controller_ip: "{{ lookup('pipe', '/bin/dig +short A $(/usr/bin/hostname -f)') }}"
|
||||
controller_ip6: "{{ lookup('pipe', '/bin/dig +short AAAA $(/usr/bin/hostname -f)') }}"
|
||||
|
||||
- name: common firewall rules
|
||||
ansible.builtin.template:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue