Ansible 2.3: New Modules

Soon after Ansible turned five, version 2.3 was released. There are a lot of new features in this version specifically related to networking. Like, Persistent connections framework, network_cli connection plugin and netconf connection plugin.

There are 280+ new modules available in Ansible 2.3. Below is the list of some exciting new modules which can help you to automate certain task and also decorate your playbooks.

  • archive - Creates a compressed archive of one or more files or trees.
- archive:
    path: /path/to/foo
    dest: /path/to/foo.tgz
    format: gz

gz, bz2 & zip are supported formats

  • openssl_privatekey - Generate OpenSSL private keys.
- openssl_privatekey:
    path: /etc/ssl/private/googlinux.com.pem
    Size: 2048
    type: DSA
  • openssl_publickey - Generate an OpenSSL public key from its private key.
- openssl_publickey:
    path: /etc/ssl/public/googlinux.com.pem
    privatekey_path: /etc/ssl/private/googlinux.com.pem
  • openssl_csr - Generate OpenSSL Certificate Signing Request (CSR)
- openssl_csr:
    path: /etc/ssl/csr/www.googlinux.com.csr
    privatekey_path: /etc/ssl/private/googlinux.com.pem
    commonname: www.googlinux.com
  • pacemaker_cluster - Manage a pacemaker cluster
- name: Set cluster Online
  hosts: localhost
  gather_facts: no
  tasks:
    - name: get cluster state
      pacemaker_cluster: state=online
  • parted - Configure block device partitions
- parted: device=/dev/sdb unit=MiB state=info
  register: sdb_info

- parted:
    device: /dev/sdb
    number: ""{{ item.num }}""
    state: absent
  with_items:
   - "{{ sdb_info.partitions }}"
  • wait_for_connection Waits until remote system is reachable/usable. This is an better alternative for wait_for module.
- name: Wait 600 seconds for target connection to become reachable/usable
  wait_for_connection:

- name: Wait 300 seconds, but only start checking after 60 seconds
  wait_for_connection:
    delay: 60
    timeout: 300
Ansible Tower can also be managed using a playbook :). Below are some modules for Ansible Tower
  • tower_credential - create, update, or destroy Ansible Tower credential.
  • tower_group - create, update, or destroy Ansible Tower group.
  • tower_host - create, update, or destroy Ansible Tower host.
  • tower_inventory - create, update, or destroy Ansible Tower inventory.
  • tower_job_cancel - Cancel an Ansible Tower Job.
  • tower_job_launch - Launch an Ansible Job.
  • tower_job_list - List Ansible Tower jobs
  • tower_job_template - create, update, or destroy Ansible Tower job_template.
  • tower_job_wait - Wait for Ansible Tower job to finish.
  • tower_label - create, update, or destroy Ansible Tower label.
  • tower_organization - create, update, or destroy Ansible Tower organizations
  • tower_project - create, update, or destroy Ansible Tower projects
  • tower_role - create, update, or destroy Ansible Tower role.
  • tower_team - create, update, or destroy Ansible Tower team.
  • tower_user - create, update, or destroy Ansible Tower user.
Lot of new additions for Windows ^ ^ as well :)
  • win_disk_image - Manage ISO/VHD/VHDX mounts on Windows hosts
  • win_dns_client - Configures DNS lookup on Windows hosts
  • win_domain - Ensures the existence of a Windows domain.
  • win_domain_controller - Manage domain controller/member server state for a Windows host
  • win_domain_membership - Manage domain/workgroup membership for a Windows host
  • win_find - return a list of files based on specific criteria
  • win_msg - Sends a message to logged in users on Windows hosts.
  • win_path - Manage Windows path environment variables
  • win_psexec - Runs commands (remotely) as another (privileged) user
  • win_reg_stat - returns information about a Windows registry key or property of a key
  • win_region - Set the region and format settings
  • win_say - Text to speech module for Windows to speak messages
  • win_shortcut - Manage shortcuts on Windows
  • win_tempfile - Creates temporary files and directories

Like it? Click here to Tweet your feedback

Swapnil Jain

RHCA Level X, RHCI ♦ Solution Architect ♦ DevOps Trainer & Consultant