Skip to content

Instantly share code, notes, and snippets.

@nrclark
Created May 5, 2016 20:57
Show Gist options
  • Save nrclark/fedf38a17909b73b63fd2b69cacc0df8 to your computer and use it in GitHub Desktop.
Save nrclark/fedf38a17909b73b63fd2b69cacc0df8 to your computer and use it in GitHub Desktop.
Ansible playbook for provisioning a build server and building a package
---
- hosts: all
become: true
become_method: sudo
tasks:
- name: Update APT cache
apt: cache_valid_time=3600 update_cache=yes
- name: Upgrade installed packages
apt: upgrade=dist
notify:
- Cleanup packages
- name: Install development software
apt: name={{item}} state=latest
notify:
- Cleanup packages
with_items:
- git
- build-essential
- autoconf
- automake
- flex
- bison
- make-guile
- vim
- xfce4-terminal
- golang
- dh-make
- dh-systemd
- devscripts
- quilt
- libpam0g-dev
- name: Install Vimrc in /home/vagrant
unarchive:
src: vim_config.tar.gz
dest: /home/vagrant
group: vagrant
owner: vagrant
creates: /home/vagrant/.vimrc
- name: Install Vimrc in /root
unarchive:
src: vim_config.tar.gz
dest: /root
group: root
owner: root
creates: /root/.vimrc
- name: Check out Gogs-pkg Git repository
git:
repo: http://servername/gogs-pkg.git
dest: /home/vagrant/gogs-pkg
update: no
- name: Build a source snapshot
command: make -C /home/vagrant -f gogs-pkg/debian/rules get-orig-source
args:
creates: /home/vagrant/gogs_*.orig.tar.xz
- name: Extract source snapshot
shell: tar xf /home/vagrant/gogs_*.orig.tar.xz --strip-components=1
args:
chdir: /home/vagrant/gogs-pkg
creates: /home/vagrant/gogs-pkg/go
- name: Build source and binary packages
command: dpkg-buildpackage -us -uc
args:
chdir: /home/vagrant/gogs-pkg
creates: /home/vagrant/gogs_*_amd64.deb
creates: /home/vagrant/gogs_*.dsc
#creates: /home/vagrant/gogs_*_amd64.deb /home/vagrant/gogs_*.dsc /home/vagrant/gogs_*_amd64.changes /home/vagrant/gogs_*.debian.tar.xz /home/vagrant/gogs_*.orig.tar.xz
handlers:
- name: Cleanup packages
shell: true && apt-get autoremove -y && update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment