Commit 9d7e1d08 authored by nanahira's avatar nanahira

new

parent ee93a2d8
#!/bin/bash
sudo "$@"
if [ "$1" == "iptables-restore" ]; then
echo "# use iptables-restore --noflush" > ~/iptables-gateways
echo "*nat" >> ~/iptables-gateways
echo ":PREROUTING -" >> ~/iptables-gateways
sudo iptables -t nat -S PREROUTING | grep -- "-j DNAT" >> ~/iptables-gateways
echo "COMMIT" >> ~/iptables-gateways
sudo iptables-save > ~/ipt
fi
#!/bin/bash
sudo iptables "$@"
echo "# use iptables-restore --noflush" > ~/iptables-gateways
echo "*nat" >> ~/iptables-gateways
echo ":PREROUTING -" >> ~/iptables-gateways
sudo iptables -t nat -S PREROUTING | grep -- "-j DNAT" >> ~/iptables-gateways
echo "COMMIT" >> ~/iptables-gateways
sudo iptables-save > ~/ipt
---
- hosts: iptables
remote_user: root
tasks:
- name: scripts
copy:
src: files/gateways/{{item}}
dest: ~/{{item}}
mode: 0755
with_items:
- iptables-gateways-interpreter.sh
- name: save
shell: 'sudo iptables-save > {{item}}'
with_items:
- ipt
- ipt.bak
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
with_items: '{{freq_list.files}}' with_items: '{{freq_list.files}}'
- name: apt - name: apt
become: true become: true
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
apt: apt:
state: latest state: latest
update_cache: true update_cache: true
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
name: ksmtuned name: ksmtuned
state: started state: started
enabled: true enabled: true
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: stop firewalld - name: stop firewalld
become: true become: true
systemd: systemd:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
authorized_key: authorized_key:
user: "{{ ansible_user_id }}" user: "{{ ansible_user_id }}"
key: "{{ lookup('file', '../authorized_keys') }}" key: "{{ lookup('file', '../authorized_keys') }}"
# when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int != 8" # when: "ansible_os_family == 'Debian' or ansible_distribution_major_version|int != 8"
- name: sudoers - name: sudoers
become: true become: true
lineinfile: lineinfile:
...@@ -80,14 +80,14 @@ ...@@ -80,14 +80,14 @@
name: net.core.default_qdisc name: net.core.default_qdisc
value: fq value: fq
sysctl_set: true sysctl_set: true
when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 7" when: "ansible_os_family == 'Debian' or ansible_distribution_major_version|int > 7"
- name: TCP BBR - name: TCP BBR
become: true become: true
sysctl: sysctl:
name: net.ipv4.tcp_congestion_control name: net.ipv4.tcp_congestion_control
value: bbr value: bbr
sysctl_set: true sysctl_set: true
when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 7" when: "ansible_os_family == 'Debian' or ansible_distribution_major_version|int > 7"
- name: limit - name: limit
become: true become: true
pam_limits: pam_limits:
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
apt: apt:
update_cache: true update_cache: true
upgrade: dist upgrade: dist
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: yum update - name: yum update
become: true become: true
yum: yum:
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,xclip,astyle,python-setuptools,python-dev,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,nmap,mosh name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,xclip,astyle,python-setuptools,python-dev,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,nmap,mosh
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: Ubuntu packages - name: Ubuntu packages
become: true become: true
apt: apt:
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
become: true become: true
apt: apt:
autoremove: true autoremove: true
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: epel 7 - name: epel 7
become: true become: true
yum: yum:
...@@ -194,6 +194,12 @@ ...@@ -194,6 +194,12 @@
dest: '~' dest: '~'
creates: '~/.vim' creates: '~/.vim'
remote_src: true remote_src: true
- name: ctags link
become: true
file:
src: /usr/bin/ctags
path: /usr/local/bin/ctags
state: link
- name: git user.email - name: git user.email
git_config: git_config:
name: user.email name: user.email
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: wget,git,build-essential,libreadline-dev,libsqlite3-dev,libevent-dev,redis-server,p7zip-full name: wget,git,build-essential,libreadline-dev,libsqlite3-dev,libevent-dev,redis-server,p7zip-full
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: epel 7 - name: epel 7
become: true become: true
yum: yum:
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
make: make:
chdir: '{{home_path}}/ygopro/build' chdir: '{{home_path}}/ygopro/build'
target: "config=release" target: "config=release"
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro - name: strip ygopro
shell: strip bin/release/ygopro shell: strip bin/release/ygopro
ignore_errors: true ignore_errors: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,wget,build-essential,tar,unzip,python,rsync name: curl,wget,build-essential,tar,unzip,python,rsync
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: yum - name: yum
yum: yum:
state: latest state: latest
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: Docker key - name: Docker key
become: true become: true
apt_key: apt_key:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: mono-complete name: mono-complete
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: mono yum key - name: mono yum key
become: true become: true
rpm_key: rpm_key:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,apt-transport-https,lsb-release,gnupg name: curl,apt-transport-https,lsb-release,gnupg
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: node apt key - name: node apt key
become: true become: true
apt_key: apt_key:
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
name: wireguard,resolvconf name: wireguard,resolvconf
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_distribution != 'CentOS' when: ansible_os_family == 'Debian'
- name: WireGuard 源 (CentOS) - name: WireGuard 源 (CentOS)
become: true become: true
yum_repository: yum_repository:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
copy: copy:
src: 'files/source/{{ansible_distribution|lower}}/sources.list' src: 'files/source/{{ansible_distribution|lower}}/sources.list'
dest: /etc/apt/sources.list dest: /etc/apt/sources.list
when: ansible_distribution != 'CentOS' when: ansible_os_family == 'Debian'
- name: sudoers - name: sudoers
become: true become: true
lineinfile: lineinfile:
...@@ -71,14 +71,14 @@ ...@@ -71,14 +71,14 @@
name: net.core.default_qdisc name: net.core.default_qdisc
value: fq value: fq
sysctl_set: true sysctl_set: true
when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 7" when: "ansible_os_family == 'Debian' or ansible_distribution_major_version|int > 7"
- name: TCP BBR - name: TCP BBR
become: true become: true
sysctl: sysctl:
name: net.ipv4.tcp_congestion_control name: net.ipv4.tcp_congestion_control
value: bbr value: bbr
sysctl_set: true sysctl_set: true
when: "ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 7" when: "ansible_os_family == 'Debian' or ansible_distribution_major_version|int > 7"
- name: limit - name: limit
become: true become: true
pam_limits: pam_limits:
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
apt: apt:
update_cache: true update_cache: true
upgrade: dist upgrade: dist
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: yum update - name: yum update
become: true become: true
yum: yum:
...@@ -118,12 +118,12 @@ ...@@ -118,12 +118,12 @@
update_cache: true update_cache: true
state: latest state: latest
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,nmap,dnsutils,open-vm-tools name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,nmap,dnsutils,open-vm-tools
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: apt autoremove - name: apt autoremove
become: true become: true
apt: apt:
autoremove: true autoremove: true
when: "ansible_distribution != 'CentOS'" when: "ansible_os_family == 'Debian'"
- name: epel 7 - name: epel 7
become: true become: true
yum: yum:
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
make: make:
chdir: '{{home_path}}/ygopro-new/build' chdir: '{{home_path}}/ygopro-new/build'
target: 'config=release' target: 'config=release'
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro - name: strip ygopro
shell: strip bin/release/ygopro shell: strip bin/release/ygopro
args: args:
......
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