Coder Social home page Coder Social logo

ansible_test's Introduction

ansible_test

一、ansible 安装

  • install ansible
cd ansible_test
sh install_ansible.sh
  • check ansible
ansible --version

ansible 2.9.24
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 14 2020, 14:45:30) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

二、ansible 执行

ansible-playbook -i hosts -e@config playbooks/xxx.yml
  • -i: 指定hosts文件
  • -e: 指定变量文件
  • playbooks/xxx.yml: 指定执行的playbook文件
  • -vvv: 指定日志级别
  • --syntax-check: 检查语法

执行顺序:

  • 指定config文件
  • 执行playbooks/xxx.yml文件
  • 执行制定的role文件
  • 执行制定的task文件
  • config文件中读取变量
  • group_vars文件中读取变量

三、ansible 常用模块

shell shell模块 copy copy模块 lineinfile lineinfile模块 file file模块
template template模块 unarchive unarchive模块

shell 模块

copy 模块

lineinfile 模块

file 模块

template 模块

unarchive 模块

ansible_test's People

Contributors

liushiju avatar

Forkers

xjzyy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.