mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Deleting all ufw rules on every run so firewalls remain clean. Also reloading gunicorn.
This commit is contained in:
parent
1f7816f8ab
commit
bdd4857bae
10 changed files with 29 additions and 21 deletions
2
Makefile
2
Makefile
|
@ -77,5 +77,5 @@ deploy:
|
||||||
- docker stack deploy --with-registry-auth -c stack-compose.yml dev-stack
|
- docker stack deploy --with-registry-auth -c stack-compose.yml dev-stack
|
||||||
|
|
||||||
firewall:
|
firewall:
|
||||||
- ansible-playbook ansible/provision.yml --tags firewallx -l db
|
- ansible-playbook ansible/provision.yml --tags firewall -l db
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ groups:
|
||||||
app: inventory_hostname.startswith('app')
|
app: inventory_hostname.startswith('app')
|
||||||
# work: inventory_hostname.startswith('work') and inventory_hostname != "work"
|
# work: inventory_hostname.startswith('work') and inventory_hostname != "work"
|
||||||
node: inventory_hostname.startswith('node')
|
node: inventory_hostname.startswith('node')
|
||||||
# debug: inventory_hostname.startswith('debug')
|
# debugs: inventory_hostname.startswith('debug')
|
||||||
db: inventory_hostname.startswith('db')
|
db: inventory_hostname.startswith('db')
|
||||||
task: inventory_hostname.startswith('task')
|
task: inventory_hostname.startswith('task')
|
||||||
search: inventory_hostname.startswith('db-elasticsearch')
|
search: inventory_hostname.startswith('db-elasticsearch')
|
||||||
|
|
|
@ -15,5 +15,7 @@
|
||||||
when: "'elasticsearch' in group_names"
|
when: "'elasticsearch' in group_names"
|
||||||
- import_playbook: setup_task.yml
|
- import_playbook: setup_task.yml
|
||||||
when: "'task' in group_names"
|
when: "'task' in group_names"
|
||||||
|
- import_playbook: setup_debug.yml
|
||||||
|
when: "'debugs' in group_names"
|
||||||
- import_playbook: setup_consul_manager.yml
|
- import_playbook: setup_consul_manager.yml
|
||||||
when: "'consul' in group_names"
|
when: "'consul' in group_names"
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
---
|
---
|
||||||
|
- name: Stop ufw and delete all rules
|
||||||
|
ufw: state=reset
|
||||||
|
tags: ufw
|
||||||
|
|
||||||
- name: Set firewall default policy
|
- name: Set firewall default policy
|
||||||
ufw: state=enabled policy=reject
|
ufw: state=disabled policy=reject
|
||||||
tags: ufw
|
tags: ufw
|
||||||
#
|
#
|
||||||
# - name: Set ufw policy to deny all incoming connections
|
# - name: Set ufw policy to deny all incoming connections
|
||||||
|
@ -24,24 +28,21 @@
|
||||||
tags: ufw
|
tags: ufw
|
||||||
|
|
||||||
- name: Allow all access from RFC1918 networks to this host
|
- name: Allow all access from RFC1918 networks to this host
|
||||||
become: yes
|
|
||||||
ufw:
|
ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
with_items:
|
with_items:
|
||||||
- 10.0.0.0/8
|
- 10.0.0.0/8
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ groups['oldandnew'] | map('extract', hostvars, ['ansible_host']) }}"
|
|
||||||
tags: firewallx
|
|
||||||
|
|
||||||
- name: Allow all access from inventory hosts
|
- name: Allow all access from inventory hosts
|
||||||
become: yes
|
|
||||||
ufw:
|
ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
with_items: "{{ groups['oldandnew'] | map('extract', hostvars, ['ansible_host']) }}"
|
with_items: "{{ groups['oldandnew'] | map('extract', hostvars, ['ansible_host']) }}"
|
||||||
tags: firewall
|
when: "'oldandnew' in groups"
|
||||||
|
tags:
|
||||||
|
- firewall
|
||||||
|
- ufw
|
||||||
|
|
||||||
- name: Start ufw
|
- name: Start ufw
|
||||||
ufw: state=enabled
|
ufw: state=enabled
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
---
|
---
|
||||||
# TODO: Close firewall and remove below line. Firewall should exclude all but known IPs.
|
|
||||||
- name: Allow consul-manager ports
|
|
||||||
ufw: rule=allow port={{ item }}
|
|
||||||
become: yes
|
|
||||||
tags: ufw
|
|
||||||
with_items:
|
|
||||||
- "8300"
|
|
||||||
- "8301"
|
|
||||||
|
|
||||||
- name: Add the HashiCorp GPG key
|
- name: Add the HashiCorp GPG key
|
||||||
become: yes
|
become: yes
|
||||||
apt_key:
|
apt_key:
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
- name: reload haproxy configuration
|
- name: reload haproxy configuration
|
||||||
become: yes
|
become: yes
|
||||||
command: sudo docker kill --signal HUP haproxy
|
command: docker kill --signal HUP haproxy
|
||||||
listen: reload haproxy
|
listen: reload haproxy
|
||||||
|
|
|
@ -16,5 +16,6 @@
|
||||||
template:
|
template:
|
||||||
src: consul_service.json
|
src: consul_service.json
|
||||||
dest: /etc/consul.d/mongo.json
|
dest: /etc/consul.d/mongo.json
|
||||||
|
tags: consul
|
||||||
notify:
|
notify:
|
||||||
- reload consul
|
- reload consul
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: Start postgres container
|
- name: Start postgres container
|
||||||
|
become: yes
|
||||||
docker_container:
|
docker_container:
|
||||||
name: postgres
|
name: postgres
|
||||||
image: postgres:13.1
|
image: postgres:13.1
|
||||||
|
|
|
@ -8,3 +8,7 @@
|
||||||
state: reloaded
|
state: reloaded
|
||||||
listen: reload consul
|
listen: reload consul
|
||||||
|
|
||||||
|
- name: reload gunicorn
|
||||||
|
become: yes
|
||||||
|
command: docker kill --signal HUP newsblur_web
|
||||||
|
listen: reload gunicorn
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
copy:
|
copy:
|
||||||
src: /srv/secrets-newsblur/settings/docker_settings.py
|
src: /srv/secrets-newsblur/settings/docker_settings.py
|
||||||
dest: /srv/newsblur/newsblur_web/local_settings.py
|
dest: /srv/newsblur/newsblur_web/local_settings.py
|
||||||
|
register: app_changed
|
||||||
|
|
||||||
- name: Start NewsBlur Web Docker container
|
- name: Start NewsBlur Web Docker container
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -34,3 +35,10 @@
|
||||||
dest: /etc/consul.d/newsblur_web.json
|
dest: /etc/consul.d/newsblur_web.json
|
||||||
notify:
|
notify:
|
||||||
- reload consul
|
- reload consul
|
||||||
|
|
||||||
|
- name: Reload gunicorn
|
||||||
|
debug:
|
||||||
|
msg: Reloading gunicorn
|
||||||
|
notify: reload gunicorn
|
||||||
|
when: app_changed.changed
|
||||||
|
changed_when: app_changed.changed
|
||||||
|
|
Loading…
Add table
Reference in a new issue