Use policy_rc_d attribute instead of copy

Since ansible 2.8 it's possible to provide policy_rc_d attribute to the
apt module in order to avoid service restart on installation/upgrade

Change-Id: I299605bb5735cd510a82490a710ef6fae98bfafa
This commit is contained in:
Dmitriy Rabotyagov 2022-09-26 13:30:35 +02:00
parent 028d3e5303
commit a09612c1fb
1 changed files with 1 additions and 16 deletions

View File

@ -21,22 +21,13 @@
tags:
- lxc-apt-packages
- name: Prevent lxc from starting on install
copy:
content: |
#!/bin/bash
exit 101
dest: "/usr/sbin/policy-rc.d"
mode: "0755"
backup: yes
changed_when: false
- name: Install apt packages
apt:
pkg: "{{ lxc_hosts_distro_packages }}"
state: "{{ lxc_hosts_package_state }}"
default_release: "{{ lxc_default_release | default(omit) }}"
update_cache: yes
policy_rc_d: 101
cache_valid_time: "{{ cache_timeout }}"
register: install_packages
until: install_packages is success
@ -45,12 +36,6 @@
tags:
- lxc-apt-packages
- name: Remove policy-rc now that the package install/upgrade is complete
file:
path: "/usr/sbin/policy-rc.d"
state: absent
changed_when: false
- name: Drop irqbalance config
template:
src: "irqbalance.j2"