• 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!

  • 相关阅读:
    二分法查找(C语言)
    冒泡排序法(C语言)
    Python 字符串操作方法大全
    guns搭建笔记
    mysql数据库下载及安装
    docker安装
    自动化学习路径及问题汇总目录
    UI自动化使用docker做并行执行
    allure趋势图无数据
    allure报告不显示@Attachment
  • 原文地址:https://www.cnblogs.com/changbo/p/7382563.html
Copyright © 2020-2023  润新知