Skip to content

Commit

Permalink
provision: Set samba as dns for the host in idmci
Browse files Browse the repository at this point in the history
Samba role needs to handle dns on the machine to work properly.
The upstrem dns is set as forwarder for the samba.
  • Loading branch information
jakub-vavra-cz committed Oct 7, 2024
1 parent d6139f2 commit c3eaa6e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/ansible/roles/samba/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@
# In containers the file is a mounted from outside so
# we change the content.
- name: Change resolv.conf
lineinfile:
blockinfile:
path: /etc/resolv.conf
insertbefore: BOF
line: "nameserver {{ hostvars[groups.dns.0]['ansible_facts']['default_ipv4']['address'] }}"
block: |
nameserver 127.0.0.1
nameserver {{ hostvars[groups.dns.0]['ansible_facts']['default_ipv4']['address'] }}
when:
- '"resolv.conf" in mounts.stdout'
- '"dns" in groups and groups["dns"]'
- name: Remove systemd-resolved package
ansible.builtin.package:
Expand All @@ -87,6 +88,17 @@
args:
creates: /etc/samba/smb.conf

- name: Set forwarder to dns server
ini_file:
path: /etc/samba/smb.conf
section: global
option: "dns forwarder"
value: "{{ hostvars[groups.dns.0]['ansible_facts']['default_ipv4']['address'] }}"
mode: '0600'
backup: no
when:
- '"dns" in groups and groups["dns"]'

- name: Setup Kerberos
copy:
src: /var/lib/samba/private/krb5.conf
Expand Down

0 comments on commit c3eaa6e

Please sign in to comment.