Update to 2020-09-07 13:00

master
Daniel Berteaud 4 years ago
parent b28198e8c7
commit 1c3c10d37f
  1. BIN
      roles/common/defaults/.main.yml.swp
  2. 5
      roles/common/defaults/main.yml
  3. 16
      roles/common/tasks/system.yml
  4. 15
      roles/common/templates/rc-local-shutdown.service.j2
  5. 9
      roles/common/templates/rc.local.shutdown.j2

@ -123,4 +123,9 @@ system_rc_local_base_cmd: []
system_rc_local_extra_cmd: []
system_rc_local_cmd: "{{ system_rc_local_base_cmd + system_rc_local_extra_cmd }}"
# shell scriplet to exec on shutdown
system_rc_local_shutdown_base_cmd: []
system_rc_local_shutdown_extra_cmd: []
system_rc_local_shutdown_cmd: "{{ system_rc_local_shutdown_base_cmd + system_rc_local_shutdown_extra_cmd }}"
...

@ -146,8 +146,24 @@
- name: Deploy rc.local script
template: src=rc.local.j2 dest=/etc/rc.d/rc.local mode=755
- name: Deploy rc.local.shutdown script
template: src=rc.local.shutdown.j2 dest=/etc/rc.d/rc.local.shutdown mode=755
# Debian is using /etc/rc.local while RHEL is using /etc/rc.d/rc.local
- name: Link /etc/rc.local to /etc/rc.d/rc.local
file: src=/etc/rc.d/rc.local path=/etc/rc.local state=link force=True
- name: Link /etc/rc.local.shutdown to /etc/rc.d/rc.local.shutdown
file: src=/etc/rc.d/rc.local.shutdown path=/etc/rc.local.shutdown state=link force=True
- name: Deploy rc-local-shutdown systemd unit
template: src=rc-local-shutdown.service.j2 dest=/etc/systemd/system/rc-local-shutdown.service
register: system_rc_local_shutdown_unit
- name: Reload systemd
systemd: daemon_reload=True
when: system_rc_local_shutdown_unit.changed
- name: Enable rc-local-shutdown service
service: name=rc-local-shutdown enabled=True
...

@ -0,0 +1,15 @@
[Unit]
Description=/etc/rc.d/rc.local.shutdown compatibility
ConditionFileIsExecutable=/etc/rc.d/rc.local.shutdown
DefaultDependencies=no
After=rc-local.service basic.target
Before=shutdown.target
[Service]
Type=oneshot
ExecStart=/etc/rc.d/rc.local.shutdown
StandardInput=tty
RemainAfterExit=yes
[Install]
WantedBy=shutdown.target

@ -0,0 +1,9 @@
#!/bin/bash
# {{ ansible_managed }}
{% for cmd in system_rc_local_shutdown_cmd %}
{{ cmd }}
{% endfor %}
exit 0
Loading…
Cancel
Save