Compare commits
2 Commits
8ec4722193
...
15583d482b
| Author | SHA1 | Date | |
|---|---|---|---|
| 15583d482b | |||
| 27070a4c2f |
@@ -663,7 +663,7 @@
|
||||
register: dev1_to_dev2_copy6
|
||||
changed_when: true
|
||||
failed_when: dev1_to_dev2_copy6.rc != 0
|
||||
|
||||
|
||||
- name: Make block scripts executable on DEV2
|
||||
delegate_to: localhost
|
||||
ansible.builtin.shell: |
|
||||
@@ -673,6 +673,28 @@
|
||||
executable: /bin/bash
|
||||
changed_when: true
|
||||
|
||||
- name: Publish redirect and block deployment journal
|
||||
delegate_to: localhost
|
||||
uri:
|
||||
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost | urlencode }}/{{ rmq_exchange | urlencode }}/publish"
|
||||
method: POST
|
||||
user: "{{ rmq_user }}"
|
||||
password: "{{ rmq_pass }}"
|
||||
force_basic_auth: true
|
||||
status_code: 200
|
||||
headers: { content-type: "application/json" }
|
||||
body_format: json
|
||||
body:
|
||||
properties: { content_type: "application/json" }
|
||||
routing_key: "{{ control_queue }}"
|
||||
payload: "{{ {
|
||||
'inscope_device': (ansible_hostname | default(inventory_hostname)),
|
||||
'task_name': 'journal_add',
|
||||
'task_result': 'redirect and block script deployed'
|
||||
} | to_json }}"
|
||||
payload_encoding: "string"
|
||||
changed_when: false
|
||||
|
||||
post_tasks:
|
||||
- name: Cleanup note
|
||||
delegate_to: localhost
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
set -eu
|
||||
|
||||
/bin/sh /root/stopblock.sh >/dev/null 2>&1 || true
|
||||
sleep 1
|
||||
#grep -q "block" /etc/rc.local || cat /root/rc.local-with > /etc/rc.local
|
||||
grep -qi "block" /etc/rc.local || sed -i '/^exit 0$/i\/root/startblock.sh' /etc/rc.local
|
||||
|
||||
LAN_IF="br-lan"
|
||||
LAN_NET="192.168.2.0/24"
|
||||
@@ -62,3 +65,4 @@ done
|
||||
iptables -I FORWARD 1 -i "$LAN_IF" -s "$LAN_NET" -j CAPTIVE_BLOCK
|
||||
|
||||
echo "OK: filter rules applied"
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
#cat /root/rc.local-with | grep -v block > /etc/rc.local
|
||||
|
||||
grep -qi "block" /etc/rc.local && sed -i '\|^/root/startblock\.sh$|d' /etc/rc.local
|
||||
|
||||
LAN_IF="br-lan"
|
||||
LAN_NET="192.168.2.0/24"
|
||||
|
||||
Reference in New Issue
Block a user