Feature package updates #4 #5

Merged
srgvg merged 6 commits from feature-package-updates-#4 into master 2018-05-12 22:04:49 +00:00
6 changed files with 35 additions and 22 deletions

View file

@ -18,22 +18,14 @@ box. This implies that all ansible commands must be run from the
`ansible-experiments/package_updates` folder.
A small script `setup-requirements` is provided, that initializes everything,
to be executed after the vagrant boxes came online. It will generate an
ssh-config for said vagrant boxes, download roles from galaxy, and make a
base-install for the hosts (installing python dependencies, ansible itself
on ubuntu1, a deploying an ssh key to all nodes to be used from the vagrant box
`ubuntu1`, as ansible controller machine.)
including doing a vagrant up. It will generate an ssh-config for said vagrant
boxes, download roles from galaxy, and make a base-install for the hosts
(installing python dependencies, ansible itself on ubuntu1, a deploying an ssh
key to all nodes to be used from the vagrant box `ubuntu1`, as
ansible controller machine.)
When deploying and setting up from the machine where vagrant runs, you need to
add some extra arguments:
`--ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant`
to ansible execution. These are not necessary once running ansible from
`ubuntu1`.
## BUGS
The vagrant setup seems to have a provisioning bug, that kicks in with the
latest 18.04 Ubuntu. The FreeBSD boxes also experience a provisioning problem,
with the same result: the second, private network interface does not get
configured. As these interfaces are used to run ansible from `ubuntu1`, I could
not fully test the scripts from there.

View file

@ -43,6 +43,7 @@ Vagrant.configure("2") do |config|
freebsd5.ssh.shell = "sh"
freebsd5.vm.base_mac = "080027D14C55"
freebsd5.vm.synced_folder ".", "/vagrant", type: "rsync"
freebsd5.vm.boot_timeout = 600
end
config.vm.define "freebsd6" do |freebsd6|
@ -53,5 +54,6 @@ Vagrant.configure("2") do |config|
freebsd6.ssh.shell = "sh"
freebsd6.vm.base_mac = "080027D14C66"
freebsd6.vm.synced_folder ".", "/vagrant", type: "rsync"
freebsd6.vm.boot_timeout = 600
end
end

View file

@ -22,24 +22,32 @@
- name: install ubuntu1 node as ansible control machine
hosts: ubuntu1
tasks:
- apt:
- name: install pip
apt:
name:
- python3-pip
- pip:
- name: install/upgrade Python tools
pip:
name:
- pip
- setuptools
- cryptography
- paramiko
extra_args: --upgrade
- pip:
- name: install/upgrade ansible dependency
pip:
name:
- cryptography
extra_args: --upgrade
- name: install ansible
pip:
name: ansible
version: 2.5.2
- become_user: vagrant
name: checkout experiments repo on controller node
git:
dest: ./ansible-experiments
repo: https://github.com/stationgroup/ansible-experiments
- become_user: vagrant
name: create ssh key for vagrant user
user:
name: vagrant
generate_ssh_key: true

View file

@ -7,7 +7,7 @@
key: '{{ ansible_distribution }}'
- name: upgrade debian based machines
hosts: ubuntu:FreeBSD
hosts: Ubuntu:FreeBSD
gather_facts: false
tasks:
- include_role:

View file

@ -20,6 +20,8 @@
- name: Upgrade FreeBSD packages - dry-run
command: pkg upgrade --dry-run
failed_when: False # --dry-run always returns failure
# https://github.com/freebsd/pkg/issues/1470
check_mode: no
when: ansible_distribution == 'FreeBSD' and ansible_check_mode
register: result_pkg

View file

@ -1,6 +1,15 @@
#!/bin/bash
set -x
set -e
# c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t
# vi: set shiftwidth=4 tabstop=4 noexpandtab:
# :indentSize=4:tabSize=4:noTabs=false:
set -o nounset
set -o errexit
set -o pipefail
vagrant up
vagrant ssh-config > vagrant-ssh-config
ansible-galaxy install -r roles/requirements.yml
ansible-playbook --ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant base-setup.yml