aboutsummaryrefslogtreecommitdiffstats
path: root/roles/jails/01_ingress/tasks/main.yml
blob: 15992bde44b470715343c72a714514fe5bca64ed (plain)
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
- name: Set WAN hooks (test)
  set_fact:
    exec_prestart:
      - "ifconfig epw{{ jail_num }}a destroy 2>/dev/null || true"
      - "ifconfig epair{{ jail_num }}001 create"
      - "ifconfig epair{{ jail_num }}001a name epw{{ jail_num }}a"
      - "ifconfig epair{{ jail_num }}001b name epw{{ jail_num }}b"
      - "ifconfig brlan0 addm epw{{ jail_num }}a"
    exec_poststart:
      - "ifconfig epw{{ jail_num }}b vnet {{ jail_name }}"
      - "ifconfig epw{{ jail_num }}a up"
      - "jexec {{ jail_name }} ifconfig epw{{ jail_num }}b up"
      - "jexec {{ jail_name }} ifconfig epw{{ jail_num }}b inet {{ ingress_wan_static }}"
      - "jexec {{ jail_name }} route add default {{ lan_ipv4_gateway }}"
    exec_poststop:
      - "ifconfig epw{{ jail_num }}a destroy 2>/dev/null || true"
  when: not is_prod

- name: Set WAN hooks (prod)
  set_fact:
    exec_prestart:
      - "ifconfig epw{{ jail_num }}a destroy 2>/dev/null || true"
      - "ifconfig epair{{ jail_num }}001 create"
      - "ifconfig epair{{ jail_num }}001a name epw{{ jail_num }}a"
      - "ifconfig epair{{ jail_num }}001b name epw{{ jail_num }}b"
      - "ifconfig brwan0 addm epw{{ jail_num }}a"
    exec_poststart:
      - "ifconfig epw{{ jail_num }}b vnet {{ jail_name }}"
      - "ifconfig epw{{ jail_num }}a up"
      - "jexec {{ jail_name }} ifconfig epw{{ jail_num }}b up"
      - "jexec {{ jail_name }} dhclient epw{{ jail_num }}b"
      - "jexec {{ jail_name }} route add 10.6.210.0/24 {{ lan_ipv4_gateway }} || true"
    exec_poststop:
      - "ifconfig epw{{ jail_num }}a destroy 2>/dev/null || true"
  when: is_prod

- import_role:
    name: jail
    tasks_from: jail_setup

- name: Check if TLS certs exist
  stat:
    path: "/usr/local/etc/letsencrypt/live/{{ cert_name }}"
  register: _certbot_certs
  when: is_prod

- name: Pause for manual certbot setup
  pause:
    prompt: "Run certbot manually in the ingress jail to obtain certs, then press Enter."
  when: is_prod and not (_certbot_certs.stat.exists | default(true))

- import_role:
    name: jail
    tasks_from: jail_launch