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!

  • 相关阅读:
    女子腰背疼痛案
    老人心悸心膝部无力屈伸不利案
    经方生姜泻心汤临床应用发挥
    电话求诊易误治
    女子乳房结块案
    小儿手足口案
    门纯德老先生经验
    男子肋部掣痛案
    加味潜降汤治疗阴虚阳亢之眩晕(来自网络)
    三叉神经痛与芎胡六虫汤
  • 原文地址:https://www.cnblogs.com/changbo/p/7382563.html
Copyright © 2011-2022 走看看