Accelerated Mode
port 5099
持续连接30min
---
- hosts: all
accelerate: true
tasks:
- name: some task
command: echo {{ item }}
with_items:
- foo
- bar
- baz
# change port
---
- hosts: all
accelerate: true
# default port is 5099
accelerate_port: 10000
or
# /etc/ansible/ansible.cfg
[accelerate]
accelerate_port = 5099
accelerate_multi_key = yes
UNIX socket file
default $ANSIBLE_REMOTE_TEMP/.ansible-accelerate/.local.socket
Asynchronous Actions and Polling
---
- hosts: all
remote_user: root
tasks:
- name: simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
command: /bin/sleep 15
async: 45
poll: 5
---
- hosts: all
remote_user: root
tasks:
- name: simulate long running op, allow to run for 45 sec, fire and forget
command: /bin/sleep 15
async: 45
poll: 0
---
# Requires ansible 1.8+
- name: 'YUM - fire and forget task'
yum: name=docker-io state=installed
async: 1000
poll: 0
register: yum_sleeper
- name: 'YUM - check on fire and forget task'
async_status: jid={{ yum_sleeper.ansible_job_id }}
register: job_result
until: job_result.finished
retries: 30