From b1a9d16f504a85b2a809a0b335f81b45c5dc8edf Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 12:50:22 +0200 Subject: [PATCH 1/6] avoid provisioning timeout for freebsd --- package_updates/Vagrantfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package_updates/Vagrantfile b/package_updates/Vagrantfile index 95ee069..dcba2c7 100644 --- a/package_updates/Vagrantfile +++ b/package_updates/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# https://github.com/hashicorp/vagrant/issues/9442#issuecomment-363080565 +# https://github.com/hashicorp/vagrant/issues/9442#issuecomment-363080565 # Uncomment below if you need the work around. # Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com') @@ -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 -- 2.44.2 From 1671c7b1e2e91755ae19f9bca84bc2d0bb5c8b01 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 12:47:54 +0200 Subject: [PATCH 2/6] fix: pkg upgrade --dry-run always returns an error It is considered as the same flow as the user refusing to perform the actual upgrade See https://github.com/freebsd/pkg/issues/1470 --- package_updates/roles/freebsd-update/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package_updates/roles/freebsd-update/tasks/main.yml b/package_updates/roles/freebsd-update/tasks/main.yml index 8a156b7..dbb9c02 100644 --- a/package_updates/roles/freebsd-update/tasks/main.yml +++ b/package_updates/roles/freebsd-update/tasks/main.yml @@ -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 -- 2.44.2 From 21943464f5a39a7aad7024ce977b89c76e6f1592 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 13:11:30 +0200 Subject: [PATCH 3/6] fix: let ansible install handle dependencies and add proper task names --- package_updates/base-setup.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/package_updates/base-setup.yml b/package_updates/base-setup.yml index 70235cd..69cb30a 100644 --- a/package_updates/base-setup.yml +++ b/package_updates/base-setup.yml @@ -22,24 +22,27 @@ - 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 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 -- 2.44.2 From d54b5372405ae982265b741c05d0676e1cd0cbad Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 13:12:08 +0200 Subject: [PATCH 4/6] Fix typo - Ubuntu dynamic group name --- package_updates/os_upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_updates/os_upgrade.yml b/package_updates/os_upgrade.yml index fbc8987..b315791 100644 --- a/package_updates/os_upgrade.yml +++ b/package_updates/os_upgrade.yml @@ -7,7 +7,7 @@ key: '{{ ansible_distribution }}' - name: upgrade debian based machines - hosts: ubuntu:FreeBSD + hosts: Ubuntu:FreeBSD gather_facts: false tasks: - include_role: -- 2.44.2 From aa4cd65e69504f373d857c5ba8019cf740c036a1 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 14:33:13 +0200 Subject: [PATCH 5/6] setup script does all from vagrant up to check upgrade' --- package_updates/README.md | 18 +++++------------- package_updates/setup-requirements | 13 +++++++++++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/package_updates/README.md b/package_updates/README.md index df6b3d7..feaa13d 100644 --- a/package_updates/README.md +++ b/package_updates/README.md @@ -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. diff --git a/package_updates/setup-requirements b/package_updates/setup-requirements index b9b5be4..bcc18a0 100755 --- a/package_updates/setup-requirements +++ b/package_updates/setup-requirements @@ -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 -- 2.44.2 From 4a06112096f83957733fb91f170aca4dfd412607 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 12 May 2018 14:34:13 +0200 Subject: [PATCH 6/6] install correct dependency version --- package_updates/base-setup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package_updates/base-setup.yml b/package_updates/base-setup.yml index 69cb30a..a3dbfa8 100644 --- a/package_updates/base-setup.yml +++ b/package_updates/base-setup.yml @@ -32,6 +32,11 @@ - pip - setuptools extra_args: --upgrade + - name: install/upgrade ansible dependency + pip: + name: + - cryptography + extra_args: --upgrade - name: install ansible pip: name: ansible -- 2.44.2