Skip to content

Instantly share code, notes, and snippets.

@muziyoshiz
Last active October 5, 2017 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muziyoshiz/f581268abe1c821cd1e9 to your computer and use it in GitHub Desktop.
Save muziyoshiz/f581268abe1c821cd1e9 to your computer and use it in GitHub Desktop.
A list of new modules and options in Ansible 2.0
# -*- coding: utf-8 -*-
require 'anemone'
version = ARGV[0] || "2.0"
class ModulePage
attr_accessor :category, :url, :name, :description, :is_extras, :version_added, :options
def to_markdown
s = "* ["
s << "#{@name}"
s << " (E)" if @is_extras
s << " #{@description}"
s << "](#{@url})"
end
end
class ModulePageOption
attr_accessor :parameter, :required, :default, :choices, :comments, :version_added
def to_markdown
" * #{@parameter}: #{@comments}"
end
end
module_pages = []
Anemone.crawl("http://docs.ansible.com/ansible/list_of_all_modules.html", :depth_limit => 1) do |anemone|
anemone.focus_crawl do |page|
page.links.keep_if do |link|
link.to_s.match(/_module\.html$/)
end
end
anemone.on_pages_like(/_module\.html$/) do |page|
mpage = ModulePage.new
mpage.url = page.url
# Get module category from <li class="toctree-l2 current">
# "All Modules" is ignored
mpage.category = "Uncategorized"
page.doc.xpath('//li[@class="toctree-l2 current"]').each do |li|
category = li.inner_text
mpage.category = category if category != "All Modules"
end
# Get module name and description from <title>
title = page.doc.xpath('//title').inner_text
unless title.empty?
if desc = title.match(/^([^ ]+) (.+) — Ansible Documentation/)
mpage.name = desc[1]
mpage.description = desc[2]
end
end
# Check if <div id="this-is-an-extras-module"> exists
mpage.is_extras = !page.doc.xpath('//*[@id="this-is-an-extras-module"]').inner_text.empty?
# Get versionadded from <span class="versionmodified">New in version {{version}}.</span>
version_text = page.doc.xpath('//*[@class="versionmodified"]').inner_text
unless version_text.empty?
# Get version number from "New in version x.y."
if mod_ver = version_text.match(/New in version (\d+\.\d+)/)
mpage.version_added = mod_ver[1]
end
end
# Get options from <div id="options">
mpage.options = []
page.doc.xpath('//*[@id="options"]//tr').each do |tr|
mopt = ModulePageOption.new
mopt.parameter = tr.search("td[1]").text
mopt.required = tr.search("td[2]").text
mopt.default = tr.search("td[3]").text
mopt.choices = tr.search("td[4]").text
mopt.comments = tr.search("td[5]").text
if opt_ver = mopt.parameter.match(/^(.+) \(added in (\d+\.\d+)/)
mopt.parameter = opt_ver[1]
mopt.version_added = opt_ver[2]
end
mpage.options << mopt
end
module_pages << mpage
end
end
# Create a list of categories
categories = module_pages.map{|m| m.category }.uniq.sort
print "## Modules added in version #{version}\n"
categories.each do |category|
cat_module_pages = module_pages.select{|m|
m.version_added == version and m.category == category
}.sort_by{|m| m.name }
if cat_module_pages.size > 0
print "\n### #{category}\n\n"
cat_module_pages.each{|m| puts m.to_markdown }
end
end
print "\n## Options added in version #{version}\n"
categories.each do |category|
cat_module_pages = module_pages.select{|m|
m.version_added != version and m.category == category
}.select{|m|
m.options.select{|o| o.version_added == version }.size > 0
}
if cat_module_pages.size > 0
print "\n### #{category}\n\n"
cat_module_pages.each do |m|
puts m.to_markdown
m.options.select{|o| o.version_added == version }.each{|o| puts o.to_markdown }
end
end
end

Modules added in version 2.0

Cloud Modules

Clustering Modules

Commands Modules

Database Modules

Files Modules

Messaging Modules

Monitoring Modules

Network Modules

Notification Modules

Packaging Modules

System Modules

Web Infrastructure Modules

Windows Modules

Options added in version 2.0

Cloud Modules

  • azure - create or terminate a virtual machine in azure
    • auto_updates: Enable Auto Updates on Windows Machines
    • enable_winrm: Enable winrm on Windows Machines
    • os_type: The type of the os that is gettings provisioned
  • cloudformation - Create or delete an AWS CloudFormation stack
    • notification_arns: The Simple Notification Service (SNS) topic ARNs to publish stack related events.
    • template_format: For local templates, allows specification of json or yaml format
    • template_url: Location of file containing the template body. The URL must point to a template (max size 307,200 bytes) located in an S3 bucket in the same region as the stack. This parameter is mutually exclusive with 'template'. Either one of them is required if "state" parameter is "present"
  • digital_ocean - Create/delete a droplet/SSH_key in DigitalOcean
    • user_data: opaque blob of data which is made available to the droplet
  • docker_image - manage docker images
    • docker_api_version: Remote API version to use. This defaults to the current default as specified by docker-py.
    • dockerfile: Dockerfile to use
    • tls_ca_cert: Path to a PEM-encoded certificate authority to secure the Docker connection. This has no effect if use_tls is encrypt.
    • tls_client_cert: Path to the PEM-encoded certificate used to authenticate docker client. If specified tls_client_key must be valid
    • tls_client_key: Path to the PEM-encoded key used to authenticate docker client. If specified tls_client_cert must be valid
    • tls_hostname: A hostname to check matches what's supplied in the docker server's certificate. If unspecified, the hostname is taken from the docker_url.
    • use_tls: Whether to use tls to connect to the docker server. "no" means not to use tls (and ignore any other tls related parameters). "encrypt" means to use tls to encrypt the connection to the server. "verify" means to also verify that the server's certificate is valid for the server (this both verifies the certificate against the CA and that the certificate was issued for that host. If this is unspecified, tls will only be used if one of the other tls options require it.
  • docker - manage docker containers
    • cap_add: Add capabilities for the container. Requires docker-py >= 0.5.0.
    • cap_drop: Drop capabilities for the container. Requires docker-py >= 0.5.0.
    • cpu_set: CPUs in which to allow execution. Requires docker-py >= 0.6.0.
    • docker_user: Username or UID to use within the container
    • extra_hosts: Dict of custom host-to-IP mappings to be defined in the container
    • log_driver: You can specify a different logging driver for the container than for the daemon. "json-file" Default logging driver for Docker. Writes JSON messages to file. docker logs command is available only for this logging driver. "none" disables any logging for the container. "syslog" Syslog logging driver for Docker. Writes log messages to syslog. docker logs command is not available for this logging driver. "journald" Journald logging driver for Docker. Writes log messages to "journald". "gelf" Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. "fluentd" Fluentd logging driver for Docker. Writes log messages to "fluentd" (forward input). "awslogs" (added in 2.1) Awslogs logging driver for Docker. Writes log messages to AWS Cloudwatch Logs. If not defined explicitly, the Docker daemon's default ("json-file") will apply. Requires docker >= 1.6.0.
    • log_opt: Additional options to pass to the logging driver selected above. See Docker log-driver <https://docs.docker.com/reference/logging/overview/> documentation for more information. Requires docker >=1.7.0.
    • read_only: Mount the container's root filesystem as read only
    • signal: With the state "killed", you can alter the signal sent to the container.
    • stop_timeout: How many seconds to wait for the container to stop before killing it.
  • ec2 - create, terminate, start or stop an instance in ec2
    • network_interfaces: A list of existing network interfaces to attach to the instance at launch. When specifying existing network interfaces, none of the assign_public_ip, private_ip, vpc_subnet_id, group, or group_id parameters may be used. (Those parameters are for creating a new network interface at launch.) aliases: network_interface
    • spot_type: Type of spot request; one of "one-time" or "persistent". Defaults to "one-time" if not supplied.
    • termination_protection: Enable or Disable the Termination Protection
  • ec2_ami - create or destroy an image in ec2
    • device_mapping: An optional list of device hashes/dictionaries with custom configurations (same block-device-mapping parameters)Valid properties include: device_name, volume_type, size (in GB), delete_on_termination (boolean), no_device (boolean), snapshot_id, iops (for io1 volume_type)
    • launch_permissions: Users and groups that should be able to launch the ami. Expects dictionary with a key of user_ids and/or group_names. user_ids should be a list of account ids. group_name should be a list of groups, "all" is the only acceptable value currently.
    • tags: a hash/dictionary of tags to add to the new image; '{"key":"value"}' and '{"key":"value","key":"value"}'
  • ec2_asg - Create or delete AWS Autoscaling Groups
    • default_cooldown: The number of seconds after a scaling activity completes before another can begin.
    • termination_policies: An ordered list of criteria used for selecting instances to be removed from the Auto Scaling group when reducing capacity.For 'Default', when used to create a new autoscaling group, the "Default" value is used. When used to change an existent autoscaling group, the current termination policies are mantained
  • ec2_eip - associate an EC2 elastic IP with an instance.
    • device_id: The id of the device for the EIP. Can be an EC2 Instance id or Elastic Network Interface (ENI) id. aliases: instance_id
    • release_on_disassociation: whether or not to automatically release the EIP when it is disassociated
  • ec2_elb_lb - Creates or destroys Amazon ELB.
    • access_logs: An associative array of access logs configuration settings (see example)
    • idle_timeout: ELB connections from clients and to servers are timed out after this amount of time
    • security_group_names: A list of security group names to apply to the elb
    • stickiness: An associative array of stickness policy settings. Policy will be applied to all listeners ( see example )
  • ec2_lc - Create or delete AWS Autoscaling Launch Configurations
    • classic_link_vpc_id: Id of ClassicLink enabled VPC
    • classic_link_vpc_security_groups: A list of security group id's with which to associate the ClassicLink VPC instances.
  • ec2_snapshot - creates a snapshot from an existing volume
    • last_snapshot_min_age: If the volume's most recent snapshot has started less than `last_snapshot_min_age' minutes ago, a new snapshot will not be created.
  • elasticache - Manage cache clusters in Amazon Elasticache.
    • cache_parameter_group: The name of the cache parameter group to associate with this cache cluster. If this argument is omitted, the default cache parameter group for the specified engine will be used. aliases: parameter_group
    • cache_subnet_group: The subnet group name to associate with. Only use if inside a vpc. Required if inside a vpc
  • gce_img (E) - utilize GCE image resources
    • timeout: timeout for the operation
  • gc_storage - This module manages objects/buckets in Google Cloud Storage.
    • headers: Headers to attach to object.
  • gce - create or terminate GCE instances
  • lxc_container (E) - Manage LXC Containers
    • clone_name: Name of the new cloned server. This is only used when state is clone.
    • clone_snapshot: Create a snapshot a container when cloning. This is not supported by all container storage backends. Enabling this may fail if the backing store does not support snapshots.
  • rax_cdb - create/delete or resize a Rackspace Cloud Databases instance
    • cdb_type: type of instance (i.e. MySQL, MariaDB, Percona) aliases: type
    • cdb_version: version of database (MySQL supports 5.1 and 5.6, MariaDB supports 10, Percona supports 5.6) aliases: version
  • rds - create, delete, or modify an Amazon rds instance
    • force_failover: Used only when command=reboot. If enabled, the reboot is done using a MultiAZ failover.
  • route53 - add or delete entries in Amazons Route53 DNS service
    • failover: Failover resource record sets only. Whether this is the primary or secondary resource record set.
    • health_check: Health check to associate with this record
    • hosted_zone_id: The Hosted Zone ID of the DNS zone to modify
    • identifier: Weighted and latency-based resource record sets only. An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type.
    • region: Latency-based resource record sets only Among resource record sets that have the same combination of DNS name and type, a value that determines which region this should be associated with for the latency-based routing
    • vpc_id: When used in conjunction with private_zone: true, this will only modify records in the private hosted zone attached to this VPC.This allows you to have multiple private hosted zones, all with the same name, attached to different VPCs.
    • weight: Weighted resource record sets only. Among resource record sets that have the same combination of DNS name and type, a value that determines what portion of traffic for the current resource record set is routed to the associated location.
  • s3 - manage objects in S3.
    • encrypt: When set for PUT mode, asks for server-side encryption
    • headers: Custom headers for PUT operation, as a dictionary of 'key=value' and 'key=value,key=value'.
    • marker: Specifies the key to start with when using list mode. Object keys are returned in alphabetical order, starting with key after the marker in order.
    • max_keys: Max number of results to return in list mode, set this if you want to retrieve fewer than the default 1000 keys.
    • permission: This option let's the user set the canned permissions on the object/bucket that are created. The permissions that can be set are 'private', 'public-read', 'public-read-write', 'authenticated-read'. Multiple permissions can be specified as a list.
    • prefix: Limits the response to keys that begin with the specified prefix for list mode
    • retries: On recoverable failure, how many times to retry before actually failing.
    • version: Version ID of the object inside the bucket. Can be used to get a specific version of a file if versioning is enabled in the target bucket.
  • vsphere_guest - Create/delete/manage a guest VM through VMware vSphere.
    • snapshot_to_clone: A string that when specified, will create a linked clone copy of the VM. Snapshot must already be taken in vCenter.

Database Modules

  • mongodb_user (E) - Adds or removes a user from a MongoDB database.
    • login_database: The database where login credentials are stored
  • mysql_db - Add or remove MySQL databases from a remote host.
    • config_file: Specify a config file from which user and password are to be read
    • ssl_ca: The path to a Certificate Authority (CA) certificate. This option, if used, must specify the same certificate as used by the server.
    • ssl_cert: The path to a client public key certificate.
    • ssl_key: The path to the client private key.
  • mysql_replication (E) - Manage MySQL replication
    • config_file: Specify a config file from which user and password are to be read
    • master_auto_position: does the host uses GTID based replication or not
    • ssl_ca: The path to a Certificate Authority (CA) certificate. This option, if used, must specify the same certificate as used by the server.
    • ssl_cert: The path to a client public key certificate.
    • ssl_key: The path to the client private key.
  • mysql_user - Adds or removes a user from a MySQL database.
    • config_file: Specify a config file from which user and password are to be read
    • encrypted: Indicate that the 'password' field is a mysql_native_password hash
    • ssl_ca: The path to a Certificate Authority (CA) certificate. This option, if used, must specify the same certificate as used by the server.
    • ssl_cert: The path to a client public key certificate.
    • ssl_key: The path to the client private key.
    • update_password: always will update passwords if they differ. on_create will only set the password for newly created users.
  • mysql_variables - Manage MySQL global variables
    • config_file: Specify a config file from which user and password are to be read
    • ssl_ca: The path to a Certificate Authority (CA) certificate. This option, if used, must specify the same certificate as used by the server.
    • ssl_cert: The path to a client public key certificate.
    • ssl_key: The path to the client private key.
  • postgresql_user - Adds or removes a users (roles) from a PostgreSQL database.
    • no_password_changes: if yes, don't inspect database for password changes. Effective when pg_authid is not accessible (such as AWS RDS). Otherwise, make password changes as necessary.

Files Modules

Monitoring Modules

Network Modules

  • bigip_facts (E) - Collect facts from F5 BIG-IP devices
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • bigip_monitor_http (E) - Manages F5 BIG-IP LTM http monitors
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • bigip_node (E) - Manages F5 BIG-IP LTM nodes
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • bigip_pool (E) - Manages F5 BIG-IP LTM pools
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • bigip_monitor_tcp (E) - Manages F5 BIG-IP LTM tcp monitors
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • bigip_pool_member (E) - Manages F5 BIG-IP LTM pool members
    • monitor_state: Set monitor availability status for pool member
    • session_state: Set new session availability status for pool member
    • validate_certs: If no, SSL certificates will not be validated. This should only be used on personally controlled sites. Prior to 2.0, this module would always validate on python >= 2.7.9 and never validate on python <= 2.7.8
  • get_url - Downloads files from HTTP, HTTPS, or FTP to node
    • checksum: If a checksum is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. Format: :, e.g.: checksum="sha256:D98291AC[...]B6DC7B97" If you worry about portability, only the sha1 algorithm is available on all platforms and python versions. The third party hashlib library can be installed for access to additional algorithms. Additionaly, if a checksum is passed to this parameter, and the file exist under the dest location, the destination_checksum would be calculated, and if checksum equals destination_checksum, the file download would be skipped (unless force is true).
    • force_basic_auth: httplib2, the library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon initial request.
    • headers: Add custom HTTP headers to a request in the format "key:value,key:value"
  • haproxy (E) - Enable, disable, and set weights for HAProxy backend servers using socket commands.
    • wait: Wait until the server reports a status of 'UP' when state=enabled, or status of 'MAINT' when state=disabled.
    • wait_interval: Number of seconds to wait between retries.
    • wait_retries: Number of times to check for status after changing the state.
  • openvswitch_bridge (E) - Manage Open vSwitch bridges
    • external_ids: A dictionary of external-ids. Omitting this parameter is a No-op. To clear all external-ids pass an empty value.
    • fail_mode: Set bridge fail-mode. The default value (None) is a No-op.
  • openvswitch_port (E) - Manage Open vSwitch ports
    • external_ids: Dictionary of external_ids applied to a port.
    • set: Set a single property on a port.
  • uri - Interacts with webservices
    • body_format: The serialization format of the body. When set to json, encodes the body argument, if needed, and automatically sets the Content-Type header accordingly.

Notification Modules

  • irc (E) - Send a message to an IRC channel
    • nick_to: A list of nicknames to send the message to. One of nick_to or channel needs to be set. When both are defined, the message will be sent to both of them.
    • part: Designates whether user should part from channel after sending message or not. Useful for when using a faux bot and not wanting join/parts between messages.
    • style: Text style for the message. Note italic does not work on some clients
    • topic: Set the channel topic
  • mail (E) - Send an email
    • subtype: The minor mime type, can be either text or html. The major type is always text.
  • slack (E) - Send Slack notifications
    • color: Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message

Packaging Modules

Source Control Modules

System Modules

Windows Modules

  • win_get_url - Fetches a file from a given URL
    • force: If yes, will always download the file. If no, will only download the file if it does not exist or the remote file has been modified more recently than the local file.
    • proxy_password: Proxy authentication password
    • proxy_url: The full URL of the proxy server to download through.
    • proxy_username: Proxy authentication username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment