libvirt_cloud/roles/ansible-gentoo_install/tasks/main.yml

87 lines
2.9 KiB
YAML
Raw Normal View History

2023-12-29 19:40:31 +00:00
# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: ansible-gentoo_install nbd_disk ansible_connection"
debug:
2023-12-30 12:01:03 +00:00
verbosity: 0
msg: "DEBUG: ansible-gentoo_install nbd_disk={{ nbd_disk }} AGI_NBD_DISK={{AGI_NBD_DISK}} ansible_connection={{ ansible_connection }}"
2023-12-29 19:40:31 +00:00
check_mode: false
- set_fact:
AGI_target: Gentoo2
2023-12-30 12:01:03 +00:00
- name: "ansible-gentoo_install"
set_fact:
ansible_check_mode: false
when:
- "'ansible-gentoo_install' in ROLES"
- ansible_check_mode is true
2023-12-29 19:40:31 +00:00
- name: look for nbd partitions
shell: |
2023-12-30 12:01:03 +00:00
grep nbd /proc/partitions | head -1|sed -e 's/.* //'
2023-12-29 19:40:31 +00:00
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}}
2023-12-30 12:01:03 +00:00
[ -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
2023-12-29 19:40:31 +00:00
{{ansible_python_interpreter}} \
2023-12-30 12:01:03 +00:00
-c "import os sys; sys.path.append('{{PLAY_ANSIBLE_SRC}}/src/ansible_gentooimgr'); import gentooimgr; print(os.path.dirname(gentooimgr.__file__))"
2023-12-29 19:40:31 +00:00
register: gentooimgr_out
check_mode: false
ignore_errors: true
- block:
2023-12-30 12:01:03 +00:00
- name: set AGI_gentooimgr_configs
set_fact:
2023-12-29 19:40:31 +00:00
AGI_gentooimgr_configs: "{{gentooimgr_out.stdout}}/configs"
- name: ansible_gentooimgr nbd status
ansible_gentooimgr:
action: status
2023-12-30 12:01:03 +00:00
loglevel: "{{BOX_NBD_LOGLEVEL}}"
2023-12-29 19:40:31 +00:00
threads: 1
2023-12-30 12:01:03 +00:00
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}}"
2023-12-29 19:40:31 +00:00
download_dir: "{{AGI_NBD_FILES}}"
2023-12-30 12:01:03 +00:00
register: ansible_gentooimgr_out
2023-12-29 19:40:31 +00:00
ignore_errors: true
check_mode: false
2023-12-30 12:01:03 +00:00
- name: "DEBUG: ansible-gentoo_install nbd_disk ansible_connection"
debug:
verbosity: 0
var: ansible_gentooimgr_out
2023-12-29 19:40:31 +00:00
check_mode: false
when:
- ansible_connection in ['chroot', 'local', 'libvirt_qemu']
2023-12-30 12:01:03 +00:00
- ansible_distribution == 'Gentoo' or BOX_GENTOO_FROM_MP not in ['/', '']
2023-12-29 19:40:31 +00:00
# - nbd_disk|default('') == AGI_NBD_DISK
2023-12-30 12:01:03 +00:00
- name: include_tasks local.yml
include_tasks: local.yml
2023-12-29 19:40:31 +00:00
when:
- ansible_connection in ['chroot', 'local']
2023-12-30 12:01:03 +00:00
- ansible_distribution == 'Gentoo' or BOX_GENTOO_FROM_MP not in ['/', '']
# - nbd_disk|default('') == AGI_NBD_DISK