Feature package updates #4 #5
|
@ -18,22 +18,14 @@ box. This implies that all ansible commands must be run from the
|
||||||
`ansible-experiments/package_updates` folder.
|
`ansible-experiments/package_updates` folder.
|
||||||
|
|
||||||
A small script `setup-requirements` is provided, that initializes everything,
|
A small script `setup-requirements` is provided, that initializes everything,
|
||||||
to be executed after the vagrant boxes came online. It will generate an
|
including doing a vagrant up. It will generate an ssh-config for said vagrant
|
||||||
ssh-config for said vagrant boxes, download roles from galaxy, and make a
|
boxes, download roles from galaxy, and make a base-install for the hosts
|
||||||
base-install for the hosts (installing python dependencies, ansible itself
|
(installing python dependencies, ansible itself on ubuntu1, a deploying an ssh
|
||||||
on ubuntu1, a deploying an ssh key to all nodes to be used from the vagrant box
|
key to all nodes to be used from the vagrant box `ubuntu1`, as
|
||||||
`ubuntu1`, as ansible controller machine.)
|
ansible controller machine.)
|
||||||
|
|
||||||
When deploying and setting up from the machine where vagrant runs, you need to
|
When deploying and setting up from the machine where vagrant runs, you need to
|
||||||
add some extra arguments:
|
add some extra arguments:
|
||||||
`--ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant`
|
`--ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant`
|
||||||
to ansible execution. These are not necessary once running ansible from
|
to ansible execution. These are not necessary once running ansible from
|
||||||
`ubuntu1`.
|
`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.
|
|
||||||
|
|
4
package_updates/Vagrantfile
vendored
4
package_updates/Vagrantfile
vendored
|
@ -1,7 +1,7 @@
|
||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=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.
|
# Uncomment below if you need the work around.
|
||||||
# Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
|
# Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ Vagrant.configure("2") do |config|
|
||||||
freebsd5.ssh.shell = "sh"
|
freebsd5.ssh.shell = "sh"
|
||||||
freebsd5.vm.base_mac = "080027D14C55"
|
freebsd5.vm.base_mac = "080027D14C55"
|
||||||
freebsd5.vm.synced_folder ".", "/vagrant", type: "rsync"
|
freebsd5.vm.synced_folder ".", "/vagrant", type: "rsync"
|
||||||
|
freebsd5.vm.boot_timeout = 600
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define "freebsd6" do |freebsd6|
|
config.vm.define "freebsd6" do |freebsd6|
|
||||||
|
@ -53,5 +54,6 @@ Vagrant.configure("2") do |config|
|
||||||
freebsd6.ssh.shell = "sh"
|
freebsd6.ssh.shell = "sh"
|
||||||
freebsd6.vm.base_mac = "080027D14C66"
|
freebsd6.vm.base_mac = "080027D14C66"
|
||||||
freebsd6.vm.synced_folder ".", "/vagrant", type: "rsync"
|
freebsd6.vm.synced_folder ".", "/vagrant", type: "rsync"
|
||||||
|
freebsd6.vm.boot_timeout = 600
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,24 +22,32 @@
|
||||||
- name: install ubuntu1 node as ansible control machine
|
- name: install ubuntu1 node as ansible control machine
|
||||||
hosts: ubuntu1
|
hosts: ubuntu1
|
||||||
tasks:
|
tasks:
|
||||||
- apt:
|
- name: install pip
|
||||||
|
apt:
|
||||||
name:
|
name:
|
||||||
- python3-pip
|
- python3-pip
|
||||||
- pip:
|
- name: install/upgrade Python tools
|
||||||
|
pip:
|
||||||
name:
|
name:
|
||||||
- pip
|
- pip
|
||||||
- setuptools
|
- setuptools
|
||||||
- cryptography
|
|
||||||
- paramiko
|
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
- pip:
|
- name: install/upgrade ansible dependency
|
||||||
|
pip:
|
||||||
|
name:
|
||||||
|
- cryptography
|
||||||
|
extra_args: --upgrade
|
||||||
|
- name: install ansible
|
||||||
|
pip:
|
||||||
name: ansible
|
name: ansible
|
||||||
version: 2.5.2
|
version: 2.5.2
|
||||||
- become_user: vagrant
|
- become_user: vagrant
|
||||||
|
name: checkout experiments repo on controller node
|
||||||
git:
|
git:
|
||||||
dest: ./ansible-experiments
|
dest: ./ansible-experiments
|
||||||
repo: https://github.com/stationgroup/ansible-experiments
|
repo: https://github.com/stationgroup/ansible-experiments
|
||||||
- become_user: vagrant
|
- become_user: vagrant
|
||||||
|
name: create ssh key for vagrant user
|
||||||
user:
|
user:
|
||||||
name: vagrant
|
name: vagrant
|
||||||
generate_ssh_key: true
|
generate_ssh_key: true
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
key: '{{ ansible_distribution }}'
|
key: '{{ ansible_distribution }}'
|
||||||
|
|
||||||
- name: upgrade debian based machines
|
- name: upgrade debian based machines
|
||||||
hosts: ubuntu:FreeBSD
|
hosts: Ubuntu:FreeBSD
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
- include_role:
|
- include_role:
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
- name: Upgrade FreeBSD packages - dry-run
|
- name: Upgrade FreeBSD packages - dry-run
|
||||||
command: pkg upgrade --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
|
check_mode: no
|
||||||
when: ansible_distribution == 'FreeBSD' and ansible_check_mode
|
when: ansible_distribution == 'FreeBSD' and ansible_check_mode
|
||||||
register: result_pkg
|
register: result_pkg
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
#!/bin/bash
|
#!/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
|
vagrant ssh-config > vagrant-ssh-config
|
||||||
ansible-galaxy install -r roles/requirements.yml
|
ansible-galaxy install -r roles/requirements.yml
|
||||||
ansible-playbook --ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant base-setup.yml
|
ansible-playbook --ssh-extra-args "-F ./vagrant-ssh-config" --inventory hosts-vagrant base-setup.yml
|
||||||
|
|
Loading…
Reference in a new issue