De Wiki inetshell
Saltar a: navegación, buscar

Revisar[editar]

[Ansible vs Puppet An Overview of the Solutions ]

Reinicio[editar]

https://github.com/savoirfairelinux/ansible-reboot-if-needed/blob/master/tasks/main.yml

- name: Check if reboot is required
  stat:
    path: /var/run/reboot-required
  register: reboot_required_file

# In a normal play, the pause action is only executed once, not once-per-host.
# In this case, we really want to force the once-per-host thing.
# ref http://stackoverflow.com/a/35169496
- name: Prompt for rebooting
  pause:
    prompt: "Press ENTER to reboot {{ item }} now, or Ctrl+C to abort."
  # We need to check for the existence of 'reboot_required_file' first because play_hosts also
  # include hosts that have failed. When a host has failed, it stops executing and thus doesn't
  # have 'reboot_required_file'. And if we try to access 'stat', boom! failure. We don't want that.
  when: "'reboot_required_file' in hostvars[item] and hostvars[item]['reboot_required_file'].stat.exists"
  with_items: "{{ play_hosts }}"

# ref https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back
- name: Rebooting machine
  shell: sleep 2 && shutdown -r now "Ansible updates triggered"
  async: 1
  poll: 0
  ignore_errors: true
  when: reboot_required_file.stat.exists

- name: Waiting for the machine to come back
  local_action: wait_for host={{ ansible_host }} state=started port=22 delay=30
  become: no
  when: reboot_required_file.stat.exists

Actualizacion de parametros de SSH[editar]

https://ryaneschinger.com/blog/securing-a-server-with-ansible/

Serial[editar]

https://sysadmincasts.com/episodes/47-zero-downtime-deployments-with-ansible-part-4-4