mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 14:20:04 -07:00
files: add a new module iso_create (#397)
* add a new module iso_create * add elements in argument spec * remove changelog for new module * change the path of test file * comment out pip check task in test case * comment out install pip in test case * move pip install task and add skip python2.6
This commit is contained in:
parent
1a0a185ac3
commit
13c0639d9d
8 changed files with 556 additions and 0 deletions
4
tests/integration/targets/iso_create/aliases
Normal file
4
tests/integration/targets/iso_create/aliases
Normal file
|
@ -0,0 +1,4 @@
|
|||
shippable/posix/group1
|
||||
destructive
|
||||
skip/aix
|
||||
skip/python2.6
|
56
tests/integration/targets/iso_create/files/test1.cfg
Normal file
56
tests/integration/targets/iso_create/files/test1.cfg
Normal file
|
@ -0,0 +1,56 @@
|
|||
#version=DEVEL
|
||||
# System authorization information
|
||||
auth --enableshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use graphical install
|
||||
graphical
|
||||
# Run the Setup Agent on first boot
|
||||
firstboot --enable
|
||||
ignoredisk --only-use=sda
|
||||
# Keyboard layouts
|
||||
keyboard --vckeymap=us --xlayouts='us'
|
||||
# System language
|
||||
lang en_US.UTF-8
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=ens192 --ipv6=auto --no-activate
|
||||
network --hostname=localhost.localdomain
|
||||
# System services
|
||||
services --enabled="chronyd"
|
||||
# System timezone
|
||||
timezone America/New_York --isUtc
|
||||
# X Window System configuration information
|
||||
xconfig --startxonboot
|
||||
# System bootloader configuration
|
||||
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
|
||||
autopart --type=lvm
|
||||
# Partition clearing information
|
||||
clearpart --none --initlabel
|
||||
#firewall --disable
|
||||
services --disabled=firewalld
|
||||
eula --agreed
|
||||
# Reboot when the install is finished.
|
||||
reboot
|
||||
|
||||
%packages
|
||||
@^graphical-server-environment
|
||||
@base
|
||||
@core
|
||||
@desktop-debugging
|
||||
@dial-up
|
||||
@fonts
|
||||
@gnome-desktop
|
||||
@guest-agents
|
||||
@guest-desktop-agents
|
||||
@hardware-monitoring
|
||||
@input-methods
|
||||
@internet-browser
|
||||
@multimedia
|
||||
@print-client
|
||||
@x11
|
||||
chrony
|
||||
kexec-tools
|
||||
open-vm-tools-desktop
|
||||
%end
|
||||
%addon com_redhat_kdump --enable --reserve-mb='auto'
|
||||
%end
|
|
@ -0,0 +1,56 @@
|
|||
#version=DEVEL
|
||||
# System authorization information
|
||||
auth --enableshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use graphical install
|
||||
graphical
|
||||
# Run the Setup Agent on first boot
|
||||
firstboot --enable
|
||||
ignoredisk --only-use=sda
|
||||
# Keyboard layouts
|
||||
keyboard --vckeymap=us --xlayouts='us'
|
||||
# System language
|
||||
lang en_US.UTF-8
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=ens192 --ipv6=auto --no-activate
|
||||
network --hostname=localhost.localdomain
|
||||
# System services
|
||||
services --enabled="chronyd"
|
||||
# System timezone
|
||||
timezone America/New_York --isUtc
|
||||
# X Window System configuration information
|
||||
xconfig --startxonboot
|
||||
# System bootloader configuration
|
||||
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
|
||||
autopart --type=lvm
|
||||
# Partition clearing information
|
||||
clearpart --none --initlabel
|
||||
#firewall --disable
|
||||
services --disabled=firewalld
|
||||
eula --agreed
|
||||
# Reboot when the install is finished.
|
||||
reboot
|
||||
|
||||
%packages
|
||||
@^graphical-server-environment
|
||||
@base
|
||||
@core
|
||||
@desktop-debugging
|
||||
@dial-up
|
||||
@fonts
|
||||
@gnome-desktop
|
||||
@guest-agents
|
||||
@guest-desktop-agents
|
||||
@hardware-monitoring
|
||||
@input-methods
|
||||
@internet-browser
|
||||
@multimedia
|
||||
@print-client
|
||||
@x11
|
||||
chrony
|
||||
kexec-tools
|
||||
open-vm-tools-desktop
|
||||
%end
|
||||
%addon com_redhat_kdump --enable --reserve-mb='auto'
|
||||
%end
|
3
tests/integration/targets/iso_create/meta/main.yml
Normal file
3
tests/integration/targets/iso_create/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
- prepare_tests
|
149
tests/integration/targets/iso_create/tasks/main.yml
Normal file
149
tests/integration/targets/iso_create/tasks/main.yml
Normal file
|
@ -0,0 +1,149 @@
|
|||
# Test code for iso_create module
|
||||
# Copyright: (c) 2020, Diane Wang (Tomorrow9) <dianew@vmware.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
- name: install pycdlib
|
||||
pip:
|
||||
name: pycdlib
|
||||
# state: latest
|
||||
register: install_pycdlib
|
||||
- debug: var=install_pycdlib
|
||||
|
||||
- set_fact:
|
||||
output_dir_test: '{{ output_dir }}/test_iso_create'
|
||||
|
||||
# - include_tasks: prepare_dest_dir.yml
|
||||
|
||||
- name: Test check mode
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test.iso"
|
||||
interchange_level: 3
|
||||
register: iso_result
|
||||
check_mode: yes
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test.iso"
|
||||
register: iso_file
|
||||
- debug: var=iso_file
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == False
|
||||
|
||||
- name: Create iso file with a specified file
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test.iso"
|
||||
interchange_level: 3
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
||||
|
||||
- name: Create iso file with a specified file and folder
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
- "{{ role_path }}/files/test_dir"
|
||||
dest_iso: "{{ output_dir_test }}/test1.iso"
|
||||
interchange_level: 3
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test1.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
||||
|
||||
- name: Create iso file with volume identification string
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test2.iso"
|
||||
vol_ident: "OEMDRV"
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test2.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
||||
|
||||
- name: Create iso file with Rock Ridge extention
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test3.iso"
|
||||
rock_ridge: "1.09"
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test3.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
||||
|
||||
- name: Create iso file with Joliet extention
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test4.iso"
|
||||
joliet: 3
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test4.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
||||
|
||||
- name: Create iso file with UDF enabled
|
||||
iso_create:
|
||||
src_files:
|
||||
- "{{ role_path }}/files/test1.cfg"
|
||||
dest_iso: "{{ output_dir_test }}/test5.iso"
|
||||
udf: True
|
||||
register: iso_result
|
||||
- debug: var=iso_result
|
||||
|
||||
- name: Check if iso file created
|
||||
stat:
|
||||
path: "{{ output_dir_test }}/test5.iso"
|
||||
register: iso_file
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- iso_result.changed == True
|
||||
- iso_file.stat.exists == True
|
|
@ -0,0 +1,12 @@
|
|||
# Test code for iso_create module
|
||||
# Copyright: (c) 2020, Diane Wang (Tomorrow9) <dianew@vmware.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
- name: Make sure our testing sub-directory does not exist
|
||||
file:
|
||||
path: '{{ output_dir_test }}'
|
||||
state: absent
|
||||
|
||||
- name: Create our testing sub-directory
|
||||
file:
|
||||
path: '{{ output_dir_test }}'
|
||||
state: directory
|
Loading…
Add table
Add a link
Reference in a new issue