Detect architecture of host machine for LXC images
Tested for amd64/x86_64 and arm64/aarch64
This commit is contained in:
parent
c6cb78ce6f
commit
5a4f039fc0
|
@ -17,6 +17,14 @@
|
||||||
#service_password: {{ service_username }}
|
#service_password: {{ service_username }}
|
||||||
#service_ssh_keys: {{ ssh_keys }}
|
#service_ssh_keys: {{ ssh_keys }}
|
||||||
|
|
||||||
|
# architecture mapping from "uname -m" to package
|
||||||
|
architecture_mapping:
|
||||||
|
aarch64: arm64
|
||||||
|
x86_64: amd64
|
||||||
|
#ppc64le: ppc64el
|
||||||
|
#s390x: s390x
|
||||||
|
#armv7l: armhf
|
||||||
|
|
||||||
# "*cmdline_" must be listed AFTER "^cmdline_"!
|
# "*cmdline_" must be listed AFTER "^cmdline_"!
|
||||||
cmdline_python:
|
cmdline_python:
|
||||||
alpine:
|
alpine:
|
||||||
|
@ -96,12 +104,19 @@
|
||||||
delegate_to: "{{ ansible_host|default('localhost') }}"
|
delegate_to: "{{ ansible_host|default('localhost') }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Get architecture
|
||||||
|
shell: "uname -m || true"
|
||||||
|
changed_when: false
|
||||||
|
register: lxc_host_arch_native
|
||||||
|
delegate_to: "{{ ansible_host|default('localhost') }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Create LXContainer
|
- name: Create LXContainer
|
||||||
lxc_container:
|
lxc_container:
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ inventory_hostname }}"
|
||||||
state: started
|
state: started
|
||||||
template: download
|
template: download
|
||||||
template_options: "-a amd64 -d {{ os_d }} -r {{ os_r }} {% if 'no-validate' in lxc_download_validate.stdout %}--no-validate{% endif %}"
|
template_options: "-a {{ architecture_mapping[lxc_host_arch_native.stdout] }} -d {{ os_d }} -r {{ os_r }} {% if 'no-validate' in lxc_download_validate.stdout %}--no-validate{% endif %}"
|
||||||
config: "{{ lxc_config_file|default('/etc/lxc/ansible.conf') }}"
|
config: "{{ lxc_config_file|default('/etc/lxc/ansible.conf') }}"
|
||||||
container_config:
|
container_config:
|
||||||
- "lxc.group = {{ os_d }}"
|
- "lxc.group = {{ os_d }}"
|
||||||
|
|
Loading…
Reference in a new issue