Skip to content

Instantly share code, notes, and snippets.

@illenseer illenseer/site.yml
Created Aug 30, 2013

Embed
What would you like to do?
Playbook to get all prerequest for ansible installed on FreeBSD.
---
- hosts: freebsd
gather_facts: false
user: root
tasks:
- name: install pkgng
raw: "pkg_info | grep -v 'pkg-' > /dev/null ; if $? then pkg_add -r pkg; pkg2ng; echo 'WITH_PKGNG=yes' >> /etc/make.conf; echo 'packagesite: <your_pkg_mirror>' >> /usr/local/etc/pkg.conf; pkg update; endif"
- name: install python27
raw: pkg install -y python27
- name: add ansible ssh-key
authorized_key: user=root key="{{ item }}"
with_file:
- ../ssh_keys/ansible.pub
@tomster

This comment has been minimized.

Copy link

tomster commented Sep 1, 2013

FWIW it's not working for me:

PLAY [jailhost] *************************************************************** 

TASK: [install pkgng] ********************************************************* 
<10.0.1.180> ESTABLISH CONNECTION FOR USER: tomster
<10.0.1.180> EXEC ['ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/tomster/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', '10.0.1.180', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=ktivepxevjqvjuzeqwsetgprmhglvedx] password: " -u root $SHELL -c \'"\'"\'pkg_info | grep -v \'"\'"\'"\'"\'"\'"\'"\'"\'pkg-\'"\'"\'"\'"\'"\'"\'"\'"\' > /dev/null ; if $? then pkg_add -r pkg; pkg2ng; echo \'"\'"\'"\'"\'"\'"\'"\'"\'WITH_PKGNG=yes\'"\'"\'"\'"\'"\'"\'"\'"\' >> /etc/make.conf; pkg update; endif\'"\'"\'\'']
failed: [10.0.1.180] => {"rc": 2}
stdout: Syntax error: end of file unexpected (expecting "then")


FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/tomster/bootstrap.retry

10.0.1.180                 : ok=0    changed=0    unreachable=0    failed=1   

@tomster

This comment has been minimized.

Copy link

tomster commented Nov 21, 2013

FWIW here's the working version that i eventually ended up with https://gist.github.com/tomster/7585211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.