Created
August 2, 2016 17:07
-
-
Save jlgaddis/b923ee7deeca600febd988889de5871e to your computer and use it in GitHub Desktop.
Bootstrap OpenBSD so it can be managed by Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# This script can be executed to bootstrap a clean OpenBSD installation | |
# so that it can be managed via Ansible. | |
# | |
# Enter the root password when prompted (twice) | |
# | |
# NB: Assumes $TARGET_HOST has already been added to inventory and | |
# appropriate groups, and that variables are set as necessary | |
# (e.g. ansible_become_method, ansible_python_interpreter, etc.) | |
# | |
ansible $TARGET_HOST -m raw -b -K -a "echo 'permit nopass bofh as root' > /etc/doas.conf" -e "ansible_become_method=su" | |
ansible $TARGET_HOST -m raw -b -K -a "echo 'installpath = mirrors.gigenet.com' > /etc/pkg.conf" -e "ansible_become_method=su" | |
ansible $TARGET_HOST -m raw -b -a "pkg_add -z python-2" | |
# To test success, run "ansible $TARGET_HOST -m setup" |
pkg.conf is deprecated. You can use /etc/installurl now. Also the url only has to end at OpenBSD the version and package "directory" are appended to the uri eg:
tasks:
- name Create installurl
raw: echo "http://mirror.esc7.net/pub/OpenBSD" > /etc/installurl - name Install Python 2.7
raw: pkg_add -z python-2.7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, log in to the OpenBSD system, either locally or via SSH, and execute the following commands (as root):
The system can now be managed via Ansible.