Commit c790dc1f authored by nanahira's avatar nanahira

improve reboot param

parent ea5e2ea3
- name: clean some Debian packages
become: true
apt:
name: ufw,iptables-persistent,needrestart,docker,docker-engine,docker.io,docker-io,docker-ee
state: absent
autoremove: yes
purge: yes
when: ansible_os_family == 'Debian'
- name: clean packages again
include_tasks: apt-clean.yml
- name: install aptitude first
become: true
apt:
......
......@@ -17,6 +17,11 @@
name: linux-xanmod
state: latest
update_cache: true
register: xanmod_result
- name: register reboot
set_fact:
manual_reboot: true
when: xanmod_result.changed
- name: install intel microcode
become: true
apt:
......
......@@ -5,7 +5,7 @@
regexp: '^#?PasswordAuthentication (true|yes).*$'
line: 'PasswordAuthentication no'
backrefs: true
when: "(ansible_user_id == 'root' or ansible_user_id == 'nanahira' or ansible_user_id == 'mycard' or ansible_user_id == 'zh99998') and not allow_password" # Only self-managed servers
when: "not allow_password"
notify: restart_sshd
- name: permit root login
lineinfile:
......
......@@ -38,18 +38,15 @@
- name: redhat configures before reboot
include_tasks: redhat_configures.yml
when: ansible_os_family == 'RedHat'
- name: 系统源 重启
- name: check reboot needed
stat:
path: /var/run/reboot-required
register: reboot_required_result
- name: reboot
become: true
shell: reboot
async: 0
poll: 0
register: reboot_result
args:
removes: /var/run/reboot-required
when: reboot
- name: 系统源 重启等待
local_action: wait_for host={{ ansible_ssh_host }} state=started
when: reboot and reboot_result.changed
reboot:
reboot_timeout: 600
when: reboot and (reboot_required_result.stat.exists or manual_reboot)
- name: 重新读取主机信息
setup:
when: reboot and reboot_result.changed
......@@ -102,14 +102,8 @@
- name: nvidia source
include_tasks: nvidia-source.yml
when: nvidia_driver_version and ansible_os_family == 'Debian'
- name: clean some Debian packages
become: true
apt:
name: ufw,iptables-persistent,needrestart,docker,docker-engine,docker.io,docker-io,docker-ee
state: absent
autoremove: yes
purge: yes
when: ansible_os_family == 'Debian'
- name: clean packages
include_tasks: apt-clean.yml
- name: Debian laptop disable lid
become: true
blockinfile:
......
---
# vars file for init
manual_reboot: false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment