# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*- --- - name: "base guest.yml" debug: verbosity: 1 msg: "base guest.yml" - block: # "SSH_CLIENT": "10.0.2.2 58858 22", # "SSH_CONNECTION": "10.0.2.2 58858 10.0.2.15 22", - name: "set_fact base_vagrant_ipv4_priv" set_fact: # ansible_interfaces | last base_vagrant_ipv4_priv_dev: "{{ ansible_interfaces|last }}" # "enp0s8" # Ubuntu16 private guest # ansible_all_ipv4_addresses | last base_vagrant_ipv4_priv_ip: "{{ ansible_all_ipv4_addresses[1] }}" # "192.168.33.10" # ubuntu16 private host - get this on the controller: # ifconfig | grep -a 1 vboxnet1 | sed -e 's/.*inet //' -e 's/ .*//' # ansible_enp0s8.network is .0 base_vagrant_ipv4_priv_gw_ip: "192.168.33.1" # base_vagrant_ipv4_priv_gw_dev: "vboxnet1" when: # FixMe: do we need to be connected for these networks to be up - I doubtit - true # FixMe: ignore_errors: true # modprobe would load them - we just want to look if they have been compiled - name: "ensure kernel modules needed base_kmods_in_vbox_guest" shell: | grep -q "{{item}}.ko" /lib/modules/{{ansible_kernel}}/modules.dep when: - "item != ''" with_items: - "{{ base_kmods_in_vbox_guest }}" - name: "modprobe VM modules base_kmods_in_vbox_guest" modprobe: name: "{{ item }}" # "{{ 'absent' if ansible_virtualization_role|replace('NA', 'host') == 'host' else 'present'}}" state: present when: - item != '' and item != [] with_items: # ansible_virtualization_type == 'lxc' - "{{virtualbox_kmods_in_vbox_guest if (ansible_bios_version == 'VirtualBox' or ansible_virtualization_type == 'virtualbox' ) else [] }}" # FixMe: lookup the source - "{{ libvirt_kmods_in_vbox_guest if ansible_virtualization_type == 'kvm' else [] }}" # FixMe: lookup the source - "{{ qemu_kmods_in_vbox_guest if ansible_virtualization_type == 'kvm' else [] }}" # FixMe: ignore_errors: true # not usr/bin or usr/sbin - /usr/lib/openssh/sftp-server should be ok # github.com/dustymabe/vagrant-sshfs/lib/vagrant-sshfs/synced_folder.rb - name: "/usr/libexec/sftp-server" file: src: "{{ item }}" dest: "/usr/bin/sftp-server" state: link force: yes with_first_found: - "/usr/lib/openssh/sftp-server" # Ubuntu - "/usr/{{BASE_LIB}}/misc/sftp-server" # Gentoo #? move to testforge not base - we are not installing apt until then ignore_errors: true when: - not ansible_check_mode - ansible_virtualization_role|replace('NA', 'host') == 'guest' - ansible_bios_version == "VirtualBox" - ansible_virtualization_type == 'virtualbox' - ansible_connection != 'chroot' # redundent? # FixMe: resolv.conf resolvconf - name: "base /etc/resolv.conf" blockinfile: dest: /etc/resolv.conf.localhost create: yes marker: "# {mark} ANSIBLE MANAGED BLOCK base" block: | nameserver 127.0.0.1 nameserver 127.0.0.1