Allow user-defined extra distro packages
This change allows the deployer to specify lists of distro packages which will be installed in addition to those specified by this role Change-Id: Ief887c705ab477eeb6d56a21850ddfd85d89722b
This commit is contained in:
parent
32ac2a103e
commit
ba45a33f53
|
@ -185,17 +185,23 @@ nspawn_container_cache_files_from_host: []
|
|||
# - gnupg
|
||||
nspawn_container_distro_required_packages: "{{ _nspawn_container_distro_required_packages | default([]) }}"
|
||||
|
||||
# Define a list of extra distribution packages to install into the container cache
|
||||
nspawn_container_extra_distro_packages: []
|
||||
|
||||
# Default list of packages to install within the build container cache.
|
||||
# nspawn_container_distro_packages:
|
||||
# - curl
|
||||
# - tcpdump
|
||||
nspawn_container_distro_packages: "{{ _nspawn_container_distro_packages | default([]) }}"
|
||||
nspawn_container_distro_packages: "{{ _nspawn_container_distro_packages | default([]) + nspawn_container_extra_distro_packages }}"
|
||||
|
||||
# Define a list of extra distribution packages to install onto the host
|
||||
nspawn_hosts_extra_distro_packages: []
|
||||
|
||||
# Default list of packages to install on the physical host machine.
|
||||
# nspawn_hosts_distro_packages:
|
||||
# - bridge-utils
|
||||
# - btrfs-tools
|
||||
nspawn_hosts_distro_packages: "{{ _nspawn_hosts_distro_packages | default([]) }}"
|
||||
nspawn_hosts_distro_packages: "{{ _nspawn_hosts_distro_packages | default([]) + nspawn_hosts_extra_distro_packages }}"
|
||||
|
||||
|
||||
# === General container defaults ===============================================
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
connection: local
|
||||
become: true
|
||||
vars:
|
||||
extra_host_package: iotop
|
||||
extra_cache_package: lshw
|
||||
bridges: []
|
||||
nspawn_networks:
|
||||
nspawn_address:
|
||||
|
@ -56,12 +58,21 @@
|
|||
set_fact:
|
||||
nspawn_container_ssh_key: "{{ _root_ssh_key['content'] | b64decode }}"
|
||||
|
||||
- name: Ensure extra host package is not installed
|
||||
package:
|
||||
name: "{{ extra_host_package }}"
|
||||
state: absent
|
||||
|
||||
roles:
|
||||
- role: "nspawn_hosts"
|
||||
nspawn_container_base_name: "test-container"
|
||||
nspawn_container_cache_files:
|
||||
- src: files/container-file-copy-test.txt
|
||||
dest: /tmp/file-copied-from-deployment-host.txt
|
||||
nspawn_hosts_extra_distro_packages:
|
||||
- "{{ extra_host_package }}"
|
||||
nspawn_container_extra_distro_packages:
|
||||
- "{{ extra_cache_package }}"
|
||||
|
||||
post_tasks:
|
||||
- name: Check for nspawn bridge
|
||||
|
@ -113,6 +124,23 @@
|
|||
command: "machinectl read-only test-container yes"
|
||||
changed_when: false
|
||||
|
||||
- name: Get installation state of extra host package
|
||||
package:
|
||||
name: "{{ extra_host_package }}"
|
||||
state: present
|
||||
failed_when:
|
||||
- extra_host_package_state.changed == true
|
||||
register: extra_host_package_state
|
||||
|
||||
- name: Check for extra package installed in lxc cache
|
||||
find:
|
||||
paths: "/var/lib/machines"
|
||||
patterns: "{{ extra_cache_package }}"
|
||||
recurse: yes
|
||||
failed_when:
|
||||
extra_cache_package_find.matched == 0
|
||||
register: extra_cache_package_find
|
||||
|
||||
- name: Ensure a read-only image is read-only
|
||||
file:
|
||||
path: /var/lib/machines/test-container/test-file
|
||||
|
|
Loading…
Reference in New Issue