ansible-experiments/package_updates/README.md

101 lines
3.7 KiB
Markdown
Raw Normal View History

2018-05-16 21:40:45 +00:00
# Update packages on Ubuntu and Freebsd
## Summary
* Updates _Ubuntu_ packages and OS with `apt`.
* Updates _FreeBSD_ packages with `pkg`, and OS with `freebsd-update`.
2018-05-16 22:31:17 +00:00
2018-05-16 22:36:16 +00:00
## :book: Getting Started
2018-05-16 22:31:17 +00:00
2018-05-16 22:36:16 +00:00
## :white_check_mark: Dependencies
2018-05-16 22:31:17 +00:00
2018-05-16 22:36:16 +00:00
### macOS Dependencies
2018-05-16 22:31:17 +00:00
```bash
brew cask install vagrant virtualbox ; brew install git ansible
```
2018-05-16 22:36:16 +00:00
### Linux - Ubuntu Dependencies
2018-05-16 22:31:17 +00:00
Add this Ansible PPA and [Unofficial Vagrant Debian Repository](https://vagrant-deb.linestarve.com/) because [Vagrant is made by the excuse making developers at HashiCorp](https://github.com/hashicorp/vagrant-installers/issues/12#issuecomment-328379740).
_If you use the Ubuntu Repository version of Vagrant, it is **very** behind release and will likely throw errors._
```bash
sudo add-apt-repository ppa:ansible/ansible ; sudo apt-get update ; sudo bash -c 'echo deb https://vagrant-deb.linestarve.com/ any main > /etc/apt/sources.list.d/wolfgang42-vagrant.list' && sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key AD319E0F7CFFA38B4D9F6E55CE3F3DE92099F7A4 && sudo apt-get update
```
Then install the dependencies.
```bash
sudo apt install -y vagrant virtualbox ansible git rsync python-pip
```
2018-05-16 22:36:16 +00:00
_If you feel you **need** the latest VirtualBox you can [follow the Oracle instructions](https://www.virtualbox.org/wiki/Linux_Downloads) any time._
2018-05-16 22:31:17 +00:00
2018-05-16 22:36:16 +00:00
### FreeBSD Dependencies
2018-05-16 22:31:17 +00:00
`root:#`
```bash
pkg install --yes vagrant virtualbox-ose-nox11 ansible git rsync ca_root_nss
```
**Windows (TBD) Dependencies**
2018-05-16 22:46:02 +00:00
# :floppy_disk: Install and Usage
One-liner to start and provision all the VMs and prime them for _Ansible_.
2018-05-16 22:31:17 +00:00
```bash
cd ; git clone https://github.com/stationgroup/ansible-experiments ; cd ~/ansible-experiments/package_updates ; ./setup-requirements
```
2018-05-16 22:46:02 +00:00
Now while you're in the directory `ansible-experiments/package_updates`, you can ssh from the _host_ to your _Ansible_ control node, `ubuntu1`:
```bash
vagrant ssh ubuntu1
```
Or, while you're still at the VM host shell you can check and see if your VMs are running:
```bash
vagrant status
```
If you're all done, need disk space, or you fucked up, you can `destroy` everything or `halt` it.
2018-05-16 22:52:09 +00:00
_E.g._ `vagrant destroy` `vagrant halt` `vagrant up` [`RTFM`](https://www.vagrantup.com/docs/cli/up.html)
2018-05-16 22:46:02 +00:00
## :neckbeard: Details
Update packages on ubuntu and freebsd Fixes #1 The Vagrant file being used is a copy from `https://github.com/stationgroup/vagrant-labs/tree/master/imperialspeculate`. Two roles are being used: debian-upgrade (an upstream Galaxy role) and freebsd-upgrade (a small role based on what was proposed in the comments of #1 and extended with proper support for check mode.) The upgrade process is contained in the playbook os_upgrade.yml, which will automatically create proper groups for Ubuntu and FreeBSD hosts. If unneeded, this first play can be left out, and the target hosts: in the second play can be replaced by the relevant groups you have in the inventory (e.g. ec2 tags.) A local ansible.cfg is defined, and needed for these scripts to run out of the 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.) 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`. 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.
2018-05-11 14:37:03 +00:00
The Vagrant file being used is a copy from
`https://github.com/stationgroup/vagrant-labs/tree/master/imperialspeculate`.
Two roles are being used: debian-upgrade (an upstream Galaxy role) and
freebsd-upgrade (a small role based on what was proposed in the comments of #1
and extended with proper support for check mode.)
The upgrade process is contained in the playbook os_upgrade.yml, which will
automatically create proper groups for Ubuntu and FreeBSD hosts. If unneeded,
this first play can be left out, and the target hosts: in the second play can be
replaced by the relevant groups you have in the inventory (e.g. ec2 tags.)
A local ansible.cfg is defined, and needed for these scripts to run out of the
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,
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.)
Update packages on ubuntu and freebsd Fixes #1 The Vagrant file being used is a copy from `https://github.com/stationgroup/vagrant-labs/tree/master/imperialspeculate`. Two roles are being used: debian-upgrade (an upstream Galaxy role) and freebsd-upgrade (a small role based on what was proposed in the comments of #1 and extended with proper support for check mode.) The upgrade process is contained in the playbook os_upgrade.yml, which will automatically create proper groups for Ubuntu and FreeBSD hosts. If unneeded, this first play can be left out, and the target hosts: in the second play can be replaced by the relevant groups you have in the inventory (e.g. ec2 tags.) A local ansible.cfg is defined, and needed for these scripts to run out of the 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.) 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`. 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.
2018-05-11 14:37:03 +00:00
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
2018-05-16 22:52:09 +00:00
`ubuntu1`.