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!

  • 相关阅读:
    day10T3改错记
    day9T1改错记
    day8T1改错记
    洛谷P5068[Ynoi2015]我回来了(bfs+bitset)
    BZOJ4939[Ynoi2016]掉进兔子洞(莫队+bitset)
    [学习笔记]dsu on tree
    [学习笔记]FWT(快速沃尔什变换)
    [学习笔记]FMT(快速莫比乌斯变换)&子集卷积(待填坑)
    POJ-1743-Musical Theme(后缀数组)
    后缀数组模板
  • 原文地址:https://www.cnblogs.com/changbo/p/7382563.html
Copyright © 2011-2022 走看看