summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dev_env_setup/.gitignore4
-rw-r--r--tools/dev_env_setup/README.md64
-rw-r--r--tools/dev_env_setup/ansible.cfg140
-rw-r--r--tools/dev_env_setup/default_variables.yaml1
-rwxr-xr-xtools/dev_env_setup/install.sh72
-rw-r--r--tools/dev_env_setup/keys/id_rsa51
-rw-r--r--tools/dev_env_setup/keys/id_rsa.pub1
-rw-r--r--tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml16
-rw-r--r--tools/dev_env_setup/playbooks/jhbuild_run.yaml19
-rw-r--r--tools/dev_env_setup/playbooks/kill_shell.yaml18
-rw-r--r--tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml14
-rw-r--r--tools/dev_env_setup/playbooks/setup_dev_folder.yaml16
-rw-r--r--tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml20
-rw-r--r--tools/dev_env_setup/playbooks/setup_jhbuild.yaml34
-rw-r--r--tools/dev_env_setup/playbooks/setup_other_tools.yaml24
-rwxr-xr-xtools/dev_env_setup/setup_dev_machine.sh57
-rw-r--r--tools/dev_env_setup/templates/.jhbuildrc-auth.j24
-rw-r--r--tools/dev_env_setup/templates/add_dev_tools_folder.py48
-rw-r--r--tools/dev_env_setup/templates/known_hosts2
19 files changed, 605 insertions, 0 deletions
diff --git a/tools/dev_env_setup/.gitignore b/tools/dev_env_setup/.gitignore
new file mode 100644
index 0000000..cc324a5
--- /dev/null
+++ b/tools/dev_env_setup/.gitignore
@@ -0,0 +1,4 @@
+*.swp
+hosts
+*~
+*.log
diff --git a/tools/dev_env_setup/README.md b/tools/dev_env_setup/README.md
new file mode 100644
index 0000000..bc2c0e2
--- /dev/null
+++ b/tools/dev_env_setup/README.md
@@ -0,0 +1,64 @@
+# Using Ansible
+
+## Principles
+
+- Ansible is an automatic configuration management (CM) tool that helps with deploying and
+configuring devices with little interaction and repeatability. Anything that one might manually
+"configure" on a target device should be done through Ansible to make sure that we can with
+minimal effort recreate critical parts of our infrastructure. While there are limitation to
+what can be done with this tool, the benefits (currently) far outweigh the cons.
+
+## Installation
+
+- To fully utilize these scripts, you need to manually install Ansible 1.2+ using `install.sh`
+since Ubuntu repositories only carry version 1.1. The install scripts downloads the proper
+dependencies, downloads Ansible, makes it, and installs it. The script also soft-links the
+configuration files from /etc to the ones in the repository. In general if you're using sudo,
+you don't need to do anything special to get the script to work. Ansible is fully configured
+on ansible@domain-services and the ansible test machine is on sg@10.0.1.8.
+
+## Running
+
+- Ansible uses configuration files (`ansible.cfg`), hosts definiton files (`hosts`), variable
+definitions (`default_variables.yaml`) and playbooks (any other `yaml`s) to run scripts.
+- To run a "playbook" yaml file, you need to type `ansible-playbook <playbook name>.yaml`. For
+standardization, top-level scripts are in this directory while helper modules have been included
+in the playbooks files.
+- root@obs-repository and ansible@domain-services pulic keys have been also placed in keys/ for
+reference
+- In general, the account that you are using to run the ansible script needs to have its ssh key
+in the target's ssh `authorized_hosts` file. You can do this by running `ssh-copy-id user@machine`
+- Logs are published on the server that the script is running on. This means that migrations are
+logged on ostree.endlessm.com and publishes logged on obs-repository.
+
+## Writing/extending the scripts
+
+- This is too broad of a topic so please refer to the current scripts and the following sites:
+ - https://gist.github.com/marktheunissen/2979474
+ - http://www.ansibleworks.com/docs/modules.html
+
+## Current scripts
+- NOTE: **Most playbooks have testing hosts assigned by default and will need editing before running
+scripts**
+
+- setup\_ostree\_server
+ - Installs all relevant files and applications to replicate our current ostree.endlessm.com
+
+- publish_ostree
+ - Backs up the staging/dev folder on the server
+ - Syncs obs-repository ostree with ostree.endlessm.com
+
+- migrate\_to\_*
+ - Migrates all files from more unstable version to a more stable release endpoint
+ - Process: staging/dev => staging/demo => prod
+
+## Examples
+
+- NOTE: **Most playbooks have testing hosts assigned by default and will need editing before running
+scripts**
+
+- To publish the obs-repository ostree to the server, run:
+ - `ansible-playbook publish_ostree.yaml` and don't put in a sudo password
+
+- To setup another ostree publishing server, run:
+ - `ansible-playbook setup_ostree_server.yaml` and put in a valid sudo password
diff --git a/tools/dev_env_setup/ansible.cfg b/tools/dev_env_setup/ansible.cfg
new file mode 100644
index 0000000..3289d8e
--- /dev/null
+++ b/tools/dev_env_setup/ansible.cfg
@@ -0,0 +1,140 @@
+# config file for ansible -- http://ansible.github.com
+# nearly all parameters can be overridden in ansible-playbook or with command line flags
+# ansible will read ~/.ansible.cfg or /etc/ansible/ansible.cfg, whichever it finds first
+
+[defaults]
+
+# location of inventory file, eliminates need to specify -i
+
+hostfile = /etc/ansible/hosts
+
+# location of ansible library, eliminates need to specify --module-path
+
+library = /usr/share/ansible
+
+# default module name used in /usr/bin/ansible when -m is not specified
+
+module_name = command
+
+# home directory where temp files are stored on remote systems. Should
+# almost always contain $HOME or be a directory writeable by all users
+
+remote_tmp = $HOME/.ansible/tmp
+
+# Disable deprecation warnings
+deprecation_warnings=False
+
+# the default pattern for ansible-playbooks ("hosts:")
+
+pattern = *
+
+# the default number of forks (parallelism) to be used. Usually you
+# can crank this up.
+
+forks=5
+
+# the timeout used by various connection types. Usually this corresponds
+# to an SSH timeout
+
+timeout=10
+
+# when using --poll or "poll:" in an ansible playbook, and not specifying
+# an explicit poll interval, use this interval
+
+poll_interval=15
+
+# when specifying --sudo to /usr/bin/ansible or "sudo:" in a playbook,
+# and not specifying "--sudo-user" or "sudo_user" respectively, sudo
+# to this user account
+
+sudo_user=root
+
+# the following forces ansible to always ask for the sudo password (instead of having
+# to add -K to the commandline). Or you can use the environment variable (ANSIBLE_ASK_SUDO_PASS)
+
+#ask_sudo_pass=True
+
+# the following forces ansible to always ask for the ssh-password (-k)
+# can also be set by the environment variable ANSIBLE_ASK_PASS
+
+#ask_pass=True
+
+# connection to use when -c <connection_type> is not specified
+
+transport=paramiko
+
+# remote SSH port to be used when --port or "port:" or an equivalent inventory
+# variable is not specified.
+
+remote_port=22
+
+# if set, always run /usr/bin/ansible commands as this user, and assume this value
+# if "user:" is not set in a playbook. If not set, use the current Unix user
+# as the default
+
+#remote_user=root
+
+# the default sudo executable. If a sudo alternative with a sudo-compatible interface
+# is used, specify its executable name as the default
+
+sudo_exe=sudo
+
+# the default flags passed to sudo
+# sudo_flags=-H
+
+# how to handle hash defined in several places
+# hash can be merged, or replaced
+# if you use replace, and have multiple hashes named 'x', the last defined
+# will override the previously defined one
+# if you use merge here, hash will cumulate their keys, but keys will still
+# override each other
+# replace is the default value, and is how ansible always handled hash variables
+#
+# hash_behaviour=replace
+
+# if you need to use jinja2 extensions, you can list them here
+# use a coma to separate extensions, e.g. :
+# jinja2_extensions=jinja2.ext.do,jinja2.ext.i18n
+# no extensions are loaded by default
+
+#jinja2_extensions=
+
+# if set, always use this private key file for authentication, same as if passing
+# --private-key to ansible or ansible-playbook
+
+#private_key_file=/path/to/file
+
+# format of string $ansible_managed available within Jinja2 templates, replacing
+# {file}, {host} and {uid} with template filename, host and owner respectively.
+# The resulting string is passed through strftime(3) so it may contain any
+# time-formatting specifiers.
+#
+# Example: ansible_managed = DONT TOUCH {file}: call {uid} at {host} for changes
+ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
+
+# additional plugin paths for non-core plugins
+
+action_plugins = /usr/share/ansible_plugins/action_plugins
+callback_plugins = /usr/share/ansible_plugins/callback_plugins
+connection_plugins = /usr/share/ansible_plugins/connection_plugins
+lookup_plugins = /usr/share/ansible_plugins/lookup_plugins
+vars_plugins = /usr/share/ansible_plugins/vars_plugins
+filter_plugins = /usr/share/ansible_plugins/filter_plugins
+
+[paramiko_connection]
+
+# nothing to configure yet
+
+[ssh_connection]
+
+# if uncommented, sets the ansible ssh arguments to the following. Leaving off ControlPersist
+# will result in poor performance, so use transport=paramiko on older platforms rather than
+# removing it
+
+ssh_args=-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r
+
+# the following makes ansible use scp if the connection type is ssh (default is sftp)
+
+scp_if_ssh=True
+
+
diff --git a/tools/dev_env_setup/default_variables.yaml b/tools/dev_env_setup/default_variables.yaml
new file mode 100644
index 0000000..ed97d53
--- /dev/null
+++ b/tools/dev_env_setup/default_variables.yaml
@@ -0,0 +1 @@
+---
diff --git a/tools/dev_env_setup/install.sh b/tools/dev_env_setup/install.sh
new file mode 100755
index 0000000..1f3ac90
--- /dev/null
+++ b/tools/dev_env_setup/install.sh
@@ -0,0 +1,72 @@
+#!/bin/bash -e
+
+ANSIBLE_DIR="/etc/ansible"
+DEPENDENCIES="make python-pip python-dev git sshpass"
+
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as sudo or root. Exiting."
+ exit 1
+fi
+
+read -p "Are you sure you want to install the server config? " -n 1 -r
+echo # Move to a new line
+if [[ ! $REPLY =~ ^[Yy]$ ]]
+then
+ echo "Install canceled. Exiting."
+ exit 1
+fi
+
+echo "Checking dependencies"
+set +e
+ dpkg -s $DEPENDENCIES &> /dev/null
+ has_dependencies=$?
+set -e
+
+if [[ $has_dependencies -ne 0 || ! $(which ansible) ]]; then
+ echo "Installing $DEPENDENCIES"
+ apt-get update
+ apt-get install -y --force-yes $DEPENDENCIES
+ echo "Dependencies installed"
+
+ echo "Installing ansible"
+ pip install PyYAML jinja2 paramiko
+ rm -rf ${HOME}/apps/ansible
+ sudo -u $SUDO_USER -- mkdir -p ${HOME}/apps
+ pushd ${HOME}/apps
+ sudo -u $SUDO_USER -- git clone https://github.com/ansible/ansible.git
+ cd ansible
+ make install
+ popd
+ mkdir -p /etc/ansible
+fi
+
+if [[ ! $(which ansible-playbook) ]]; then
+ echo "Installing playbook script softlink"
+ ln -fs ${HOME}/apps/ansible/build/scripts-2.7/ansible-playbook /usr/bin/
+fi
+
+echo "Checking if this user has a ssh key"
+ssh_key="$HOME/.ssh/id_rsa"
+ssh_public_key="$ssh_key.pub"
+ssh_keygen_cmd="ssh-keygen -b 4096 -f $ssh_key"
+
+if [[ ! -f $ssh_public_key ]]; then
+ echo "No ssh key found. Regenerating"
+ echo "Using $ssh_keygen_cmd to create key"
+ sudo -u $SUDO_USER -- $ssh_keygen_cmd
+fi
+
+echo "Removing old files and links"
+rm -rf $ANSIBLE_DIR/hosts
+
+echo "Soft-linking relevant files"
+cwd=$(dirname $0)
+abs_cwd=$(readlink -f $cwd)
+
+echo "Current directory: $abs_cwd"
+ln -s $abs_cwd/hosts $ANSIBLE_DIR/hosts
+
+echo "Checking connectivity. If any failures appear below, it means that \
+ you need to push your ssh keys to those hosts with ssh-copy-id <user>@<machine>"
+
+sudo -u $SUDO_USER ansible all -m ping
diff --git a/tools/dev_env_setup/keys/id_rsa b/tools/dev_env_setup/keys/id_rsa
new file mode 100644
index 0000000..75a3eaf
--- /dev/null
+++ b/tools/dev_env_setup/keys/id_rsa
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKgIBAAKCAgEA3oftPUU6Mmr5AqDVjjAwGFv/jVt5y7Oo9vyE+CGtZ123U6/Y
+AGSXmuNZXrPcQYUau787pl4mEfQUKe3j+Gq1YYtlV9k/VTNA4bP+OBWSADl8rlkO
+dKxwyJOJiTdfDpisXFB6SXfrNOIvzi4PUGhwxxR+5jlP6no9t6Puu0OvH3DVPyeM
+8TnOXwZvxawSk8NxrLv7dH5ZKPqA6sHgpad0a3wvEDb8uLcJQwh8mNf+//lFBLXK
+tPNjM3/VrowdJb3W9qX/U+2AikR/BSuyk+ZJqeBU0zXHvWMHyqjgfBEoqvrF/jN9
+7aLTcR4yXter/EwaS6fGFGY498AbjkpqhUzbRXPrFw/LPvG+THtGQ9pD0n3lnD4Y
+r4XOASdkasmF+PAoxRnYKSXG01QoFiFMhUVrgXLejbWNBBVaECvylr1yeaqChpXf
+IdAqMrMGLPEyjtbIhxEVkDzXY8jgxtr7vaPqmnJmYxxDEcEOggZuqLKkfeqfjnBt
+Mn/phbQkTmY5zpRLM1x6QvT5jvumbinR5fDZK8v3k40tAM9ihyBT0S5N3CWV8wDR
+1xltG7VuB7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na1zvVeUs3awhvcZV4p7WdTsZVEvnLgwpQ1V8P0AkiZ5on1/mKKirOo
+zc4Xms1fWw+uia+PMIjCdhZaSNBmKpGg4QKCAQEAr1oHMfmYhV7/fk7XM2bRdAkI
+FdzLL1JDpALecH9bHoqQuB4HM6+gD9JpuPGCw9KEGVhrOGK/Br7jBwAIxU2mYrEt
+SBnGZuzqDXXWoFmJxRJoXb9ljeDLITUJdWHyVrvgJZBeYHNZypVjyYNrVq17fPgy
+2OSKOlqbs7TSARoCGWTdi4cv6b5KK/stMHK0U769j1DaoO1jsa3WdtYsdDsyPqOZ
+40sChCh6vYiLIQUwe9QxeLD841LOQz2N2eftbKOpDPcgVTBr4E696qP+Ysb41/7P
+QGBRr/Tu6/7I8/Hxp1TBLSrxMtSFmHfU9YSXXFxeCCsB9KGokOI2DrQyDs7TIQ==
+-----END RSA PRIVATE KEY-----
diff --git a/tools/dev_env_setup/keys/id_rsa.pub b/tools/dev_env_setup/keys/id_rsa.pub
new file mode 100644
index 0000000..7c0aba6
--- /dev/null
+++ b/tools/dev_env_setup/keys/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDeh+09RToyavkCoNWOMDAYW/+NW3nLs6j2/IT4Ia1nXbdTr9gAZJea41les9xBhRq7vzumXiYR9BQp7eP4arVhi2VX2T9VM0Dhs/44FZIAOXyuWQ50rHDIk4mJN18OmKxcUHpJd+s04i/OLg9QaHDHFH7mOU/qej23o+67Q68fcNU/J4zxOc5fBm/FrBKTw3Gsu/t0flko+oDqweClp3RrfC8QNvy4twlDCHyY1/7/+UUEtcq082Mzf9WujB0lvdb2pf9T7YCKRH8FK7KT5kmp4FTTNce9YwfKqOB8ESiq+sX+M33totNxHjJe16v8TBpLp8YUZjj3wBuOSmqFTNtFc+sXD8s+8b5Me0ZD2kPSfeWcPhivhc4BJ2RqyYX48CjFGdgpJcbTVCgWIUyFRWuBct6NtY0EFVoQK/KWvXJ5qoKGld8h0CoyswYs8TKO1siHERWQPNdjyODG2vu9o+qacmZjHEMRwQ6CBm6osqR96p+OcG0yf+mFtCROZjnOlEszXHpC9PmO+6ZuKdHl8Nkry/eTjS0Az2KHIFPRLk3cJZXzANHXGW0btW4Hsl7tnVVs0TEaEZfPzeUnqCplwh6AfX1O8CRl6FzbwcGhj/UxZIBGpk6E7HC1wXSrgmbvrkIJzd7m/CjWt7mnaOqkm5wrN7l23qSFAUt53kfhXg/jRQ== eos-dev-config@vm
diff --git a/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml b/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml
new file mode 100644
index 0000000..c802950
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml
@@ -0,0 +1,16 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+-
+ hosts: dev_machine
+
+ sudo: True
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - name: "Creating /opt/gnome directory"
+ file: path=/opt/gnome state=directory mode=777
+
+ - name: "Updating apt-file cache"
+ shell: apt-file update
diff --git a/tools/dev_env_setup/playbooks/jhbuild_run.yaml b/tools/dev_env_setup/playbooks/jhbuild_run.yaml
new file mode 100644
index 0000000..ff9d290
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/jhbuild_run.yaml
@@ -0,0 +1,19 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+-
+ hosts: dev_machine
+
+ sudo: False
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - name: "Installing jhbuild dependencies - this may take a very long time"
+ shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install
+
+ - name: "Installing auth key"
+ template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth
+
+ - name: "Cloning relevant modules - this will take a very long time - use htop and watch for git processes"
+ shell: executable=/bin/bash ~/.local/bin/jhbuild update endless-apps
diff --git a/tools/dev_env_setup/playbooks/kill_shell.yaml b/tools/dev_env_setup/playbooks/kill_shell.yaml
new file mode 100644
index 0000000..408caa6
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/kill_shell.yaml
@@ -0,0 +1,18 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+
+###
+# Notice the minus on the line below -- this starts the playbook's record
+# in the YAML document. Only one playbook is allowed per YAML file. Indent
+# the body of the playbook.
+-
+ hosts: dev_machine
+
+ sudo: True
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - name: "Setting default personality"
+ service: name=gdm state=restarted
diff --git a/tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml b/tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml
new file mode 100644
index 0000000..32434da
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml
@@ -0,0 +1,14 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+
+- name: "Creating ssh directory"
+ file: path=~/.ssh state=directory mode=700
+
+- name: "Copying default ssh keys"
+ copy: src=../keys/$item dest=~/.ssh/
+ with_items:
+ - id_rsa
+ - id_rsa.pub
+
+- name: "Adding default known_hosts file"
+ copy: src=../templates/known_hosts dest=~/.ssh/
diff --git a/tools/dev_env_setup/playbooks/setup_dev_folder.yaml b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml
new file mode 100644
index 0000000..950a588
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml
@@ -0,0 +1,16 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+-
+ hosts: dev_machine
+
+ sudo: False
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - name: "Copying python file for desktop generation"
+ copy: src=../templates/add_dev_tools_folder.py dest=~/ mode=755
+
+ - name: "Creating development tools folder"
+ shell: executable=/bin/bash export DISPLAY=:0; ~/add_dev_tools_folder.py &> ~/add_dev_tools_folder.log
diff --git a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml
new file mode 100644
index 0000000..731fdf9
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml
@@ -0,0 +1,20 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+
+###
+# Notice the minus on the line below -- this starts the playbook's record
+# in the YAML document. Only one playbook is allowed per YAML file. Indent
+# the body of the playbook.
+-
+ hosts: dev_machine
+
+ sudo: True
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - include: setup_other_tools.yaml
+
+ - name: "Setting default personality"
+ shell: executable=/bin/bash eos-select-personality default
diff --git a/tools/dev_env_setup/playbooks/setup_jhbuild.yaml b/tools/dev_env_setup/playbooks/setup_jhbuild.yaml
new file mode 100644
index 0000000..45a9df7
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/setup_jhbuild.yaml
@@ -0,0 +1,34 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+-
+ hosts: dev_machine
+
+ sudo: False
+
+ vars_files:
+ - "../default_variables.yaml"
+
+ tasks:
+ - name: "Ensuring that git is installed"
+ apt: name=git update_cache=true cache_valid_time=259200
+
+ - name: "Creating checkout directory"
+ file: path=~/checkout state=directory mode=755
+
+ - name: "Cloning jhbuild"
+ git: repo=git://git.gnome.org/jhbuild
+ dest=~/checkout/jhbuild
+
+ - name: "Installing jhbuild - autogen"
+ shell: cd ~/checkout/jhbuild && ./autogen.sh
+
+ - name: "Installing jhbuild - make"
+ shell: cd ~/checkout/jhbuild && make
+
+ - name: "Installing jhbuild - make install"
+ shell: cd ~/checkout/jhbuild && make install
+
+ - name: "Creating glib schemas dir"
+ file: path=~/install/share/glib-2.0/schemas state=directory mode=755
+
+ - include: setup_default_ssh_key.yaml
diff --git a/tools/dev_env_setup/playbooks/setup_other_tools.yaml b/tools/dev_env_setup/playbooks/setup_other_tools.yaml
new file mode 100644
index 0000000..b9f05c1
--- /dev/null
+++ b/tools/dev_env_setup/playbooks/setup_other_tools.yaml
@@ -0,0 +1,24 @@
+---
+# vim:ff=unix ts=2 sw=2 ai expandtab
+
+- name: "Ensuring that git is installed"
+ apt: name=git update_cache=true cache_valid_time=259200
+
+- name: "Creating turbine directory"
+ file: path=~/checkout state=directory mode=755
+
+- name: "Cloning turbine"
+ git: repo=git://git.gnome.org/turbine
+ dest=~/checkout/turbine
+
+- name: "Installing turbine"
+ shell: cd ~/checkout/turbine && python setup.py install
+
+- name: "Installing transifex client"
+ shell: pip install transifex-client
+
+- name: "Creating EOS links for various apps"
+ shell: cp /usr/share/applications/$item.desktop /usr/share/applications/eos-app-$item.desktop
+ with_items:
+ - gnome-terminal
+ - devhelp
diff --git a/tools/dev_env_setup/setup_dev_machine.sh b/tools/dev_env_setup/setup_dev_machine.sh
new file mode 100755
index 0000000..3e22394
--- /dev/null
+++ b/tools/dev_env_setup/setup_dev_machine.sh
@@ -0,0 +1,57 @@
+#!/bin/bash -e
+
+DEFAULT_USER="endless"
+DEFAULT_PASSWORD="endless"
+DEFAULT_IP="192.168.56.101"
+
+echo "To run this script, you need to have the following"
+echo " - VM running with the correct dev HD image"
+echo " - A user defined with sudo privileges"
+echo " - sshpass installed on the local machine"
+echo
+read -p "Press [Enter] to continue..."
+
+if [[ ! $(which sshpass) ]]; then
+ echo "sshpass not found. Exiting"
+ echo "You can install it with sudo apt-get install sshpass"
+ exit 1
+fi
+
+read -e -p "Enter your machine's IP: " -i "$DEFAULT_IP" TARGET_IP
+read -e -p "Enter your machine's user: " -i "$DEFAULT_USER" TARGET_USER
+read -e -p "Enter your machine's password: " -i "${DEFAULT_PASSWORD}" TARGET_PASS
+
+API_KEY=""
+while [[ -z $API_KEY ]]; do
+ read -e -p "Enter your Github Personal Access Token (github.com/settings/applications): " -i "$API_KEY" API_KEY
+done
+
+echo
+
+echo -n "Checking connectivity to VM/machine..."
+sshpass -p "${TARGET_PASS}" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $TARGET_USER@$TARGET_IP 'uname -a' &> /dev/null
+echo "[OK]"
+
+echo -n "Checking API key..."
+ git ls-remote -h https://$API_KEY@github.com/endlessm/eos-sdk &> /dev/null
+echo "[OK]"
+echo
+
+
+tmp_inventory=$(mktemp)
+trap "rm -f $tmp_inventory" EXIT
+
+echo "Creating Ansible inventory file in $tmp_inventory"
+cat << EOF > $tmp_inventory
+[dev_machine]
+dev_machine ansible_ssh_host=$TARGET_IP ansible_ssh_user="$TARGET_USER" ansible_sudo_pass="${TARGET_PASS}" ansible_ssh_pass="${TARGET_PASS}" ansible_connection=ssh
+EOF
+
+ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.yaml
+ansible-playbook -i $tmp_inventory playbooks/setup_dev_folder.yaml
+ansible-playbook -i $tmp_inventory playbooks/kill_shell.yaml
+ansible-playbook -i $tmp_inventory playbooks/setup_jhbuild.yaml
+ansible-playbook -i $tmp_inventory playbooks/install_jhbuild_deps.yaml
+ansible-playbook -i $tmp_inventory playbooks/jhbuild_run.yaml --extra-vars "api_key=$API_KEY"
+
+echo "Repos are cloned. You should be able to run 'jhbuild build' on the target"
diff --git a/tools/dev_env_setup/templates/.jhbuildrc-auth.j2 b/tools/dev_env_setup/templates/.jhbuildrc-auth.j2
new file mode 100644
index 0000000..67d2e1e
--- /dev/null
+++ b/tools/dev_env_setup/templates/.jhbuildrc-auth.j2
@@ -0,0 +1,4 @@
+# -*- mode: python -*-
+# -*- coding: utf-8 -*-
+
+repos['endlessm'] = 'https://{{ api_key }}@github.com/endlessm/'
diff --git a/tools/dev_env_setup/templates/add_dev_tools_folder.py b/tools/dev_env_setup/templates/add_dev_tools_folder.py
new file mode 100644
index 0000000..d90d797
--- /dev/null
+++ b/tools/dev_env_setup/templates/add_dev_tools_folder.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+import json
+import os
+import time
+from gi.repository import Gio, Gtk, GLib
+
+DIRECTORY_ID = 'eos-folder-user-99.directory'
+DIRECTORY_FILE_CONTENT="""[Desktop Entry]
+Name=Development
+Icon=eos-folder-tools-symbolic
+Type=Directory
+"""
+
+DEFAULT_LAYOUT_FILE='/usr/share/EndlessOS/personality-defaults/icon-grid-default.json'
+DESTINATIION_FOLDER= os.path.expanduser('~/.local/share/desktop-directories/') + DIRECTORY_ID
+
+def get_default_layout():
+ with open(DEFAULT_LAYOUT_FILE, 'r') as f:
+ return f.read()
+
+
+def write_folder_data():
+ with open(DESTINATIION_FOLDER, 'w') as f:
+ return f.write(DIRECTORY_FILE_CONTENT)
+
+def get_settings_string(layout):
+ settings = Gio.Settings.new("org.gnome.shell")
+
+
+ loaded_layout = json.loads(layout)
+ loaded_layout['desktop'].append(DIRECTORY_ID)
+ loaded_layout[DIRECTORY_ID] = [ 'eos-app-gnome-terminal.desktop' ,
+ 'eos-app-devhelp.desktop' ]
+
+ root=GLib.Variant('a{sas}', loaded_layout)
+ print "Setting the value"
+ settings.set_value("icon-grid-layout", root)
+ print "Syncing"
+ settings.apply()
+ settings.sync()
+ print root
+
+ time.sleep(20)
+
+if __name__ == "__main__":
+ layout = get_default_layout()
+ write_folder_data()
+ get_settings_string(layout)
diff --git a/tools/dev_env_setup/templates/known_hosts b/tools/dev_env_setup/templates/known_hosts
new file mode 100644
index 0000000..fdfd483
--- /dev/null
+++ b/tools/dev_env_setup/templates/known_hosts
@@ -0,0 +1,2 @@
+|1|KBJ34M/sigDkwEHXqWNtuZuTyIo=|dI52F1tauVq3UdnBDEWY9H76ZnI= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
+|1|ukqmPkGRPykqhLSygEMYacziZSA=|bghXjR7+Rr4YC3r15EbUJozp8No= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==