Commit 04183657 authored by nanahira's avatar nanahira

use include

parent 0412c3b5
--- # Ubuntu and Debian only
- name: basic packages for docker
become: true
apt:
update_cache: true
state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync
- name: Docker key
become: true
apt_key:
url: https://mirrors.aliyun.com/docker-ce/linux/debian/gpg
when: "ansible_distribution == 'Debian'"
- name: Docker source clean
become: true
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
state: absent
when: "ansible_distribution == 'Debian'"
- name: Docker source
become: true
apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
when: "ansible_distribution == 'Debian'"
- name: Docker for Debian
become: true
apt:
state: latest
update_cache: true
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Debian'"
- name: Docker for Ubuntu
become: true
apt:
state: latest
update_cache: true
name: docker.io,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Ubuntu'"
- name: docker user group
become: true
user:
name: '{{ansible_user_id}}'
append: true
groups: docker
when: "ansible_user_id != 'root'"
- name: docker-compose pip
become: true
pip:
name: pip
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
- name: docker-compose
become: true
pip:
name: docker-compose
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
---
- name: mono from apt
become: true
apt:
update_cache: true
state: latest
name: mono-complete
when: "ansible_distribution != 'CentOS'"
- name: mono yum key
become: true
rpm_key:
key: 'http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'
when: "ansible_distribution == 'CentOS'"
- name: mono yum source
become: true
yum_repository:
name: mono
description: mono
baseurl: 'https://download.mono-project.com/repo/centos{{ansible_distribution_major_version}}-stable/'
ip_resolve: 4
gpgkey: "https://download.mono-project.com/repo/xamarin.gpg"
when: "ansible_distribution == 'CentOS'"
- name: mono from yum
become: true
yum:
state: latest
update_cache: true
name: mono-complete
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: mono from dnf
become: true
dnf:
state: latest
name: mono-complete
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
---
- name: basic packages for node
become: true
apt:
update_cache: true
state: latest
name: curl,apt-transport-https,lsb-release,gnupg
when: "ansible_distribution != 'CentOS'"
- name: node apt key
become: true
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodesource
become: true
with_items:
- deb
- deb-src
apt_repository:
filename: nodesource
repo: '{{item}} https://deb.nodesource.com/node_{{nodejs_version}}.x {{ansible_distribution_release}} main'
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from nodesource
become: true
apt:
state: latest
name: nodejs
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from apt
become: true
apt:
state: latest
name: npm
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 9)"
- name: epel 7
become: true
yum:
state: latest
update_cache: true
name: epel-release
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: nodejs from yum
become: true
yum:
state: latest
update_cache: true
name: npm
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: epel 8
become: true
dnf:
state: latest
name: epel-release
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: nodejs from dnf
become: true
dnf:
state: latest
name: nodejs,npm
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: npm
become: true
npm:
name: 'n'
state: latest
global: true
- name: nodejs version
become: true
shell: 'n {{nodejs_version}}'
- name: node setcap
become: true
with_items: ['/usr/bin/node', '/usr/local/bin/node']
shell: 'setcap cap_net_bind_service=+eip {{item}}'
when: "ansible_user_id != 'root'"
- name: npm
become: true
with_items:
- npm
- pm2
npm:
name: '{{item}}'
state: latest
global: true
- name: fixup npm directory
become: true
file:
path: ~/.npm
owner: '{{ansible_user_id}}'
group: '{{ansible_user_id}}'
recurse: true
......@@ -2,60 +2,5 @@
- hosts: docker
remote_user: root
tasks:
- name: apt
become: true
apt:
update_cache: true
state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,tar,unzip,rsync
- name: Docker key
become: true
apt_key:
url: https://mirrors.aliyun.com/docker-ce/linux/debian/gpg
when: "ansible_distribution == 'Debian'"
- name: Docker source clean
become: true
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
state: absent
when: "ansible_distribution == 'Debian'"
- name: Docker source
become: true
apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
when: "ansible_distribution == 'Debian'"
- name: Docker for Debian
become: true
apt:
state: latest
update_cache: true
name: docker-ce,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Debian'"
- name: Docker for Ubuntu
become: true
apt:
state: latest
update_cache: true
name: docker.io,python-backports-shutil-get-terminal-size,python-backports.ssl-match-hostname,python-pip
when: "ansible_distribution == 'Ubuntu'"
- name: docker user group
become: true
user:
name: '{{ansible_user_id}}'
append: true
groups: docker
when: "ansible_user_id != 'root'"
- name: docker-compose pip
become: true
pip:
name: pip
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
- name: docker-compose
become: true
pip:
name: docker-compose
state: latest
extra_args: -i https://mirrors.aliyun.com/pypi/simple/
- name: docker
include: includes/docker.yml
---
- hosts: srvpro
remote_user: root
#vars:
vars:
nodejs_version: 12
# home_path: ~
# fork: mycard
tasks:
- name: curl
become: true
apt:
update_cache: true
state: latest
name: curl,apt-transport-https,lsb-release,gnupg
when: "ansible_distribution != 'CentOS'"
- name: node apt key
become: true
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodesource
become: true
with_items:
- deb
- deb-src
apt_repository:
filename: nodesource
repo: '{{item}} https://deb.nodesource.com/node_12.x {{ansible_distribution_release}} main'
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs
include: includes/nodejs.yml
- name: mono
include: includes/mono.yml
- name: apt
become: true
apt:
update_cache: true
state: latest
name: wget,git,build-essential,libreadline-dev,libsqlite3-dev,libevent-dev,mono-complete,redis-server,p7zip-full
name: wget,git,build-essential,libreadline-dev,libsqlite3-dev,libevent-dev,redis-server,p7zip-full
when: "ansible_distribution != 'CentOS'"
- name: nodejs from nodesource
become: true
apt:
state: latest
name: nodejs
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from apt
become: true
apt:
state: latest
name: npm
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 9)"
- name: mono yum key
become: true
rpm_key:
key: 'http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'
when: "ansible_distribution == 'CentOS'"
- name: mono yum source
become: true
yum_repository:
name: mono
description: mono
baseurl: 'https://download.mono-project.com/repo/centos{{ansible_distribution_major_version}}-stable/'
ip_resolve: 4
gpgkey: "https://download.mono-project.com/repo/xamarin.gpg"
when: "ansible_distribution == 'CentOS'"
- name: epel 7
become: true
yum:
......@@ -66,16 +24,12 @@
update_cache: true
name: epel-release,curl
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
#- name: node source
# become: true
# shell: 'curl -sL https://rpm.nodesource.com/setup_12.x | bash -'
# when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: yum
become: true
yum:
state: latest
update_cache: true
name: wget,git,npm,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,mono-complete,redis,p7zip,p7zip-plugins,tar,unzip
name: wget,git,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,redis,p7zip,p7zip-plugins,tar,unzip
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int <= 7"
- name: epel 8
become: true
......@@ -87,31 +41,8 @@
become: true
dnf:
state: latest
name: curl,wget,git,nodejs,npm,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,mono-complete,redis,p7zip,p7zip-plugins,tar,unzip
name: curl,wget,gcc,gcc-c++,make,sqlite-devel,readline-devel,openssl-devel,libevent-devel,redis,p7zip,p7zip-plugins,tar,unzip
when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version|int == 8"
- name: npm
become: true
npm:
name: 'n'
state: latest
global: true
- name: nodejs version
become: true
shell: n 12
- name: node setcap
become: true
with_items: ['/usr/bin/node', '/usr/local/bin/node']
shell: 'setcap cap_net_bind_service=+eip {{item}}'
when: "ansible_user_id != 'root'"
- name: npm
become: true
with_items:
- npm
- pm2
npm:
name: '{{item}}'
state: latest
global: true
- name: ygopro
git:
repo: 'https://github.com/{{fork}}/ygopro'
......
---
- hosts: pter
remote_user: root
vars:
nodejs_version: 10
tasks:
- name: nodejs
include: includes/nodejs.yml
- name: docker
include: includes/docker.yml
- name: apt
apt:
update_cache: true
state: latest
name: curl,wget,apt-transport-https,lsb-release,gnupg,build-essential,tar,unzip,python,rsync
- name: nodesource
with_items:
- deb
- deb-src
apt_repository:
filename: nodesource
repo: '{{item}} https://deb.nodesource.com/node_12.x {{ansible_distribution_release}} main'
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from nodesource
apt:
update_cache: true
state: latest
name: nodejs
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int < 9)"
- name: nodejs from apt
apt:
update_cache: true
state: latest
name: npm
when: "(ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 18) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 9)"
- name: Docker key
apt_key:
url: https://mirrors.aliyun.com/docker-ce/linux/debian/gpg
when: "ansible_distribution == 'Debian'"
- name: Docker source
apt_repository:
repo: deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable
filename: docker
when: "ansible_distribution == 'Debian'"
- name: Docker for Debian
apt:
state: latest
update_cache: true
name: docker-ce
when: "ansible_distribution == 'Debian'"
- name: Docker for Ubuntu
apt:
state: latest
update_cache: true
name: docker.io
when: "ansible_distribution == 'Ubuntu'"
- name: npm
npm:
name: 'n'
state: latest
global: true
- name: nodejs version
shell: n 10
- name: npm
with_items:
- npm
- pm2
npm:
name: '{{item}}'
state: latest
global: true
- name: docker systemd
systemd:
state: started
name: docker
name: curl,wget,build-essential,tar,unzip,python,rsync
- name: directories
file:
path: '/srv/{{item}}'
......
......@@ -2,6 +2,8 @@
- hosts: utility
remote_user: root
tasks:
- name: docker
include: includes/docker.yml
- name: utility directory
file:
path: /root/utility
......
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