Delete Ansible/k8s.yml

This commit is contained in:
tehNooB 2024-03-07 09:25:13 +00:00 committed by GitHub
parent 9e6520b351
commit f5ac81461b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,106 +0,0 @@
- hosts: masters
gather_facts: false
become: true
ignore_unreachable: true
ignore_errors: false
serial: 1
tasks:
##################################
# Required to avoid the following bug:
# https://github.com/ansible/ansible/issues/48352
- name: Allow release info change
lineinfile:
path: /etc/apt/apt.conf.d/99releaseinfochange
state: present
create: true
line: Acquire::AllowReleaseInfoChange::Suite "true";
- name: Run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
become: true
register: apt
- name: Upgrade all packages to the latest version
become: true
apt:
name: "*"
state: latest
update_cache: false
register: appsupdated
- name: Remove useless packages from the cache
apt:
autoclean: yes
become: true
- name: Remove dependencies that are no longer required
apt:
autoremove: yes
become: true
- name: check for reboot file
stat:
path: /var/run/reboot-required
register: reboot_file
##################################
- name: drain node
become: false
kubernetes.core.k8s_drain:
state: drain
name: "{{ inventory_hostname }}"
delete_options:
ignore_daemonsets: true
delete_emptydir_data: true
delegate_to: localhost
when:
- appsupdated.changed
- reboot_file.stat.exists
register: nodedrained
- name: Pause for 1 minutes
ansible.builtin.pause:
minutes: 1
when: nodedrained.changed
- name: Reboot system if required
shell: ( /bin/sleep 5 ; shutdown -r now "Ansible updates triggered" ) &
removes=/var/run/reboot-required
ignore_errors: true
async: 30
poll: 0
notify:
- waiting for reboot
when: reboot_file.stat.exists
- name: Flush handlers
meta: flush_handlers
- name: Pause for 1 minutes
ansible.builtin.pause:
minutes: 1
when: nodedrained.changed
- name: uncordon node
become: false
kubernetes.core.k8s_drain:
state: uncordon
name: "{{ inventory_hostname }}"
delete_options:
ignore_daemonsets: true
delete_emptydir_data: true
delegate_to: localhost
when: nodedrained.changed| default(omit)
handlers:
- name: waiting for reboot
local_action: wait_for
host="{{ inventory_hostname }}"
port=2222
delay=10
timeout=120