summaryrefslogtreecommitdiff
path: root/roles/acmetool/base/tasks/main.yml
blob: f19002b36920c6c6ee0c9e9f5980eeb6e3179b94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- name: check if acmetool package is new enough
  debug:
    msg: "Check distribution_release"
  failed_when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 9) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 17) or (ansible_distribution != 'Debian' and ansible_distribution != 'Ubuntu')

- name: install needed packages
  apt:
    name:
      - acmetool
      - "{{ python_basename }}-openssl"
    state: present

- name: create initial directory structure
  command: acmetool --batch
  args:
    creates: /var/lib/acme/conf

- name: create acmetool response file
  template:
    src: responses.j2
    dest: /var/lib/acme/conf/responses

- name: create non-standard acmetool webroot path
  file:
    name: "{{ acmetool_challenge_webroot_path }}"
    state: directory
  when: acmetool_challenge_webroot_path is defined

- name: run quickstart to create account and default target configuration
  command: acmetool --batch quickstart
  environment:
    http_proxy: "{{ acmetool_http_proxy | default('') }}"
    https_proxy: "{{ acmetool_https_proxy | default('') }}"
  args:
    creates: /var/lib/acme/conf/target

- name: generate selfsigned interim certificate
  include_tasks: selfsigned.yml

- name: install service reload configuration
  template:
    src: acme-reload.j2
    dest: /etc/default/acme-reload
    owner: root
    group: root
    mode: 0644
  when: acmetool_reload_services is defined

- name: create system unit snippet directory
  file:
    path: /etc/systemd/system/acmetool.service.d/
    state: directory

- name: install systemd unit snippet
  template:
    src: systemd-override.conf.j2
    dest: /etc/systemd/system/acmetool.service.d/override.conf

- name: enable/start systemd timer for acmetool
  systemd:
    name: acmetool.timer
    state: started
    enabled: yes
    daemon_reload: yes