mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
CI: Add ArchLinux, Debian Bullseye, CentOS Stream 8, and Alpine 3 (#4222)
* Add ArchLinux, Debian Bullseye and CentOS Stream 8 to CI. * Add Alpine to CI matrix as well.
This commit is contained in:
parent
2416b81aa4
commit
a06903f33a
56 changed files with 861 additions and 700 deletions
|
@ -3,67 +3,70 @@
|
|||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: Include distribution specific variables
|
||||
include_vars: '{{ lookup(''first_found'', search) }}'
|
||||
vars:
|
||||
search:
|
||||
files:
|
||||
- '{{ ansible_distribution | lower }}.yml'
|
||||
- '{{ ansible_os_family | lower }}.yml'
|
||||
- '{{ ansible_system | lower }}.yml'
|
||||
- default.yml
|
||||
paths:
|
||||
- vars
|
||||
- name: install cron package
|
||||
package:
|
||||
name: '{{ cron_pkg }}'
|
||||
when: cron_pkg | default(false, true)
|
||||
register: cron_package_installed
|
||||
until: cron_package_installed is success
|
||||
- when: faketime_pkg | default(false, true)
|
||||
- when:
|
||||
- not (ansible_os_family == 'Alpine' and ansible_distribution_version is version('3.15', '<')) # TODO
|
||||
block:
|
||||
- name: install cron and faketime packages
|
||||
- name: Include distribution specific variables
|
||||
include_vars: '{{ lookup(''first_found'', search) }}'
|
||||
vars:
|
||||
search:
|
||||
files:
|
||||
- '{{ ansible_distribution | lower }}.yml'
|
||||
- '{{ ansible_os_family | lower }}.yml'
|
||||
- '{{ ansible_system | lower }}.yml'
|
||||
- default.yml
|
||||
paths:
|
||||
- vars
|
||||
- name: install cron package
|
||||
package:
|
||||
name: '{{ faketime_pkg }}'
|
||||
register: faketime_package_installed
|
||||
until: faketime_package_installed is success
|
||||
- name: Find libfaketime path
|
||||
shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1'
|
||||
args:
|
||||
warn: false
|
||||
register: libfaketime_path
|
||||
- when: ansible_service_mgr == 'systemd'
|
||||
name: '{{ cron_pkg }}'
|
||||
when: cron_pkg | default(false, true)
|
||||
register: cron_package_installed
|
||||
until: cron_package_installed is success
|
||||
- when: faketime_pkg | default(false, true)
|
||||
block:
|
||||
- name: create directory for cron drop-in file
|
||||
file:
|
||||
path: /etc/systemd/system/{{ cron_service }}.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
- name: Use faketime with cron service
|
||||
- name: install cron and faketime packages
|
||||
package:
|
||||
name: '{{ faketime_pkg }}'
|
||||
register: faketime_package_installed
|
||||
until: faketime_package_installed is success
|
||||
- name: Find libfaketime path
|
||||
shell: '{{ list_pkg_files }} {{ faketime_pkg }} | grep -F libfaketime.so.1'
|
||||
args:
|
||||
warn: false
|
||||
register: libfaketime_path
|
||||
- when: ansible_service_mgr == 'systemd'
|
||||
block:
|
||||
- name: create directory for cron drop-in file
|
||||
file:
|
||||
path: /etc/systemd/system/{{ cron_service }}.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
- name: Use faketime with cron service
|
||||
copy:
|
||||
content: '[Service]
|
||||
|
||||
Environment=LD_PRELOAD={{ libfaketime_path.stdout_lines[0].strip() }}
|
||||
|
||||
Environment="FAKETIME=+0y x10"
|
||||
|
||||
Environment=RANDOM_DELAY=0'
|
||||
dest: /etc/systemd/system/{{ cron_service }}.service.d/faketime.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
- when: ansible_system == 'FreeBSD'
|
||||
name: Use faketime with cron service
|
||||
copy:
|
||||
content: '[Service]
|
||||
|
||||
Environment=LD_PRELOAD={{ libfaketime_path.stdout_lines[0].strip() }}
|
||||
|
||||
Environment="FAKETIME=+0y x10"
|
||||
|
||||
Environment=RANDOM_DELAY=0'
|
||||
dest: /etc/systemd/system/{{ cron_service }}.service.d/faketime.conf
|
||||
content: cron_env='LD_PRELOAD={{ libfaketime_path.stdout_lines[0].strip() }} FAKETIME="+0y x10"'
|
||||
dest: /etc/rc.conf.d/cron
|
||||
owner: root
|
||||
group: root
|
||||
group: wheel
|
||||
mode: '0644'
|
||||
- when: ansible_system == 'FreeBSD'
|
||||
name: Use faketime with cron service
|
||||
copy:
|
||||
content: cron_env='LD_PRELOAD={{ libfaketime_path.stdout_lines[0].strip() }} FAKETIME="+0y x10"'
|
||||
dest: /etc/rc.conf.d/cron
|
||||
owner: root
|
||||
group: wheel
|
||||
mode: '0644'
|
||||
- name: enable cron service
|
||||
service:
|
||||
daemon-reload: '{{ (ansible_service_mgr == ''systemd'') | ternary(true, omit) }}'
|
||||
name: '{{ cron_service }}'
|
||||
state: restarted
|
||||
- name: enable cron service
|
||||
service:
|
||||
daemon-reload: '{{ (ansible_service_mgr == ''systemd'') | ternary(true, omit) }}'
|
||||
name: '{{ cron_service }}'
|
||||
state: restarted
|
||||
|
|
3
tests/integration/targets/setup_cron/vars/alpine.yml
Normal file
3
tests/integration/targets/setup_cron/vars/alpine.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
cron_pkg: cronie
|
||||
cron_service: cronie
|
||||
list_pkg_files: apk info -L
|
3
tests/integration/targets/setup_cron/vars/archlinux.yml
Normal file
3
tests/integration/targets/setup_cron/vars/archlinux.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
cron_pkg: cronie
|
||||
cron_service: cronie
|
||||
list_pkg_files: pacman -Ql
|
Loading…
Add table
Add a link
Reference in a new issue