Skip to content

Commit

Permalink
boostrap-os: use import_tasks instead of symlinks (#11508)
Browse files Browse the repository at this point in the history
Working symlinks are dependant on git configuration (when using the playbook as
a git repository, which is common), precisely `git config
core.symlinks`.

While this is enabled by default, some company policies will disable it.

Instead, use import_tasks which should avoid that class of bugs.
  • Loading branch information
VannTen authored Sep 5, 2024
1 parent 7f527f6 commit f9ebd45
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
20 changes: 0 additions & 20 deletions roles/bootstrap-os/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,3 @@
- '"changed its" in bootstrap_update_apt_result.stdout'
- '"value from" in bootstrap_update_apt_result.stdout'
ignore_errors: true

- name: Check unattended-upgrades file exist
stat:
path: /etc/apt/apt.conf.d/50unattended-upgrades
register: unattended_upgrades_file_stat
when:
- os_release_dict['ID'] == 'ubuntu'
- ubuntu_kernel_unattended_upgrades_disabled

- name: Disable kernel unattended-upgrades
lineinfile:
path: "{{ unattended_upgrades_file_stat.stat.path }}"
insertafter: "Unattended-Upgrade::Package-Blacklist"
line: '"linux-";'
state: present
become: true
when:
- os_release_dict['ID'] == 'ubuntu'
- ubuntu_kernel_unattended_upgrades_disabled
- unattended_upgrades_file_stat.stat.exists
1 change: 0 additions & 1 deletion roles/bootstrap-os/tasks/openEuler.yml

This file was deleted.

3 changes: 3 additions & 0 deletions roles/bootstrap-os/tasks/openEuler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Import Centos boostrap for openEuler
import_tasks: centos.yml
1 change: 0 additions & 1 deletion roles/bootstrap-os/tasks/opensuse-leap.yml

This file was deleted.

3 changes: 3 additions & 0 deletions roles/bootstrap-os/tasks/opensuse-leap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Import Opensuse bootstrap
import_tasks: opensuse.yml
1 change: 0 additions & 1 deletion roles/bootstrap-os/tasks/opensuse-tumbleweed.yml

This file was deleted.

3 changes: 3 additions & 0 deletions roles/bootstrap-os/tasks/opensuse-tumbleweed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Import Opensuse bootstrap
import_tasks: opensuse.yml
1 change: 0 additions & 1 deletion roles/bootstrap-os/tasks/ubuntu.yml

This file was deleted.

21 changes: 21 additions & 0 deletions roles/bootstrap-os/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Import Debian bootstrap
import_tasks: debian.yml

- name: Check unattended-upgrades file exist
stat:
path: /etc/apt/apt.conf.d/50unattended-upgrades
register: unattended_upgrades_file_stat
when:
- ubuntu_kernel_unattended_upgrades_disabled

- name: Disable kernel unattended-upgrades
lineinfile:
path: "{{ unattended_upgrades_file_stat.stat.path }}"
insertafter: "Unattended-Upgrade::Package-Blacklist"
line: '"linux-";'
state: present
become: true
when:
- ubuntu_kernel_unattended_upgrades_disabled
- unattended_upgrades_file_stat.stat.exists

0 comments on commit f9ebd45

Please sign in to comment.