Ansible常用的模块路人皆知: copy command raw shell yum…..,但这些模块仅仅只是Ansbile众多模块中的几个核心模块而已,除此之外,Ansible涵盖了更为庞大的额外模块,涉及到网络、监控、服务器硬件、云产品、存储设备等等,甚至还有数据库,几乎涉及到了所有的IT软硬件产品
Ansible 的官方文档将庞大的额外模块划分了几个大类
1.Cloud Modules
云模块库,覆盖了常见的aws、azure、openstack、vmvare等云产品,其中的aws模块群能够
管理ec2、vpc、elb、ami等多种aws产品
2.Database Modules
数据库模块库 支持 Mysql、influxdb、mongodb、postgresql、mssql等
3.Network Modules
支持 asa、ios、F5、ovs等主流网络设备
4.Source ControlModules
支持 svn、github、gitlab等
5.MonitoringModules
支持 nagios、zabbix等, zabbix能够添加、更新和删除主机、组和图形
还有其他的Clustering Modules Commands Modules Storage Modules CryptoModules 等等.
命令 ansible-doc -l 罗列所有模块
# ansible-doc -l|grep ec2 ec2 create,terminate, start or stop an instance in ec2 ec2_ami create or destroyan image in ec2 ec2_ami_copy copies AMI between AWSregions, return new image id ec2_ami_find Searches for AMIs toobtain the AMI ID and other information ec2_asg Create or deleteAWS Autoscaling Groups ec2_eip associate an EC2elastic IP with an instance. ec2_elb De-registers orregisters instances from EC2 ELBs ec2_elb_facts Gather facts about EC2Elastic Load Balancers in AWS ec2_elb_lb Creates or destroys Amazon ELB.
使用 命令ansible-doc ec2 -s 显示详细的模块用法
#ansible-doc ec2 -s - name: create,terminate, start or stop an instance in ec2 action: ec2 assign_public_ip # when provisioning within vpc, assign apublic IP address. Boto library must be 2.13.0+ aws_access_key # AWS access key. If not set then thevalue of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environmentvariable is used. aws_secret_key # AWS secret key. If not set then thevalue of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEYenvironment variable is used. count # number of instances tolaunch count_tag # Used with ‘exact_count‘ todetermine how many nodes based on a specific tag criteria should berunning. This can be expressed inmultiple ways and is shown inthe EXAMPLES section. For instance, onecan request 25 servers that are tagged with "class=webserver". The specified tag must already exist or bepassed in as the ‘instance_tags‘ option. ebs_optimized # whether instance is using optimizedEBS volumes, seehttp://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html ec2_url # Url to use to connect to EC2 oryour Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules ifregion is not used. If not set then the value of the EC2_URL environmentvariable, if any, is used. exact_count # An integer value which indicateshow many instances that match the ‘count_tag‘ parameter should be running.Instances are either created or terminated basedon this value.
时间: 2024-12-14 04:17:31