rpm-ostree/vagrant/setup.yml
Jonathan Lebon 313a832d7c vagrant: generate ssh-config
We further split libvm from vagrant. It no longer does 'vagrant
ssh-config'. Instead, it always assumes that an ssh-config is provided.
We now have complete separation of libvm from vagrant.

We change the ansible provisioner as follows:
  - Allow passing in a VAGRANT_BOX env var to override the default
    CentOS box.
  - No longer assume that the root user account is unlocked and has a
    valid 'vagrant' password. This worked for the centos box but isn't
    sure to work on every box. Instead, we now just run ansible as the
    default vagrant user, and during provisioning set up the root
    account and generate an ssh-config so that libvm can connect
    directly as root.
  - No longer build the buildimg during provisioning. This actually
    stopped working a while ago since the default rsync is disabled. We
    can just let the buildimg get created on the first compilation. In
    practice, the bigger issue isn't creating the buildimg, but being
    able to easily update the host and buildimg pkgs.

Closes: #516
Approved by: jlebon
2016-11-16 18:14:23 +00:00

40 lines
1.2 KiB
YAML

---
- hosts: all
gather_facts: no
become: yes
tasks:
# if we're not already using the CAHC box, then add the
# remote to make it easier for the user to rebase later
- name: add CAHC ostree remote
command: >
ostree remote add --set=gpg-verify=false centos-atomic-continuous
https://ci.centos.org/artifacts/sig-atomic/rdgo/centos-continuous/ostree/repo/
args:
creates: /etc/ostree/remotes.d/centos-atomic-continuous.conf
# We generate a valid ssh-config here that libvm.sh can
# make use of. This also requires making sure the root
# user can be ssh'ed in directly.
# set up auth key
- file: state=directory mode=0600 path=/root/.ssh
- command: cp .ssh/authorized_keys /root/.ssh
# make sure root account is unlocked
- name: unlock root account
command: passwd -u root
# generate ssh config
- name: generate config
local_action: shell vagrant ssh-config > ../ssh-config
become: no
- name: make sure user in config is root
local_action: lineinfile
dest=../ssh-config
regexp='^( *User) .*$'
line='\1 root'
backrefs=yes
become: no