libvirt_cloud/roles/ansible-gentoo_install/tasks/main.yml
2023-12-30 22:09:49 +00:00

87 lines
2.9 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: ansible-gentoo_install nbd_disk ansible_connection"
debug:
verbosity: 0
msg: "DEBUG: ansible-gentoo_install nbd_disk={{ nbd_disk }} AGI_NBD_DISK={{AGI_NBD_DISK}} ansible_connection={{ ansible_connection }}"
check_mode: false
- set_fact:
AGI_target: Gentoo2
- name: "ansible-gentoo_install"
set_fact:
ansible_check_mode: false
when:
- "'ansible-gentoo_install' in ROLES"
- ansible_check_mode is true
- name: look for nbd partitions
shell: |
grep nbd /proc/partitions | head -1|sed -e 's/.* //'
register: nbd_out
failed_when: false
check_mode: false
- name: "include base by-platform vars"
include_vars: "{{item}}.yml"
with_items:
- "Linux"
- "{{ ansible_distribution }}{{ ansible_distribution_major_version }}"
- "target_{{AGI_target}}"
tags: always
- name: find module gentooimgr
shell: |
echo nbd_disk={{ nbd_disk }} ansible_connection={{ ansible_connection }}
echo ansible_distribution={{ansible_distribution}} BOX_GENTOO_FROM_MP={{BOX_GENTOO_FROM_MP}}
[ -d '{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr' ] || exit 1
[ -f '{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr/__init__.py' ] || exit 2
[ -d '{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr/gentooimgr' ] || exit 3
[ -f '{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr/gentooimgr/__init__.py' ] || exit 4
{{ansible_python_interpreter}} \
-c "import os sys; sys.path.append('{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr'); import gentooimgr; print(os.path.dirname(gentooimgr.__file__))"
register: gentooimgr_out
check_mode: false
ignore_errors: true
- block:
- name: set AGI_gentooimgr_configs
set_fact:
AGI_gentooimgr_configs: "{{gentooimgr_out.stdout}}/configs"
- name: ansible_gentooimgr nbd status
ansible_gentooimgr:
action: status
loglevel: "{{BOX_NBD_LOGLEVEL}}"
threads: 1
config: base.config
profile: "{{BOX_NBD_BASE_PROFILE}}"
kernel_dir: "{{BOX_NBD_KERNEL_DIR}}"
portage: '{{BOX_NBD_PORTAGE_FILE}}'
stage3: '{{BOX_NBD_STAGE3_FILE }}'
temporary_dir: "{{BOX_NBD_BASE_DIR}}"
download_dir: "{{AGI_NBD_FILES}}"
register: ansible_gentooimgr_out
ignore_errors: true
check_mode: false
- name: "DEBUG: ansible-gentoo_install nbd_disk ansible_connection"
debug:
verbosity: 0
var: ansible_gentooimgr_out
check_mode: false
when:
- ansible_connection in ['chroot', 'local', 'libvirt_qemu']
- ansible_distribution == 'Gentoo' or BOX_GENTOO_FROM_MP not in ['/', '']
# - nbd_disk|default('') == AGI_NBD_DISK
- name: include_tasks local.yml
include_tasks: local.yml
when:
- ansible_connection in ['chroot', 'local']
- ansible_distribution == 'Gentoo' or BOX_GENTOO_FROM_MP not in ['/', '']
# - nbd_disk|default('') == AGI_NBD_DISK