It is possible to use chocolatey to manage Windows computers from ansible.
choco install vlc -y works fine in Cygwin. And also over Cygwin's ssh server from ansible.
- name: Check command exist
shell: command -v procdump
register: procdump_res
- name: Install procdump
command: choco install procdump -y
when: procdump_res.rc == 1
Показаны сообщения с ярлыком ancible. Показать все сообщения
Показаны сообщения с ярлыком ancible. Показать все сообщения
среда, 4 октября 2017 г.
понедельник, 3 октября 2016 г.
Shutdown server and wait till the connection is down with ansible
When executing something like "ansible all -m command -a "shutdown now" --ask-pass -b" on ubuntu server 16 ansible will power off the machine, but return the error
192.168.0.2 | FAILED | rc=0 >>
MODULE FAILURE
The solution is to add the delay before shutdown command using shell module and sleep.
shutdown.yml:
---
- hosts: all
tasks:
- name: shutdown
shell: nohup bash -c "sleep 2s && shutdown now" &
async: 0
poll: 0
ignore_errors: true
become: true
- name: wait for server power off
local_action: wait_for host="{{ inventory_hostname }}"
state=stopped port=22 delay=10 timeout=300
become: false
Wait for server fower off task will check that at least ssh on the host is down. But it will not notify if shutdown itself hangs.
192.168.0.2 | FAILED | rc=0 >>
MODULE FAILURE
The solution is to add the delay before shutdown command using shell module and sleep.
shutdown.yml:
---
- hosts: all
tasks:
- name: shutdown
shell: nohup bash -c "sleep 2s && shutdown now" &
async: 0
poll: 0
ignore_errors: true
become: true
- name: wait for server power off
local_action: wait_for host="{{ inventory_hostname }}"
state=stopped port=22 delay=10 timeout=300
become: false
Wait for server fower off task will check that at least ssh on the host is down. But it will not notify if shutdown itself hangs.
Подписаться на:
Сообщения (Atom)