aboutsummaryrefslogtreecommitdiffstats
path: root/nms/ansible/roles/nmsfront/tasks/main.yml
blob: d4e8d002bb18e24f5cf2c3b6f4ee9685914e62e0 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
- name: Basic packages
  apt: name={{ item }} state=present
  with_items:
  - python-demjson
  - python-passlib
  - libcapture-tiny-perl
  - libcommon-sense-perl
  - libdata-dumper-simple-perl
  - libdbd-pg-perl
  - libdbi-perl
  - libdigest-perl
  - libjson-perl
  - libjson-xs-perl
  - libnetaddr-ip-perl
  - libnet-cidr-perl
  - libnet-ip-perl
  - libnet-openssh-perl
  - libnet-oping-perl
  - libnet-rawip-perl
  - libsnmp-perl
  - libsocket6-perl
  - libsocket-perl
  - libswitch-perl
  - libtimedate-perl
  - perl
  - perl-base
  - perl-modules
  - varnish
  - libfreezethaw-perl		
  - apache2

- name: Enable CGI
  apache2_module: state=present name=cgid
  notify:
      - restart apache

- name: Remove default apache site
  file: path=/etc/apache2/sites-enabled/000-default.conf  state=absent
  notify:
      - restart apache

- name: Add NMS site config
  file: src=/srv/tgmanage/web/etc/apache2/nms.tg16.gathering.org.conf dest=/etc/apache2/sites-enabled/nms.tg16.gathering.org.conf state=link
  notify:
      - restart apache

- name: "Apache: Don't listen on 80"
  lineinfile: line="Listen 80" state=absent dest=/etc/apache2/ports.conf
  notify:
      - restart apache

- name: "Apache: DO listen on 8080"
  lineinfile: line="Listen 8080" state=present dest=/etc/apache2/ports.conf
  notify:
      - restart apache

- name: "Varnish: Set up VCL"
  file: path=/etc/varnish/default.vcl src=/srv/tgmanage/web/etc/varnish/nms.vcl state=link force=true
  notify:
      - restart varnish

- name: "Varnish: Remove default systemd config"
  lineinfile: line="ExecStart=/usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m" state=absent dest=/lib/systemd/system/varnish.service
  notify:
      - restart varnish

- name: "Varnish: Add sensible systemd config"
  lineinfile: line="ExecStart=/usr/sbin/varnishd -f /etc/varnish/default.vcl -s malloc,256m" state=present dest=/lib/systemd/system/varnish.service insertafter="Service"
  notify:
      - restart varnish

- name: Setup basic auth for nms read-only
  htpasswd: path=/srv/tgmanage/web/htpasswd-read name=tg password={{ htpasswd_tg }} owner=root group=www-data mode=0640

- name: Setup basic auth for nms write-only
  htpasswd: path=/srv/tgmanage/web/htpasswd-write name=tg password={{ htpasswd_tg }} owner=root group=www-data mode=0640