From 8e72f40aaa76465e928e6f51a1615d39ac258b39 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 21 Aug 2019 07:26:08 -0700 Subject: [PATCH] [ansible][attitude-adjuster] remove unused playbooks --- .../attitude-adjuster/homebridge/config.json | 16 ---- .../attitude-adjuster/homebridge/homebridge | 7 -- .../homebridge/homebridge.service | 17 ---- ansible/attitude-adjuster/homebridge/main.yml | 83 ------------------- .../homebridge/nodesource.list | 2 - ansible/attitude-adjuster/lighttpd/main.yml | 69 --------------- ansible/attitude-adjuster/nginx.yml | 72 ---------------- 7 files changed, 266 deletions(-) delete mode 100644 ansible/attitude-adjuster/homebridge/config.json delete mode 100644 ansible/attitude-adjuster/homebridge/homebridge delete mode 100644 ansible/attitude-adjuster/homebridge/homebridge.service delete mode 100644 ansible/attitude-adjuster/homebridge/main.yml delete mode 100644 ansible/attitude-adjuster/homebridge/nodesource.list delete mode 100644 ansible/attitude-adjuster/lighttpd/main.yml delete mode 100644 ansible/attitude-adjuster/nginx.yml diff --git a/ansible/attitude-adjuster/homebridge/config.json b/ansible/attitude-adjuster/homebridge/config.json deleted file mode 100644 index 543db76..0000000 --- a/ansible/attitude-adjuster/homebridge/config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "bridge": { - "name": "Homebridge", - "username": "{{ homebridge.username }}", - "port": 51826, - "pin": "{{ homebridge.pin }}" - }, - "platforms": [ - { - "platform": "SmartThings Cloud", - "name": "SmartThings Cloud", - "port": 3000, - "publicKey": "{{ homebridge.smartthings_public_key | b64encode }}" - } - ] -} diff --git a/ansible/attitude-adjuster/homebridge/homebridge b/ansible/attitude-adjuster/homebridge/homebridge deleted file mode 100644 index f5c2eb9..0000000 --- a/ansible/attitude-adjuster/homebridge/homebridge +++ /dev/null @@ -1,7 +0,0 @@ -# Defaults / Configuration options for homebridge -# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others) -HOMEBRIDGE_OPTS=-U /var/lib/homebridge - -# If you uncomment the following line, homebridge will log more -# You can display this via systemd's journalctl: journalctl -f -u homebridge -# DEBUG=* \ No newline at end of file diff --git a/ansible/attitude-adjuster/homebridge/homebridge.service b/ansible/attitude-adjuster/homebridge/homebridge.service deleted file mode 100644 index 41ab653..0000000 --- a/ansible/attitude-adjuster/homebridge/homebridge.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=Node.js HomeKit Server -After=syslog.target network-online.target - -[Service] -Type=simple -User=homebridge -EnvironmentFile=/etc/default/homebridge -# Adapt this to your specific setup (could be /usr/bin/homebridge) -# See comments below for more information -ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS -Restart=on-failure -RestartSec=10 -KillMode=process - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/ansible/attitude-adjuster/homebridge/main.yml b/ansible/attitude-adjuster/homebridge/main.yml deleted file mode 100644 index 443c462..0000000 --- a/ansible/attitude-adjuster/homebridge/main.yml +++ /dev/null @@ -1,83 +0,0 @@ -# https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi#install-avahi-and-other-dependencies - -- hosts: pi - vars_files: - - vars.yml.private - become: yes - tasks: - - - name: update apt to get a modern version of node - block: - - apt_key: - url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key - - copy: - src: nodesource.list - dest: /etc/apt/sources.list.d/nodesource.list - - - name: update apt - apt: - update_cache: yes - - - name: install dependencies - package: - name: "{{ item }}" - state: present - with_items: - - libavahi-compat-libdnssd-dev - - nodejs - - - name: install homebridge - npm: - name: "{{ item }}" - global: yes - with_items: - - homebridge - - homebridge-smartthings-cloud - - - name: copy systemd config - copy: - src: homebridge/{{ item.key }} - dest: "{{ item.value }}" - with_dict: - homebridge: /etc/default - homebridge.service: /etc/systemd/system - notify: - - reload systemd daemon - - enable and restart homebridge service - - - name: create homebridge user - user: - name: homebridge - password: ! - - - name: create homebridge dir - file: - path: /var/lib/homebridge - state: directory - owner: homebridge - - - name: copy homebridge config - template: - src: homebridge/config.json - dest: /var/lib/homebridge - owner: homebridge - notify: enable and restart homebridge service - - - name: allow access to homebridge - ufw: - rule: allow - proto: tcp - port: 51826 - state: reloaded - - handlers: - - - name: reload systemd daemon - systemd: - daemon_reload: yes - - - name: enable and restart homebridge service - service: - name: homebridge - enabled: yes - state: restarted diff --git a/ansible/attitude-adjuster/homebridge/nodesource.list b/ansible/attitude-adjuster/homebridge/nodesource.list deleted file mode 100644 index 3e984aa..0000000 --- a/ansible/attitude-adjuster/homebridge/nodesource.list +++ /dev/null @@ -1,2 +0,0 @@ -deb https://deb.nodesource.com/node_12.x stretch main -deb-src https://deb.nodesource.com/node_12.x stretch main diff --git a/ansible/attitude-adjuster/lighttpd/main.yml b/ansible/attitude-adjuster/lighttpd/main.yml deleted file mode 100644 index 420213e..0000000 --- a/ansible/attitude-adjuster/lighttpd/main.yml +++ /dev/null @@ -1,69 +0,0 @@ -# https://discourse.pi-hole.net/t/enabling-https-for-your-pi-hole-web-interface/5771 - -- hosts: attitude-adjuster - vars_files: - - vars.yml.private - become: yes - tasks: - - - name: install certbot - package: - name: certbot - state: present - - - name: obtain ssl certificates - command: >- - certbot certonly - --webroot --webroot-path /var/www/html - -d {{ item.fqdn }} - -m alpha+lets.encrypt@kejadlen.dev - --agree-tos - --non-interactive - args: - creates: /etc/letsencrypt/live/{{ item.fqdn }} - with_items: - - "{{ home }}" - - "{{ home_assistant }}" - - "{{ homebridge }}" - - "{{ pihole }}" - - - name: create combined pemfile - shell: >- - cat /etc/letsencrypt/live/{{ item.fqdn }}/privkey.pem - /etc/letsencrypt/live/{{ item.fqdn }}/cert.pem > - /etc/letsencrypt/live/{{ item.fqdn }}/combined.pem - args: - creates: /etc/letsencrypt/live/{{ item.fqdn }}/combined.pem - with_items: - - "{{ home }}" - - "{{ home_assistant }}" - - "{{ homebridge }}" - - "{{ pihole }}" - - - name: let lighttpd read the pemfile - file: - path: /etc/letsencrypt/live/{{ item.fqdn }} - state: directory - recurse: yes - owner: www-data - with_items: - - "{{ home }}" - - "{{ home_assistant }}" - - "{{ homebridge }}" - - "{{ pihole }}" - - - name: enable mod_proxy - command: lighttpd-enable-mod proxy - ignore_errors: yes - - - name: update lighttpd configuration - template: - src: external.conf.private - dest: /etc/lighttpd/external.conf - notify: restart lighttpd - - handlers: - - name: restart lighttpd - service: - name: lighttpd - state: restarted diff --git a/ansible/attitude-adjuster/nginx.yml b/ansible/attitude-adjuster/nginx.yml deleted file mode 100644 index 2ff7856..0000000 --- a/ansible/attitude-adjuster/nginx.yml +++ /dev/null @@ -1,72 +0,0 @@ -- hosts: attitude-adjuster - vars_files: - - vars.yml.private - become: yes - tasks: - - - name: install dependencies - package: - name: "{{ item }}" - state: present - with_items: - - certbot - - nginx - - python3-certbot-nginx - - - name: allow for long domain names - lineinfile: - path: /etc/nginx/nginx.conf - regexp: '^(\s*)# server_names_hash_bucket_size 64;$' - line: '\1server_names_hash_bucket_size 64;' - backrefs: yes - - - name: obtain ssl certs - command: >- - certbot certonly --nginx - -d {{ item }} - -m alpha+lets.encrypt@kejadlen.dev - --agree-tos - --non-interactive - args: - creates: /etc/letsencrypt/live/{{ item }} - with_items: - - "{{ home.fqdn }}" - - "{{ home_assistant.fqdn }}" - - "{{ pihole.fqdn }}" - - - name: configure nginx - copy: - content: | - server { - - server_name {{ fqdn }}; - - # Redirect non-https traffic to https - if ($scheme != "https") { - return 301 https://$host$request_uri; - } - - location / { - proxy_pass http://{{ proxy }}/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For nginx; - } - - listen 80; - - listen 443 ssl; - ssl_certificate /etc/letsencrypt/live/{{ fqdn }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/{{ fqdn }}/privkey.pem; - include /etc/letsencrypt/options-ssl-nginx.conf; - ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - - } - dest: /etc/nginx/conf.d/{{ fqdn }}.conf - vars: - fqdn: "{{ item.fqdn }}" - proxy: "{{ item.nginx.proxy }}" - with_items: - - "{{ home }}" - - "{{ home_assistant }}" - - "{{ pihole }}"