--- - import_playbook: "include/deploy-kvm-guest.yml myhosts=dnagw" - name: configure instance hosts: dnagw user: root gather_facts: true vars_files: - "{{ ansible_private }}/vars.yml" roles: - base - ifstated - dhcpd - nginx/server - role: nginx/site site: gw.home.foo.sh - tftp - websockify tasks: - name: use configured dns servers and domain name copy: dest: /etc/dhclient.conf content: "ignore domain-name-servers, domain-name;\n" mode: 0644 owner: root group: "{{ ansible_wheel }}" - name: disable resolvd ansible.builtin.service: name: resolvd state: stopped enabled: false - name: enable ip forwarding sysctl: name: "{{ item }}" sysctl_set: true value: "1" with_items: - net.inet.ip.forwarding - net.inet6.ip6.forwarding - name: run handlers to get interfaces configured meta: flush_handlers - name: create tftp boot directories file: path: /srv/tftpboot/etc state: directory mode: 0755 owner: root group: "{{ ansible_wheel }}" - name: create tftp boot config for openbsd copy: dest: /srv/tftpboot/etc/boot.conf content: | stty com0 115200 set tty com0 boot tftp:bsd.rd mode: 0644 owner: root group: "{{ ansible_wheel }}" - name: create tftp pxeboot loader for openbssd get_url: url: "https://mirrors.foo.sh/openbsd/7.2/amd64/pxeboot" checksum: sha1:e5f8117a9c65ab3b31f2d5464940879406caf80e dest: /srv/tftpboot/pxeboot mode: 0644 owner: root group: "{{ ansible_wheel }}" - name: create tftp ramdisk for openbsd get_url: url: "https://mirrors.foo.sh/openbsd/7.2/amd64/bsd.rd" checksum: sha1:7f8eb578d65401f4076c074802f47a5c732aadb3 dest: /srv/tftpboot/bsd.rd mode: 0644 owner: root group: "{{ ansible_wheel }}" - name: create install.conf for openbsd get_url: url: "https://boot.foo.sh/openbsd/install.conf" checksum: sha1:f6270708dad3f759df02eefeab300d9b8670f3d4 dest: /srv/tftpboot/install.conf mode: 0644 owner: root group: "{{ ansible_wheel }}" - name: copy custom nginx config copy: dest: /etc/nginx/conf.d/172.20.20.1.conf content: | server { listen 172.20.20.10:80; server_name 172.20.20.10; location / { location /install.conf { alias /srv/tftpboot/install.conf; } location / { deny all; } } } mode: 0644 owner: root group: "{{ ansible_wheel }}" notify: restart nginx - name: copy dns private key copy: dest: "{{ tls_private }}/dns.home.foo.sh.key" src: "{{ item }}" mode: 0600 owner: root group: "{{ ansible_wheel }}" with_first_found: - /srv/letsencrypt/live/dns.home.foo.sh/privkey.pem - "/srv/ca/private/{{ inventory_hostname }}.key" tags: certificates notify: restart unbound - name: copy dns certificate and ca cert copy: dest: "{{ tls_certs }}/dns.home.foo.sh.crt" src: "{{ item }}" mode: 0644 owner: root group: "{{ ansible_wheel }}" with_first_found: - /srv/letsencrypt/live/dns.home.foo.sh/fullchain.pem - "/srv/ca/certs/hosts/{{ inventory_hostname }}.crt" tags: certificates notify: restart unbound - name: copy dns zone files copy: dest: "/var/unbound/db/{{ item }}" src: "/srv/dns/{{ item }}" mode: 0644 owner: root group: "{{ ansible_wheel }}" tags: dns notify: restart unbound with_items: - 20.172.in-addr.arpa - home.foo.sh - import_role: name: unbound