Вы можете использовать встроенную функцию bash type
, чтобы увидеть псевдоним или определение функции, которую вы собираетесь запустить:
$ type ls
ls is aliased to `ls --color=auto -p'
$ type -a ls
ls is aliased to `ls --color=auto -p'
ls is /bin/ls
$ install() { sudo apt-get install "@"; }
$ type install
install is a function
install ()
{
aptitude install "@"
}
Ansible может перезагрузить сервер без использования spacecmd
, используя команду reboot
.
- name: Upgrading via spacewalk
shell: spacecmd system_upgradepackage <hostname> '*' -y
- name: Reboot after upgrades
shell: reboot
async: 0
poll: 0
- name: Waiting for host to come up
local_action: wait_for host={{ ansible_ssh_host }} state=started
Адаптировано из:https://www.linux.com/tutorials/ansible-reboot-server-play-book-and-wait-it-come-back
Я не знаком с spacecmd
, но вы можете использовать модуль wait_for
для мониторинга PID.
Из документов:
- name: Wait until the process is finished and PID was destroyed
wait_for:
path: /proc/3466/status
state: absent