Commit d73acf23 authored by nanahira's avatar nanahira

add cloud nextgen

parent d0b3cc26
---
- hosts: rcloud
remote_user: root
vars:
mycard_domains:
- mycard.moe
- momobako.com
- yuzurisa.com
- moecube.com
- moestart.com
- moenext.com
- ygobbs.com
- newwise.com
- my-card.in
- mius.pro
bridges: []
dnsmasq:
mycardDomains: true
gfwlistIPSet: false
tasks:
- name: clean some rubbish packages
become: true
apt:
name: resolvconf
state: absent
- name: disable systemd-resolved
become: true
systemd:
name: systemd-resolved
state: stopped
enabled: false
masked: true
when: ansible_distribution == 'Ubuntu'
- name: iptables-gateways blank
file:
name: '{{ansible_user_dir}}/iptables-gateways'
state: touch
- name: iptables-gateways stuff
copy:
src: ./files/iptables-gateways/{{item}}
dest: '{{ansible_user_dir}}/{{item}}'
mode: 0755
with_items:
- iptables-forward.sh
- iptables-gateways-interpreter.sh
- name: dnsmasq directory
file:
name: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/{{item}}'
state: directory
recurse: true
with_items:
- smartdns
- dnsmasq.d
- misc
- smartdns-cache
- name: dnsmasq docker-compose
copy:
src: ./files/dnsmasq/docker-compose.yml
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/docker-compose.yml'
- name: dnsmasq.conf
template:
src: ./files/dnsmasq/dnsmasq.conf.j2
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/dnsmasq.conf'
notify: restart_dnsmasq
- name: smartdns.conf
template:
src: ./files/dnsmasq/smartdns.conf.j2
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/smartdns/smartdns.conf'
notify: restart_dnsmasq
- name: smartdns china list
copy:
src: ./data/china-list.conf
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/smartdns/china-list.conf'
notify: restart_dnsmasq
- name: update dnsmasq.d
synchronize:
src: ./mycard-dnsmasq/dnsmasq.d/
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/dnsmasq.d'
recursive: yes
verify_host: no
checksum: yes
archive: no
notify: restart_dnsmasq
when: dnsmasq.mycardDomains is defined and dnsmasq.mycardDomains
- name: gfwlist ipset
copy:
src: './data/gfwlist-ipset.conf'
dest: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/dnsmasq.d/gfwlist-ipset.conf'
when: dnsmasq.gfwlistIPSet is defined and dnsmasq.gfwlistIPSet
notify: restart_dnsmasq
- name: gfwlist ipset clean
file:
path: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq/dnsmasq.d/gfwlist-ipset.conf'
state: absent
when: dnsmasq.gfwlistIPSet is defined and not dnsmasq.gfwlistIPSet
notify: restart_dnsmasq
- name: start dnsmasq
docker_compose:
project_src: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq'
remove_orphans: true
- name: set resolv.conf
become: true
copy:
content: |
nameserver 127.0.0.1
dest: /etc/resolv.conf
handlers:
- name: restart_dnsmasq
docker_compose:
project_src: '{{ansible_user_dir}}/nextgen-router/services/dnsmasq'
restarted: true
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