fix network activation at reboot and disable network configuration for debian image

This commit is contained in:
Antoine 2021-01-23 19:57:16 +01:00
parent 124ff2fd40
commit e58efdb5ad
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
4 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,4 @@
version: '3.7' version: "3.7"
services: services:
gentoo_packer: gentoo_packer:
@ -16,7 +16,7 @@ services:
- "./image/assets:/packer" - "./image/assets:/packer"
- "./image/cache:/packer-cache" - "./image/cache:/packer-cache"
ports: ports:
- "5900:5900" - "5900:5900"
debian_packer: debian_packer:
image: ${REGISTRY_URL}/${IMAGE_NAME}:${VERSION} image: ${REGISTRY_URL}/${IMAGE_NAME}:${VERSION}
@ -26,7 +26,7 @@ services:
- SSH_LIVE_USERNAME=debian - SSH_LIVE_USERNAME=debian
- SSH_LIVE_PASSWORD=debian - SSH_LIVE_PASSWORD=debian
- IMAGE_VERSION=10.7.0 - IMAGE_VERSION=10.7.0
- ANSIBLE_EXTRA_VARS=generated_user=antoine generated_group=users - ANSIBLE_EXTRA_VARS=generated_user=antoine generated_group=users enable_network=false
- ANSIBLE_PLAYBOOK=/packer/ansible/playbook-debian.yml - ANSIBLE_PLAYBOOK=/packer/ansible/playbook-debian.yml
- ISO_CHECKSUM=file:https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA512SUMS - ISO_CHECKSUM=file:https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA512SUMS
#- ISO_CHECKSUM=file:https://cdimage.debian.org/mirror/cdimage/archive/10.7.0/amd64/iso-cd/SHA512SUMS #- ISO_CHECKSUM=file:https://cdimage.debian.org/mirror/cdimage/archive/10.7.0/amd64/iso-cd/SHA512SUMS
@ -36,4 +36,4 @@ services:
- "./image/assets:/packer" - "./image/assets:/packer"
- "./image/cache:/packer-cache" - "./image/cache:/packer-cache"
ports: ports:
- "5900:5900" - "5900:5900"

View File

@ -12,6 +12,7 @@
fail_msg: "Pass param ssh_pub, generated_user and generated_group to launch this playbook" fail_msg: "Pass param ssh_pub, generated_user and generated_group to launch this playbook"
roles: roles:
- role: debian-init - role: debian-init
enable_network: false
- role: create-user - role: create-user
vars: vars:
ssh_public_key: "{{ ssh_pub }}" ssh_public_key: "{{ ssh_pub }}"

View File

@ -1,4 +1,3 @@
grub_file: "/etc/default/grub" grub_file: "/etc/default/grub"
grub_timeout: 1 grub_timeout: 1
@ -11,3 +10,10 @@ initial_package:
- vim - vim
- lsb-release - lsb-release
- cloud-init - cloud-init
- bash-completion
initial_service:
- serial-getty@ttyS0.service
# configure and enable network /etc/network/interface file
enable_network: true

View File

@ -14,9 +14,10 @@
dest: "{{ network_config.dest }}" dest: "{{ network_config.dest }}"
owner: root owner: root
group: root group: root
mode: '0644' mode: "0644"
notify: notify:
- Restart networking - Restart networking
when: enable_network
- name: "flush all notified handler" - name: "flush all notified handler"
meta: flush_handlers meta: flush_handlers
@ -28,3 +29,13 @@
update_cache: yes update_cache: yes
state: present state: present
notify: Start qemu-guest service notify: Start qemu-guest service
- name: "start/enable initial service"
become: yes
service:
name: "{{ service }}"
state: started
enabled: yes
loop: "{{ initial_service }}"
loop_control:
loop_var: service