zoukankan      html  css  js  c++  java
  • ansible之playbook

    一键基础环境部署脚本

    ---
    - hosts: commons
    tasks:
    - name: Bash environment install
    yum: name={{ item }} state=present
    with_items:
    - gcc
    - gcc-c++
    - gdb
    - readline-devel
    - bind-utils
    - lsof
    - dos2unix
    - mtr
    - hdparm
    - iptables-services
    - sysstat
    - wireshark
    - openssl
    - openssl-devel
    - nload
    - perl
    - perl-devel
    - perl-ExtUtils-Embed
    - nmap
    - ipset
    - telnet

    - file:
    path: /root/jb
    state: directory
    mode: 755

    - file:
    path: /tmp/trash
    state: directory
    mode: 755

    - copy:
    src: "/etc/ansible/modules/jb/iptables.sh"
    dest: "/root/jb/iptables.sh"

    - copy:
    src: /etc/ansible/modules/jb/trashclean.py
    dest: /root/jb/trashclean.py
    mode: o+x

    - cron:
    name: Clean trash
    minute: "1"
    hour: "23"
    day: "1"
    job: "/root/jb/trashclean.py"

    - unarchive:
    src: /etc/ansible/modules/jb/Python-3.5.2.tgz
    dest: /root/jb

    - name: About Python3
    command: /root/jb/Python-3.5.2/configure
    args:
    chdir: /root/jb/Python-3.5.2

    - name: About Python3
    command: /usr/bin/make
    args:
    chdir: /root/jb/Python-3.5.2

    - name: About Python3
    command: /usr/bin/make install
    args:
    chdir: /root/jb/Python-3.5.2

    - lineinfile:
    path: /etc/bashrc
    line: 'alias rm="mv --verbose -f --backup=numbered --target-directory /tmp/trash"'

    - lineinfile:
    path: /etc/profile
    line: 'export HISTFILESIZE=1000000'

    - lineinfile:
    path: /etc/profile
    line: 'export HISTSIZE=10000'

    - lineinfile:
    path: /etc/profile
    line: 'export PROMPT_COMMAND="history -a"'

    - lineinfile:
    path: /etc/profile
    line: 'export HISTTIMEFORMAT="`whoami`_%F %T : "'

    - name: About account
    command: useradd yunwei

    - name: Stop firewall
    command: systemctl stop firewalld.service

    - name: Start iptables
    command: systemctl enable iptables

    - name: Set blackip
    command: ipset create blackip hash:ip maxelem 1000000

    - name: Reboot server
    shell: /usr/sbin/reboot

     END!

  • 相关阅读:
    模板集合
    [NOIP2005普及组]循环(高精度+数学)
    KEYENCE Programming Contest 2021
    AtCoder Regular Contest 111
    Educational Codeforces Round 99 (Rated for Div. 2)
    AtCoder Beginner Contest 183翻车记
    上古退役选手康复训练1——CSP2020J-2
    [SNOI2020]取石子(数学+打表找规律)
    selenium爬取拉勾网招聘信息
    scrapy将爬取的数据存入MySQL数据库
  • 原文地址:https://www.cnblogs.com/changbo/p/7382563.html
Copyright © 2011-2022 走看看