---
- name: samba
  become: yes
  hosts: samba

  vars:
    sambadc_realm: "proaluno.usp.br"

  tasks:

    - name: configura /etc/hosts e /etc/hostnane
      include_role:
        name: Stouts.hostname
      vars:
        hostname_hostname: "{{ inventory_hostname }}.{{sambadc_realm}}"

    - name: Corrige o timezone para America/Sao_Paulo
      include_role:
        name: adriagalin.timezone
      vars:
        ag_timezone: 'America/Sao_Paulo'

    - name: Altera o locale para pt_BR.UTF-8
      include_role:
        name: infOpen.locales
      vars:
        locales_to_configure:
          - name: 'pt_BR.UTF-8'
            modifier: 'UTF-8'
        locales_defaults:
          LANG: 'pt_BR.UTF-8'
          LC_CTYPE: 'pt_BR.UTF-8'
          LANGUAGE: 'pt_BR.UTF-8'

    - name: Cria um servidor ntp
      include_role:
        name: ontic.ntp
      vars:
        ntp_timezone: 'America/Sao_Paulo'
        ntp_servers:
          - 'a.st1.ntp.br'
          - 'b.st1.ntp.br'

    - name: Instalação samba
      include_role:
        name: fflch.install_samba
      vars:
        install_samba_build: False
        install_samba_dc_server: True

    - name: Configura samba como um Domain Controller
      include_role:
        name: fflch.sambadc
      vars:
        sambadc_admin_password: "Pr0Aluno123"
 
    - name: Configura resolv.conf para consultar DNSs no próprio samba
      include_role:
        name: blackstar257.resolv
      vars:
        resolv_conf_nameservers:
          - 10.20.30.5
        resolv_conf_search_domains:
          - "{{ sambadc_realm }}"
