Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

style and variables refactoring - Coherent quotation style Single quotes for text variable (even if implicit), no quotes for variable and conditional statements, if not required. - Some useful tags added: * ssh_certs renewal of server SSH certificates and configuration of authorized CA. * tls_pub renewal of public TLS certificates (let's encrypt) and certbot configuration. * tls_int renewal of internal TLS certificates (service authorizations) and configuration of authorized internal CA. *(ToDo: deployment of Certificate Revokation Lists)* * lxc deployment of new containers (deployment of configuration file excluded, for instance change in ip address are always applied and trigger a container restart even if you skip this tag. * packages installation and upgrade of software packages (apt, opkg or tarballs) * service_password create new random password for services-only password, for routine rotation. Not meant to be skipped (some roles need to know the service password, so they do a rotation). - prepare_host - ssh_server - lxc_guest - ldap - gitlab - x509_subject_prefix - x509_ldap_suffix *Replaces:* x509_suffix in ldap.yaml - letsencrypt_email Used in roles/certbot and roles/gitlab - root_ca_cert *Replaces:* ssl_ca_cert and files/lilik_x1.crt New defaults: - ldap_domain | default: `${domain}` - server_fqdn | default: `${hostname}.dmz.${domain}` *Replaces:* fqdn_domain Removed: - fqdn_dmain - x509_suffix *Replaced by:* x509_ldap_suffix in common New defaults: - server_fqdn | default: `${hostname}.${domain}` *Replaces*: fqdn - ldap_domain | default: `${domain}` - ldap_server | default: `ldap1.dmz.${domain}` - ldap_basedn | default: `dn(${ldap_domain})` - enable_https | default: `true` New defaults: - server_fqdn | default: `${hostname}.${domain}`
5 years ago
style and variables refactoring - Coherent quotation style Single quotes for text variable (even if implicit), no quotes for variable and conditional statements, if not required. - Some useful tags added: * ssh_certs renewal of server SSH certificates and configuration of authorized CA. * tls_pub renewal of public TLS certificates (let's encrypt) and certbot configuration. * tls_int renewal of internal TLS certificates (service authorizations) and configuration of authorized internal CA. *(ToDo: deployment of Certificate Revokation Lists)* * lxc deployment of new containers (deployment of configuration file excluded, for instance change in ip address are always applied and trigger a container restart even if you skip this tag. * packages installation and upgrade of software packages (apt, opkg or tarballs) * service_password create new random password for services-only password, for routine rotation. Not meant to be skipped (some roles need to know the service password, so they do a rotation). - prepare_host - ssh_server - lxc_guest - ldap - gitlab - x509_subject_prefix - x509_ldap_suffix *Replaces:* x509_suffix in ldap.yaml - letsencrypt_email Used in roles/certbot and roles/gitlab - root_ca_cert *Replaces:* ssl_ca_cert and files/lilik_x1.crt New defaults: - ldap_domain | default: `${domain}` - server_fqdn | default: `${hostname}.dmz.${domain}` *Replaces:* fqdn_domain Removed: - fqdn_dmain - x509_suffix *Replaced by:* x509_ldap_suffix in common New defaults: - server_fqdn | default: `${hostname}.${domain}` *Replaces*: fqdn - ldap_domain | default: `${domain}` - ldap_server | default: `ldap1.dmz.${domain}` - ldap_basedn | default: `dn(${ldap_domain})` - enable_https | default: `true` New defaults: - server_fqdn | default: `${hostname}.${domain}`
5 years ago
  1. ---
  2. - name: 'install openssl'
  3. apt:
  4. pkg: 'openssl'
  5. state: 'present'
  6. update_cache: true
  7. cache_valid_time: 3600
  8. tags:
  9. - 'install'
  10. - 'role:ldap::install'
  11. - name: 'update tls server ca'
  12. copy:
  13. content: '{{ ldap_tls_server_ca }}{{ tls_root_ca }}'
  14. dest: '/etc/ldap/server_ca.crt'
  15. - name: 'update tls user ca'
  16. copy:
  17. content: '{{ ldap_tls_user_ca }}{{ tls_root_ca }}'
  18. dest: '/etc/ldap/user_ca.crt'
  19. - name: 'generete and sign slapd tls certificate'
  20. import_role: name='ca_cert'
  21. vars:
  22. ca_cert_common_name: '{{ host_fqdn }}'
  23. ca_cert_proto: 'tls'
  24. ca_cert_tls_ca_path: '/etc/ldap/server_ca.crt'
  25. ca_cert_tls_key_path: '/etc/ldap/slapd.key'
  26. ca_cert_tls_cert_path: '/etc/ldap/slapd.crt'
  27. ca_cert_tls_csr_path: '/etc/ldap/slapd.csr'
  28. - name: 'set private key ownership'
  29. file:
  30. path: '/etc/ldap/slapd.key'
  31. owner: 'openldap'
  32. group: 'openldap'
  33. mode: '600'
  34. ## BROKEN! WAITING FOR ANSIBLE 2.10 ldap_attrs
  35. ## Currently you have to run 2-3 times to get proper configuration.
  36. - name: 'configuring TLS options'
  37. ## Remove after update to Ansible 2.10 --->
  38. ldap_attr:
  39. dn: 'cn=config'
  40. name: '{{ item.name }}'
  41. values: '{{ item.value }}'
  42. state: 'exact'
  43. loop:
  44. - { name: 'olcTLSCACertificateFile', value: '/etc/ldap/user_ca.crt' }
  45. - { name: 'olcTLSCertificateFile', value: '/etc/ldap/slapd.crt' }
  46. - { name: 'olcTLSCertificateKeyFile', value: '/etc/ldap/slapd.key' }
  47. - { name: 'olcTLSVerifyClient', value: 'try' } # TLS Client Auth
  48. - { name: 'olcTLSCipherSuite', value: 'SECURE:-VERS-ALL:+VERS-TLS1.3' } # TLSv1.3 Only
  49. ## <---
  50. ## Uncomment after update to Ansible 2.10 --->
  51. # ldap_attrs:
  52. # dn: 'cn=config'
  53. # attributes:
  54. # olcTLSCACertificateFile: '/etc/ldap/user_ca.crt'
  55. # olcTLSCertificateFile: '/etc/ldap/slapd.crt'
  56. # olcTLSCertificateKeyFile: '/etc/ldap/slapd.key'
  57. # olcTLSVerifyClient: 'try'
  58. # olcTLSCipherSuite: 'SECURE:-VERS-ALL:+VERS-TLS1.3'
  59. ## <---
  60. - name: 'configuring slapd service'
  61. lineinfile:
  62. line: 'SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"'
  63. regexp: '^SLAPD_SERVICES='
  64. path: '/etc/default/slapd'
  65. notify: 'restart slapd'
  66. ...