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 @@
with_items: '{{freq_list.files}}'
- name: apt
become: true
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
apt:
state: latest
update_cache: true
......@@ -63,7 +63,7 @@
name: ksmtuned
state: started
enabled: true
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: stop firewalld
become: true
systemd:
......
......@@ -6,7 +6,7 @@
authorized_key:
user: "{{ ansible_user_id }}"
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
become: true
lineinfile:
......@@ -80,14 +80,14 @@
name: net.core.default_qdisc
value: fq
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
become: true
sysctl:
name: net.ipv4.tcp_congestion_control
value: bbr
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
become: true
pam_limits:
......@@ -100,7 +100,7 @@
apt:
update_cache: true
upgrade: dist
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: yum update
become: true
yum:
......@@ -127,7 +127,7 @@
update_cache: true
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
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: Ubuntu packages
become: true
apt:
......@@ -146,7 +146,7 @@
become: true
apt:
autoremove: true
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: epel 7
become: true
yum:
......@@ -194,6 +194,12 @@
dest: '~'
creates: '~/.vim'
remote_src: true
- name: ctags link
become: true
file:
src: /usr/bin/ctags
path: /usr/local/bin/ctags
state: link
- name: git user.email
git_config:
name: user.email
......
......@@ -18,7 +18,7 @@
update_cache: true
state: latest
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
become: true
yum:
......@@ -75,6 +75,8 @@
make:
chdir: '{{home_path}}/ygopro/build'
target: "config=release"
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro
shell: strip bin/release/ygopro
ignore_errors: true
......
......@@ -14,7 +14,7 @@
update_cache: true
state: latest
name: curl,wget,build-essential,tar,unzip,python,rsync
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: yum
yum:
state: latest
......
......@@ -5,7 +5,7 @@
update_cache: true
state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: Docker key
become: true
apt_key:
......
......@@ -5,7 +5,7 @@
update_cache: true
state: latest
name: mono-complete
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: mono yum key
become: true
rpm_key:
......
......@@ -5,7 +5,7 @@
update_cache: true
state: latest
name: curl,apt-transport-https,lsb-release,gnupg
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: node apt key
become: true
apt_key:
......
......@@ -32,7 +32,7 @@
name: wireguard,resolvconf
state: latest
update_cache: yes
when: ansible_distribution != 'CentOS'
when: ansible_os_family == 'Debian'
- name: WireGuard 源 (CentOS)
become: true
yum_repository:
......
......@@ -7,7 +7,7 @@
copy:
src: 'files/source/{{ansible_distribution|lower}}/sources.list'
dest: /etc/apt/sources.list
when: ansible_distribution != 'CentOS'
when: ansible_os_family == 'Debian'
- name: sudoers
become: true
lineinfile:
......@@ -71,14 +71,14 @@
name: net.core.default_qdisc
value: fq
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
become: true
sysctl:
name: net.ipv4.tcp_congestion_control
value: bbr
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
become: true
pam_limits:
......@@ -91,7 +91,7 @@
apt:
update_cache: true
upgrade: dist
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: yum update
become: true
yum:
......@@ -118,12 +118,12 @@
update_cache: true
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
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: apt autoremove
become: true
apt:
autoremove: true
when: "ansible_distribution != 'CentOS'"
when: "ansible_os_family == 'Debian'"
- name: epel 7
become: true
yum:
......
......@@ -77,6 +77,8 @@
make:
chdir: '{{home_path}}/ygopro-new/build'
target: 'config=release'
params:
NUM_THREADS: '{{ansible_processor_vcpus}}'
- name: strip ygopro
shell: strip bin/release/ygopro
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