Skip to content
Snippets Groups Projects
main.yml 1.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    ---
    # file: roles/haproxy/tasks/main.yml
    
    
    - name: "HaProxy Role"
      set_fact: role_haproxy_started=true
      tags: always
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    - block:
    
      - include: install.yml
      - include: configure.yml
        tags: Config
    
      when: '"haproxy" not in excluded_roles'
    
    
      - name: "Install Certs"
        include: '../../letsencrypt/tasks/cert.yml'
    
    jurgenhaas's avatar
    jurgenhaas committed
        with_items: '{{ proxy_certificates_letsencrypt|default([]) }}'
    
    
      - name: "Renew Existing Cert"
    
    jurgenhaas's avatar
    jurgenhaas committed
        include: '../../letsencrypt/tasks/renew.yml'
    
      - name: "Build HaCerts"
        include: 'buildcerts.yml'
    
      - name: "Set directory permissions to current user"
        file:
          path: '/etc/letsencrypt'
          owner: '{{ ansible_env.SUDO_USER }}'
          recurse: yes
        tags: Certs
        when: proxy_active
    
      tags: Certs
      when: 'proxy_active and "letsencrypt" not in excluded_roles'
    
    - block:
    
      - name: "Pull Certs from active Proxy"
        include: 'pullcerts.yml'
    
      tags: Certs
      when: 'not proxy_active and "letsencrypt" not in excluded_roles'
    
    - name: "Set directory permissions to root"
      file:
        path: '/etc/letsencrypt'
        owner: 'root'
        recurse: yes
    
    jurgenhaas's avatar
    jurgenhaas committed
      when: 'proxy_active and "letsencrypt" not in excluded_roles'