- name: Set VyOS branch name crux set_fact: vyos_branch: "crux" when: vyos_version is regex("^1\.2.*$") - name: Set VyOS branch name equuleus set_fact: vyos_branch: "equuleus" when: vyos_version is regex("^1\.3.*$") - name: Put debian.list become: true template: src: "templates/debian.list.j2" dest: "{{ vyos_install_root }}/etc/apt/sources.list.d/debian.list" - name: backup resolv.conf become: true command: mv {{ vyos_install_root }}/etc/resolv.conf /tmp/resolv.conf - name: add nameserver settings to chroot become: true copy: src: "files/resolv.conf" dest: "{{ vyos_install_root }}/etc/resolv.conf" - name: apt-get update become: true command: chroot {{ vyos_install_root }} apt-get -o Acquire::Check-Valid-Until=false update - name: Install cloud-init become: true command: chroot {{ vyos_install_root }} apt-get -t {{ vyos_branch | default('current') }} install -y cloud-init cloud-utils ifupdown - name: apt-get clean become: true command: chroot {{ vyos_install_root }} apt-get clean - name: delete apt lists from cache become: true command: chroot {{ vyos_install_root }} rm -rf /var/lib/apt/lists/ - name: Delete debian.list become: true file: path: "{{ vyos_install_root }}/etc/apt/sources.list.d/debian.list" state: absent - name: Create cfg.d dir become: true file: path: "{{ vyos_install_root }}/etc/cloud/cloud.cfg.d/" state: directory mode: 0755 - name: Put datasource_list.cfg become: true template: src: 90_dpkg.cfg.j2 dest: "{{ vyos_install_root }}/etc/cloud/cloud.cfg.d/90_dpkg.cfg" - name: run dpkg-reconfigure cloud-init become: true command: chroot {{ vyos_install_root }} dpkg-reconfigure -f noninteractive cloud-init - name: Disable config-stage modules become: true copy: src: "files/90_disable_config_stage.cfg" dest: "{{ vyos_install_root }}/etc/cloud/cloud.cfg.d/90_disable_config_stage.cfg" when: - cloud_init_disable_config is defined - cloud_init_disable_config == "true" - name: Add source-directory to the /etc/network/interfaces become: true lineinfile: path: "{{ vyos_install_root }}/etc/network/interfaces" line: "source-directory /etc/network/interfaces.d" create: yes - name: restore original resolv.conf become: true command: mv /tmp/resolv.conf {{ vyos_install_root }}/etc/resolv.conf