Skip to content

Instantly share code, notes, and snippets.

@sndsgd
Created August 24, 2021 20:59
Show Gist options
  • Save sndsgd/7a5bd5f99892d822bd70e97075252878 to your computer and use it in GitHub Desktop.
Save sndsgd/7a5bd5f99892d822bd70e97075252878 to your computer and use it in GitHub Desktop.
Ansible task to build i3status
---
- name: register i3status version
shell: i3status --version | cut -d' ' -f2
ignore_errors: yes
register: i3status_version_command
- name: build i3status from source
block:
- name: install dependencies
apt:
name:
- autoconf
- libconfuse-dev
- libyajl-dev
- libasound2-dev
- libiw-dev
- asciidoc
- libpulse-dev
- libnl-genl-3-dev
- name: create temporary directory for i3status repo
tempfile:
state: directory
suffix: i3status
register: i3status_tmpdir
- name: checkout git repo
git:
repo: https://github.com/i3/i3status.git
version: "{{ i3status_version }}"
dest: "{{ i3status_tmpdir.path }}"
- name: run autoreconf
shell: autoreconf -fi
args:
chdir: "{{ i3status_tmpdir.path }}"
- name: create temp directory for i3status build
file:
path: "{{ i3status_tmpdir.path }}/build"
state: directory
- name: configure and build i3status
shell: "{{ item }}"
args:
chdir: "{{ i3status_tmpdir.path }}/build"
with_items:
- "../configure"
- "make -j{{ ansible_facts.processor_cores }}"
- "make install"
always:
- name: cleanup
file:
path: "{{ i3status_tmpdir.path }}"
state: absent
when: >
i3status_version_command.rc != 0
or i3status_version_command.stdout != i3status_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment