Commit 8d17051f authored by nanahira's avatar nanahira

updates

parent e0f9949b
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
docker_compose: docker_compose:
project_src: '{{ansible_user_dir}}/nextgen-network/services' project_src: '{{ansible_user_dir}}/nextgen-network/services'
remove_orphans: true remove_orphans: true
pull: true
handlers: handlers:
- name: reload_switch_rules - name: reload_switch_rules
become: true become: true
......
- name: '{{conn.name}}: stop wireguard' - name: '{{conn.name}}: stop wireguard'
become: true
ignore_errors: true ignore_errors: true
systemd: systemd:
name: 'wg-quick@{{conn.name}}' name: 'wg-quick@{{conn.name}}'
state: stopped state: stopped
enabled: no enabled: no
- name: '{{conn.name}}: remove wg config files'
file:
path: '/etc/wireguard/{{conn.name}}.conf'
state: absent
# 因为测试期间频繁改动参数,这里手动down掉 # 因为测试期间频繁改动参数,这里手动down掉
# 调试wg的时候开这个,调试别的的时候注释掉 # 调试wg的时候开这个,调试别的的时候注释掉
- name: '{{conn.name}}: wg conf' - name: '{{conn.name}}: wg conf'
become: true
template: template:
src: wg.conf.j2 src: wg.conf.j2
dest: '/etc/wireguard/{{conn.name}}.conf' dest: '/etc/wireguard/{{conn.name}}.conf'
register: wg_conf_result register: wg_conf_result
- name: '{{conn.name}}: enable wg' - name: '{{conn.name}}: enable wg'
become: true
systemd: systemd:
name: 'wg-quick@{{conn.name}}' name: 'wg-quick@{{conn.name}}'
state: started state: started
...@@ -13,19 +15,21 @@ ...@@ -13,19 +15,21 @@
ignore_errors: true ignore_errors: true
register: 'wg_enable_result' register: 'wg_enable_result'
- name: '{{conn.name}}: restart wg' - name: '{{conn.name}}: restart wg'
become: true
systemd: systemd:
name: 'wg-quick@{{conn.name}}' name: 'wg-quick@{{conn.name}}'
state: restarted state: restarted
when: 'not wg_enable_result.changed and wg_conf_result.changed' when: 'not wg_enable_result.changed and wg_conf_result.changed'
ignore_errors: true ignore_errors: true
- name: '{{conn.name}}: config for setconf' - name: '{{conn.name}}: config for setconf'
become: true
template: template:
src: wg-setconf.conf.j2 src: wg-setconf.conf.j2
dest: '/tmp/{{conn.name}}-setconf.conf' dest: '/tmp/{{conn.name}}-setconf.conf'
register: 'wg_setconf_result' register: 'wg_setconf_result'
ignore_errors: true ignore_errors: true
when: 'not wg_enable_result.changed and not wg_conf_result.changed'
- name: '{{conn.name}}: wg setconf' - name: '{{conn.name}}: wg setconf'
become: true
ignore_errors: true ignore_errors: true
shell: 'wg setconf {{conn.name}} /tmp/{{conn.name}}-setconf.conf' shell: 'wg setconf {{conn.name}} /tmp/{{conn.name}}-setconf.conf'
when: 'not wg_enable_result.changed and not wg_conf_result.changed and wg_setconf_result.changed' when: 'wg_setconf_result.changed'
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
# wg # wg
- name: '{{conn.name}}: wg conf' - name: '{{conn.name}}: wg conf'
become: true
template: template:
src: wgfrp.conf.j2 src: wgfrp.conf.j2
dest: '/etc/wireguard/{{conn.name}}.conf' dest: '/etc/wireguard/{{conn.name}}.conf'
register: wg_conf_result register: wg_conf_result
- name: '{{conn.name}}: start wg' - name: '{{conn.name}}: start wg'
become: true
systemd: systemd:
name: 'wg-quick@{{conn.name}}' name: 'wg-quick@{{conn.name}}'
state: started state: started
...@@ -20,19 +22,21 @@ ...@@ -20,19 +22,21 @@
ignore_errors: true ignore_errors: true
register: wg_enable_result register: wg_enable_result
- name: '{{conn.name}}: restart wg' - name: '{{conn.name}}: restart wg'
become: true
ignore_errors: true ignore_errors: true
systemd: systemd:
name: 'wg-quick@{{conn.name}}' name: 'wg-quick@{{conn.name}}'
state: restarted state: restarted
when: 'not wg_enable_result.changed and wg_conf_result.changed' when: 'not wg_enable_result.changed and wg_conf_result.changed'
- name: '{{conn.name}}: config for setconf' - name: '{{conn.name}}: config for setconf'
become: true
ignore_errors: true ignore_errors: true
template: template:
src: wgfrp-setconf.conf.j2 src: wgfrp-setconf.conf.j2
dest: '/tmp/{{conn.name}}-setconf.conf' dest: '/tmp/{{conn.name}}-setconf.conf'
register: 'wg_setconf_result' register: 'wg_setconf_result'
when: 'not wg_enable_result.changed and not wg_conf_result.changed'
- name: '{{conn.name}}: wg setconf' - name: '{{conn.name}}: wg setconf'
become: true
ignore_errors: true ignore_errors: true
shell: 'wg setconf {{conn.name}} /tmp/{{conn.name}}-setconf.conf' shell: 'wg setconf {{conn.name}} /tmp/{{conn.name}}-setconf.conf'
when: 'not wg_enable_result.changed and not wg_conf_result.changed and wg_setconf_result.changed' when: 'wg_setconf_result.changed'
...@@ -10,9 +10,9 @@ set -e ...@@ -10,9 +10,9 @@ set -e
mkdir -p result mkdir -p result
npm start npm start
cd lists #cd lists
./run.sh #./run.sh
cd .. #cd ..
cd ansible || exit cd ansible || exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment