Skip to content

Instantly share code, notes, and snippets.

@Artemmkin
Last active January 24, 2018 15:14
Show Gist options
  • Save Artemmkin/7a1f12df9cc6a9c33534ddc7967835d8 to your computer and use it in GitHub Desktop.
Save Artemmkin/7a1f12df9cc6a9c33534ddc7967835d8 to your computer and use it in GitHub Desktop.
Configuration playbook example
---
- name: Configure Raddit App Instance
hosts: all
gather_facts: false
become: true
pre_tasks:
- name: Install Python2 for Ansible to work
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
changed_when: false
tasks:
- name: Install Ruby
apt: "name={{ item }} state=present"
with_items:
- ruby-full
- build-essential
- name: Install Bundler
gem:
name: bundler
state: present
user_install: no
- name: Add APT key
apt_key:
id: EA312927
keyserver: keyserver.ubuntu.com
- name: Add MongoDB repo
apt_repository:
repo: deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
state: present
- name: Install MongoDB package
apt:
name: mongodb-org
state: present
update_cache: yes
- name: Start MongoDB
systemd:
name: mongod
state: started
enabled: yes
- name: Download Unit File for Raddit
get_url:
url: https://gist.githubusercontent.com/Artemmkin/ce82397cfc69d912df9cd648a8d69bec/raw/7193a36c9661c6b90e7e482d256865f085a853f2/raddit.service
dest: /etc/systemd/system/raddit.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment