Skip to content

Instantly share code, notes, and snippets.

@skamithi
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save skamithi/8995933 to your computer and use it in GitHub Desktop.

Select an option

Save skamithi/8995933 to your computer and use it in GitHub Desktop.
Ansible Tips
# Execute gnome action as a user
- name: enable middle click
shell: "sudo -u {{ core_username.stdout }} dbus-launch gsettings set org.gnome.settings-daemon.peripherals.mouse middle-button-enabled true"
# Execute Gem Install using RVM
- name: install knife-solo
shell: >
executable=/bin/bash source /etc/profile.d/rvm.sh;
gem install --no-ri --no-rdoc knife-solo
# Check if a file exists
- name: check if RVM is installed
stat: path=/etc/profile.d/rvm.sh
register: rvm
- name: run apt-get update again. will speed up rvm install
apt: update_cache=yes
when: rvm.stat.exists == False
#Assign core user of laptop to 'core_username' var
- name: get username of core user
shell: 'grep "^sudo" /etc/group | cut -d: -f4 | cut -d, -f1'
register: core_username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment