From 5214ed7a373ef9bea7c2028cbe60e264449da812 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 14 Jan 2014 15:11:36 -0600 Subject: Initial addition of ansible scripts --- ansible/.gitignore | 3 + ansible/README.md | 64 ++++++++++++++ ansible/ansible.cfg | 140 +++++++++++++++++++++++++++++++ ansible/default_variables.yaml | 1 + ansible/hosts | 45 ++++++++++ ansible/install.sh | 72 ++++++++++++++++ ansible/playbooks/setup_dev_machine.yaml | 17 ++++ ansible/playbooks/setup_jhbuild.yaml | 19 +++++ ansible/setup_dev_machine.sh | 40 +++++++++ 9 files changed, 401 insertions(+) create mode 100644 ansible/.gitignore create mode 100644 ansible/README.md create mode 100644 ansible/ansible.cfg create mode 100644 ansible/default_variables.yaml create mode 100644 ansible/hosts create mode 100755 ansible/install.sh create mode 100644 ansible/playbooks/setup_dev_machine.yaml create mode 100644 ansible/playbooks/setup_jhbuild.yaml create mode 100755 ansible/setup_dev_machine.sh diff --git a/ansible/.gitignore b/ansible/.gitignore new file mode 100644 index 0000000..3e8500f --- /dev/null +++ b/ansible/.gitignore @@ -0,0 +1,3 @@ +*.swp +*~ +*.log diff --git a/ansible/README.md b/ansible/README.md new file mode 100644 index 0000000..bc2c0e2 --- /dev/null +++ b/ansible/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 .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/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..3289d8e --- /dev/null +++ b/ansible/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 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/ansible/default_variables.yaml b/ansible/default_variables.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/ansible/default_variables.yaml @@ -0,0 +1 @@ +--- diff --git a/ansible/hosts b/ansible/hosts new file mode 100644 index 0000000..b9b315a --- /dev/null +++ b/ansible/hosts @@ -0,0 +1,45 @@ +# This is the default ansible 'hosts' file. +# It should live in /etc/ansible/hosts +# - Comments begin with the '#' character +# - Blank lines are ignored +# - Groups of hosts are delimited by [header] elements +# - You can enter hostnames or ip addresses +# - A hostname/ip can be a member of multiple groups + +# Ex 1: Ungrouped hosts, specify before any group headers. + +#green.example.com +#blue.example.com +#192.168.100.1 +#192.168.100.10 + +# Ex 2: A collection of hosts belonging to the 'webservers' group + +#[webservers] +#alpha.example.org +#beta.example.org +#192.168.1.100 +#192.168.1.110 + +# If you have multiple hosts following a pattern you can specify +# them like this: + +#www[001:006].example.com + +# Ex 3: A collection of database servers in the 'dbservers' group + +#[dbservers] +# +#db01.intranet.mydomain.net +#db02.intranet.mydomain.net +#10.25.1.56 +#10.25.1.57 + +# Here's another example of host ranges, this time there are no +# leading 0s: + +#db-[99:101]-node.example.com +127.0.0.1 ansible_ssh_user=ansible + +[dev_machine] +root@ostree.endlessm.com ansible_ssh_host=72.14.189.30 ansible_ssh_user=root ansible_connection=ssh diff --git a/ansible/install.sh b/ansible/install.sh new file mode 100755 index 0000000..1f3ac90 --- /dev/null +++ b/ansible/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 @" + +sudo -u $SUDO_USER ansible all -m ping diff --git a/ansible/playbooks/setup_dev_machine.yaml b/ansible/playbooks/setup_dev_machine.yaml new file mode 100644 index 0000000..3ffe699 --- /dev/null +++ b/ansible/playbooks/setup_dev_machine.yaml @@ -0,0 +1,17 @@ +--- +# 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: False + + vars_files: + - "../default_variables.yaml" + + tasks: + - include: setup_jhbuild.yaml diff --git a/ansible/playbooks/setup_jhbuild.yaml b/ansible/playbooks/setup_jhbuild.yaml new file mode 100644 index 0000000..3df6a63 --- /dev/null +++ b/ansible/playbooks/setup_jhbuild.yaml @@ -0,0 +1,19 @@ +--- +# vim:ff=unix ts=2 sw=2 ai expandtab + +- name: "Ensuring that git is installed" + apt: name=git +- 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 jhbuildi - autogen" + shell: cd ~/checkout/jhbuild && ./autogen.sh + +- name: "Installing jhbuildi - make" + shell: cd ~/checkout/jhbuild && make + +- name: "Installing jhbuildi - make install" + shell: cd ~/checkout/jhbuild && make install diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh new file mode 100755 index 0000000..9387570 --- /dev/null +++ b/ansible/setup_dev_machine.sh @@ -0,0 +1,40 @@ +#!/bin/bash -e + +#DEFAULT_USER="endless" +DEFAULT_USER="sg" +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 +echo + +echo -n "Checking connectivity to machine..." +sshpass -p "${TARGET_PASS}" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $TARGET_USER@$TARGET_IP 'uname -a' &> /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_ssh_pass="${TARGET_PASS}" ansible_connection=ssh +EOF + +ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine.yaml -- cgit v1.2.3 From ee539057a3e7387b95736dc85bd4d9af5c8e552c Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 14 Jan 2014 15:42:34 -0600 Subject: Added code that can run sudo tasks and install turbine/transifex client --- ansible/playbooks/setup_dev_machine.yaml | 17 ----------------- ansible/playbooks/setup_dev_machine_root.yaml | 17 +++++++++++++++++ ansible/playbooks/setup_dev_machine_user.yaml | 17 +++++++++++++++++ ansible/playbooks/setup_jhbuild.yaml | 11 ++++++++--- ansible/playbooks/setup_other_tools.yaml | 18 ++++++++++++++++++ ansible/setup_dev_machine.sh | 5 +++-- 6 files changed, 63 insertions(+), 22 deletions(-) delete mode 100644 ansible/playbooks/setup_dev_machine.yaml create mode 100644 ansible/playbooks/setup_dev_machine_root.yaml create mode 100644 ansible/playbooks/setup_dev_machine_user.yaml create mode 100644 ansible/playbooks/setup_other_tools.yaml diff --git a/ansible/playbooks/setup_dev_machine.yaml b/ansible/playbooks/setup_dev_machine.yaml deleted file mode 100644 index 3ffe699..0000000 --- a/ansible/playbooks/setup_dev_machine.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# 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: False - - vars_files: - - "../default_variables.yaml" - - tasks: - - include: setup_jhbuild.yaml diff --git a/ansible/playbooks/setup_dev_machine_root.yaml b/ansible/playbooks/setup_dev_machine_root.yaml new file mode 100644 index 0000000..8a6f5df --- /dev/null +++ b/ansible/playbooks/setup_dev_machine_root.yaml @@ -0,0 +1,17 @@ +--- +# 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 diff --git a/ansible/playbooks/setup_dev_machine_user.yaml b/ansible/playbooks/setup_dev_machine_user.yaml new file mode 100644 index 0000000..3ffe699 --- /dev/null +++ b/ansible/playbooks/setup_dev_machine_user.yaml @@ -0,0 +1,17 @@ +--- +# 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: False + + vars_files: + - "../default_variables.yaml" + + tasks: + - include: setup_jhbuild.yaml diff --git a/ansible/playbooks/setup_jhbuild.yaml b/ansible/playbooks/setup_jhbuild.yaml index 3df6a63..fdbb0c0 100644 --- a/ansible/playbooks/setup_jhbuild.yaml +++ b/ansible/playbooks/setup_jhbuild.yaml @@ -3,17 +3,22 @@ - name: "Ensuring that git is installed" apt: name=git + - 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 jhbuildi - autogen" +- name: "Installing jhbuild - autogen" shell: cd ~/checkout/jhbuild && ./autogen.sh -- name: "Installing jhbuildi - make" +- name: "Installing jhbuild - make" shell: cd ~/checkout/jhbuild && make -- name: "Installing jhbuildi - make install" +- 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 diff --git a/ansible/playbooks/setup_other_tools.yaml b/ansible/playbooks/setup_other_tools.yaml new file mode 100644 index 0000000..ef7eec6 --- /dev/null +++ b/ansible/playbooks/setup_other_tools.yaml @@ -0,0 +1,18 @@ +--- +# vim:ff=unix ts=2 sw=2 ai expandtab + +- name: "Ensuring that git is installed" + apt: name=git + +- 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 diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index 9387570..dc20084 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -34,7 +34,8 @@ 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_ssh_pass="${TARGET_PASS}" ansible_connection=ssh +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.yaml +ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.yaml +ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_user.yaml -- cgit v1.2.3 From a67201daae41769a78a392208730c992f522f3f9 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 14 Jan 2014 17:13:25 -0600 Subject: Added more code to get jhbuild installed properly and set the apt cache a bit higher. Still needs work --- ansible/playbooks/install_jhbuild_deps.yaml | 19 ++++++++++++++ ansible/playbooks/setup_dev_machine_user.yaml | 17 ------------ ansible/playbooks/setup_jhbuild.yaml | 38 ++++++++++++++++----------- ansible/playbooks/setup_other_tools.yaml | 2 +- ansible/setup_dev_machine.sh | 3 ++- 5 files changed, 45 insertions(+), 34 deletions(-) create mode 100644 ansible/playbooks/install_jhbuild_deps.yaml delete mode 100644 ansible/playbooks/setup_dev_machine_user.yaml diff --git a/ansible/playbooks/install_jhbuild_deps.yaml b/ansible/playbooks/install_jhbuild_deps.yaml new file mode 100644 index 0000000..2c5dbe5 --- /dev/null +++ b/ansible/playbooks/install_jhbuild_deps.yaml @@ -0,0 +1,19 @@ +--- +# 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 + + - name: "Installing dependencies" + shell: jhbuild sysdeps --install diff --git a/ansible/playbooks/setup_dev_machine_user.yaml b/ansible/playbooks/setup_dev_machine_user.yaml deleted file mode 100644 index 3ffe699..0000000 --- a/ansible/playbooks/setup_dev_machine_user.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# 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: False - - vars_files: - - "../default_variables.yaml" - - tasks: - - include: setup_jhbuild.yaml diff --git a/ansible/playbooks/setup_jhbuild.yaml b/ansible/playbooks/setup_jhbuild.yaml index fdbb0c0..dfdee4b 100644 --- a/ansible/playbooks/setup_jhbuild.yaml +++ b/ansible/playbooks/setup_jhbuild.yaml @@ -1,24 +1,32 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab +- + hosts: dev_machine -- name: "Ensuring that git is installed" - apt: name=git + sudo: False -- name: "Creating checkout directory" - file: path=~/checkout state=directory mode=755 + vars_files: + - "../default_variables.yaml" -- name: "Cloning jhbuild" - git: repo=git://git.gnome.org/jhbuild - dest=~/checkout/jhbuild + tasks: + - name: "Ensuring that git is installed" + apt: name=git update_cache=true cache_valid_time=259200 -- name: "Installing jhbuild - autogen" - shell: cd ~/checkout/jhbuild && ./autogen.sh + - name: "Creating checkout directory" + file: path=~/checkout state=directory mode=755 -- name: "Installing jhbuild - make" - shell: cd ~/checkout/jhbuild && make + - name: "Cloning jhbuild" + git: repo=git://git.gnome.org/jhbuild + dest=~/checkout/jhbuild -- name: "Installing jhbuild - make install" - shell: cd ~/checkout/jhbuild && make install + - name: "Installing jhbuild - autogen" + shell: cd ~/checkout/jhbuild && ./autogen.sh -- name: "Creating glib schemas dir" - file: path=~/install/share/glib-2.0/schemas state=directory mode=755 + - 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 diff --git a/ansible/playbooks/setup_other_tools.yaml b/ansible/playbooks/setup_other_tools.yaml index ef7eec6..126a68b 100644 --- a/ansible/playbooks/setup_other_tools.yaml +++ b/ansible/playbooks/setup_other_tools.yaml @@ -2,7 +2,7 @@ # vim:ff=unix ts=2 sw=2 ai expandtab - name: "Ensuring that git is installed" - apt: name=git + apt: name=git update_cache=true cache_valid_time=259200 - name: "Creating turbine directory" file: path=~/checkout state=directory mode=755 diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index dc20084..292bf00 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -38,4 +38,5 @@ dev_machine ansible_ssh_host=$TARGET_IP ansible_ssh_user="$TARGET_USER" ansible_ EOF ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.yaml -ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_user.yaml +ansible-playbook -i $tmp_inventory playbooks/setup_jhbuild.yaml +ansible-playbook -i $tmp_inventory playbooks/install_jhbuild_deps.yaml -- cgit v1.2.3 From d153bb68ce0f2297b950ed50003837aca7490920 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Wed, 15 Jan 2014 16:20:39 -0600 Subject: Made some advancements in getting jhbuild to install dependencies --- ansible/playbooks/install_jhbuild_deps.yaml | 3 --- ansible/playbooks/jhbuild_run.yaml | 16 ++++++++++++++++ ansible/setup_dev_machine.sh | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 ansible/playbooks/jhbuild_run.yaml diff --git a/ansible/playbooks/install_jhbuild_deps.yaml b/ansible/playbooks/install_jhbuild_deps.yaml index 2c5dbe5..c802950 100644 --- a/ansible/playbooks/install_jhbuild_deps.yaml +++ b/ansible/playbooks/install_jhbuild_deps.yaml @@ -14,6 +14,3 @@ - name: "Updating apt-file cache" shell: apt-file update - - - name: "Installing dependencies" - shell: jhbuild sysdeps --install diff --git a/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml new file mode 100644 index 0000000..eb1d72a --- /dev/null +++ b/ansible/playbooks/jhbuild_run.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: "Installing jhbuild dependencies" + shell: executable=/bin/bash ~/.local/bin/jhbuild sysdeps --install + + - name: "Building jhbuild modules" + shell: executable=/bin/bash ~/.local/bin/jhbuild build diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index 292bf00..747ecee 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -40,3 +40,4 @@ EOF ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.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 -- cgit v1.2.3 From 2b9e71d63ac0e60b2e6302c3305a542c9df6657d Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Wed, 15 Jan 2014 16:58:43 -0600 Subject: Fixed issue with jhbuild needing a 'y' input to install dependencies --- ansible/playbooks/jhbuild_run.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml index eb1d72a..0242799 100644 --- a/ansible/playbooks/jhbuild_run.yaml +++ b/ansible/playbooks/jhbuild_run.yaml @@ -10,7 +10,7 @@ tasks: - name: "Installing jhbuild dependencies" - shell: executable=/bin/bash ~/.local/bin/jhbuild sysdeps --install + shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install - name: "Building jhbuild modules" shell: executable=/bin/bash ~/.local/bin/jhbuild build -- cgit v1.2.3 From 0926426a3d09d540da1ed814942230f76014c500 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Wed, 15 Jan 2014 17:16:42 -0600 Subject: Added a more descriptive message to installation of dependencies task --- ansible/playbooks/jhbuild_run.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml index 0242799..ea3b4d9 100644 --- a/ansible/playbooks/jhbuild_run.yaml +++ b/ansible/playbooks/jhbuild_run.yaml @@ -9,7 +9,7 @@ - "../default_variables.yaml" tasks: - - name: "Installing jhbuild dependencies" + - name: "Installing jhbuild dependencies - this will take a very long time" shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install - name: "Building jhbuild modules" -- cgit v1.2.3 From 34dcbe4f0a9cb7a27e155d0eae5b2a467332e9c9 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Wed, 15 Jan 2014 18:01:29 -0600 Subject: Removed out hosts file since we dynamically generate one --- ansible/.gitignore | 1 + ansible/hosts | 45 --------------------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 ansible/hosts diff --git a/ansible/.gitignore b/ansible/.gitignore index 3e8500f..cc324a5 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -1,3 +1,4 @@ *.swp +hosts *~ *.log diff --git a/ansible/hosts b/ansible/hosts deleted file mode 100644 index b9b315a..0000000 --- a/ansible/hosts +++ /dev/null @@ -1,45 +0,0 @@ -# This is the default ansible 'hosts' file. -# It should live in /etc/ansible/hosts -# - Comments begin with the '#' character -# - Blank lines are ignored -# - Groups of hosts are delimited by [header] elements -# - You can enter hostnames or ip addresses -# - A hostname/ip can be a member of multiple groups - -# Ex 1: Ungrouped hosts, specify before any group headers. - -#green.example.com -#blue.example.com -#192.168.100.1 -#192.168.100.10 - -# Ex 2: A collection of hosts belonging to the 'webservers' group - -#[webservers] -#alpha.example.org -#beta.example.org -#192.168.1.100 -#192.168.1.110 - -# If you have multiple hosts following a pattern you can specify -# them like this: - -#www[001:006].example.com - -# Ex 3: A collection of database servers in the 'dbservers' group - -#[dbservers] -# -#db01.intranet.mydomain.net -#db02.intranet.mydomain.net -#10.25.1.56 -#10.25.1.57 - -# Here's another example of host ranges, this time there are no -# leading 0s: - -#db-[99:101]-node.example.com -127.0.0.1 ansible_ssh_user=ansible - -[dev_machine] -root@ostree.endlessm.com ansible_ssh_host=72.14.189.30 ansible_ssh_user=root ansible_connection=ssh -- cgit v1.2.3 From 7dcd64668f108c714f5fa74529890b5c5dcbd69d Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 10:39:19 -0600 Subject: Added authentication for jhbuild --- ansible/keys/id_rsa | 51 ++++++++++++++++++++++++++++ ansible/keys/id_rsa.pub | 1 + ansible/playbooks/setup_default_ssh_key.yaml | 14 ++++++++ ansible/playbooks/setup_jhbuild.yaml | 2 ++ ansible/templates/.jhbuildrc-auth.j2 | 4 +++ ansible/templates/known_hosts | 2 ++ 6 files changed, 74 insertions(+) create mode 100644 ansible/keys/id_rsa create mode 100644 ansible/keys/id_rsa.pub create mode 100644 ansible/playbooks/setup_default_ssh_key.yaml create mode 100644 ansible/templates/.jhbuildrc-auth.j2 create mode 100644 ansible/templates/known_hosts diff --git a/ansible/keys/id_rsa b/ansible/keys/id_rsa new file mode 100644 index 0000000..75a3eaf --- /dev/null +++ b/ansible/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 +1xltG7V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VEvnLgwpQ1V8P0AkiZ5on1/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/ansible/keys/id_rsa.pub b/ansible/keys/id_rsa.pub new file mode 100644 index 0000000..7c0aba6 --- /dev/null +++ b/ansible/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/ansible/playbooks/setup_default_ssh_key.yaml b/ansible/playbooks/setup_default_ssh_key.yaml new file mode 100644 index 0000000..32434da --- /dev/null +++ b/ansible/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/ansible/playbooks/setup_jhbuild.yaml b/ansible/playbooks/setup_jhbuild.yaml index dfdee4b..45a9df7 100644 --- a/ansible/playbooks/setup_jhbuild.yaml +++ b/ansible/playbooks/setup_jhbuild.yaml @@ -30,3 +30,5 @@ - 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/ansible/templates/.jhbuildrc-auth.j2 b/ansible/templates/.jhbuildrc-auth.j2 new file mode 100644 index 0000000..67d2e1e --- /dev/null +++ b/ansible/templates/.jhbuildrc-auth.j2 @@ -0,0 +1,4 @@ +# -*- mode: python -*- +# -*- coding: utf-8 -*- + +repos['endlessm'] = 'https://{{ api_key }}@github.com/endlessm/' diff --git a/ansible/templates/known_hosts b/ansible/templates/known_hosts new file mode 100644 index 0000000..fdfd483 --- /dev/null +++ b/ansible/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== -- cgit v1.2.3 From 31234dba79ffc5baabf0371ee08b8c32df107425 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 10:39:47 -0600 Subject: Added API key auth for jhbuild checkouts as well --- ansible/setup_dev_machine.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index 747ecee..39a37a0 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -21,6 +21,12 @@ 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 machine..." @@ -40,4 +46,4 @@ EOF ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.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 +ansible-playbook -i $tmp_inventory playbooks/jhbuild_run.yaml --extra-vars "api_key=$API_KEY" -- cgit v1.2.3 From 24fa201ceeeaa4ddf79e6d803d8aa14a6a76a8af Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 10:40:14 -0600 Subject: Made jhbuild update the modules with the right key --- ansible/playbooks/jhbuild_run.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml index ea3b4d9..b159e15 100644 --- a/ansible/playbooks/jhbuild_run.yaml +++ b/ansible/playbooks/jhbuild_run.yaml @@ -9,8 +9,11 @@ - "../default_variables.yaml" tasks: - - name: "Installing jhbuild dependencies - this will take a very long time" + - 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: "Building jhbuild modules" - shell: executable=/bin/bash ~/.local/bin/jhbuild build + - name: "Installing auth key" + template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth + + - name: "Cloning relevant modules - this will take a very long time" + shell: executable=/bin/bash ~/.local/bin/jhbuild update endless-apps -- cgit v1.2.3 From e72fbbc70cf4cca953bc06d0c03037ce4d228ab4 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 10:53:14 -0600 Subject: Added checking of the API key --- ansible/setup_dev_machine.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index 39a37a0..8526c9d 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -29,11 +29,16 @@ done echo -echo -n "Checking connectivity to machine..." +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 @@ -47,3 +52,5 @@ ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine_root.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" -- cgit v1.2.3 From e4bbb0f1dbc5bf838a542e57f69f4905f664d8ba Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 17:41:29 -0600 Subject: Added dev folder to desktop icons --- ansible/playbooks/kill_shell.yaml | 18 ++++++++++ ansible/playbooks/setup_dev_folder.yaml | 16 +++++++++ ansible/playbooks/setup_dev_machine_root.yaml | 3 ++ ansible/playbooks/setup_other_tools.yaml | 6 ++++ ansible/setup_dev_machine.sh | 2 ++ ansible/templates/add_dev_tools_folder.py | 48 +++++++++++++++++++++++++++ 6 files changed, 93 insertions(+) create mode 100644 ansible/playbooks/kill_shell.yaml create mode 100644 ansible/playbooks/setup_dev_folder.yaml create mode 100644 ansible/templates/add_dev_tools_folder.py diff --git a/ansible/playbooks/kill_shell.yaml b/ansible/playbooks/kill_shell.yaml new file mode 100644 index 0000000..408caa6 --- /dev/null +++ b/ansible/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/ansible/playbooks/setup_dev_folder.yaml b/ansible/playbooks/setup_dev_folder.yaml new file mode 100644 index 0000000..950a588 --- /dev/null +++ b/ansible/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/ansible/playbooks/setup_dev_machine_root.yaml b/ansible/playbooks/setup_dev_machine_root.yaml index 8a6f5df..731fdf9 100644 --- a/ansible/playbooks/setup_dev_machine_root.yaml +++ b/ansible/playbooks/setup_dev_machine_root.yaml @@ -15,3 +15,6 @@ tasks: - include: setup_other_tools.yaml + + - name: "Setting default personality" + shell: executable=/bin/bash eos-select-personality default diff --git a/ansible/playbooks/setup_other_tools.yaml b/ansible/playbooks/setup_other_tools.yaml index 126a68b..b9f05c1 100644 --- a/ansible/playbooks/setup_other_tools.yaml +++ b/ansible/playbooks/setup_other_tools.yaml @@ -16,3 +16,9 @@ - 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/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index 8526c9d..a0d7dc2 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -49,6 +49,8 @@ dev_machine ansible_ssh_host=$TARGET_IP ansible_ssh_user="$TARGET_USER" ansible_ 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" diff --git a/ansible/templates/add_dev_tools_folder.py b/ansible/templates/add_dev_tools_folder.py new file mode 100644 index 0000000..d90d797 --- /dev/null +++ b/ansible/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) -- cgit v1.2.3 From 7029338f601101d8cd4f352352262a0e39cfe3f7 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 21:41:01 -0600 Subject: Reverted the default user to be endless --- ansible/setup_dev_machine.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh index a0d7dc2..3e22394 100755 --- a/ansible/setup_dev_machine.sh +++ b/ansible/setup_dev_machine.sh @@ -1,7 +1,6 @@ #!/bin/bash -e -#DEFAULT_USER="endless" -DEFAULT_USER="sg" +DEFAULT_USER="endless" DEFAULT_PASSWORD="endless" DEFAULT_IP="192.168.56.101" -- cgit v1.2.3 From 28197345ad32daa836fbf84b16a2b936a8086eaa Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 21:42:50 -0600 Subject: Added more verbose message to jhbuild update --- ansible/playbooks/jhbuild_run.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml index b159e15..ff9d290 100644 --- a/ansible/playbooks/jhbuild_run.yaml +++ b/ansible/playbooks/jhbuild_run.yaml @@ -15,5 +15,5 @@ - name: "Installing auth key" template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth - - name: "Cloning relevant modules - this will take a very long time" + - 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 -- cgit v1.2.3 From 29ded8f16c47d285144d2b85ead07974c7079bd6 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 21:45:34 -0600 Subject: Moved ansible directory into tools --- ansible/.gitignore | 4 - ansible/README.md | 64 ---------- ansible/ansible.cfg | 140 --------------------- ansible/default_variables.yaml | 1 - ansible/install.sh | 72 ----------- ansible/keys/id_rsa | 51 -------- ansible/keys/id_rsa.pub | 1 - ansible/playbooks/install_jhbuild_deps.yaml | 16 --- ansible/playbooks/jhbuild_run.yaml | 19 --- ansible/playbooks/kill_shell.yaml | 18 --- ansible/playbooks/setup_default_ssh_key.yaml | 14 --- ansible/playbooks/setup_dev_folder.yaml | 16 --- ansible/playbooks/setup_dev_machine_root.yaml | 20 --- ansible/playbooks/setup_jhbuild.yaml | 34 ----- ansible/playbooks/setup_other_tools.yaml | 24 ---- ansible/setup_dev_machine.sh | 57 --------- ansible/templates/.jhbuildrc-auth.j2 | 4 - ansible/templates/add_dev_tools_folder.py | 48 ------- ansible/templates/known_hosts | 2 - tools/dev_env_setup/.gitignore | 4 + tools/dev_env_setup/README.md | 64 ++++++++++ tools/dev_env_setup/ansible.cfg | 140 +++++++++++++++++++++ tools/dev_env_setup/default_variables.yaml | 1 + tools/dev_env_setup/install.sh | 72 +++++++++++ tools/dev_env_setup/keys/id_rsa | 51 ++++++++ tools/dev_env_setup/keys/id_rsa.pub | 1 + .../playbooks/install_jhbuild_deps.yaml | 16 +++ tools/dev_env_setup/playbooks/jhbuild_run.yaml | 19 +++ tools/dev_env_setup/playbooks/kill_shell.yaml | 18 +++ .../playbooks/setup_default_ssh_key.yaml | 14 +++ .../dev_env_setup/playbooks/setup_dev_folder.yaml | 16 +++ .../playbooks/setup_dev_machine_root.yaml | 20 +++ tools/dev_env_setup/playbooks/setup_jhbuild.yaml | 34 +++++ .../dev_env_setup/playbooks/setup_other_tools.yaml | 24 ++++ tools/dev_env_setup/setup_dev_machine.sh | 57 +++++++++ tools/dev_env_setup/templates/.jhbuildrc-auth.j2 | 4 + .../templates/add_dev_tools_folder.py | 48 +++++++ tools/dev_env_setup/templates/known_hosts | 2 + 38 files changed, 605 insertions(+), 605 deletions(-) delete mode 100644 ansible/.gitignore delete mode 100644 ansible/README.md delete mode 100644 ansible/ansible.cfg delete mode 100644 ansible/default_variables.yaml delete mode 100755 ansible/install.sh delete mode 100644 ansible/keys/id_rsa delete mode 100644 ansible/keys/id_rsa.pub delete mode 100644 ansible/playbooks/install_jhbuild_deps.yaml delete mode 100644 ansible/playbooks/jhbuild_run.yaml delete mode 100644 ansible/playbooks/kill_shell.yaml delete mode 100644 ansible/playbooks/setup_default_ssh_key.yaml delete mode 100644 ansible/playbooks/setup_dev_folder.yaml delete mode 100644 ansible/playbooks/setup_dev_machine_root.yaml delete mode 100644 ansible/playbooks/setup_jhbuild.yaml delete mode 100644 ansible/playbooks/setup_other_tools.yaml delete mode 100755 ansible/setup_dev_machine.sh delete mode 100644 ansible/templates/.jhbuildrc-auth.j2 delete mode 100644 ansible/templates/add_dev_tools_folder.py delete mode 100644 ansible/templates/known_hosts create mode 100644 tools/dev_env_setup/.gitignore create mode 100644 tools/dev_env_setup/README.md create mode 100644 tools/dev_env_setup/ansible.cfg create mode 100644 tools/dev_env_setup/default_variables.yaml create mode 100755 tools/dev_env_setup/install.sh create mode 100644 tools/dev_env_setup/keys/id_rsa create mode 100644 tools/dev_env_setup/keys/id_rsa.pub create mode 100644 tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml create mode 100644 tools/dev_env_setup/playbooks/jhbuild_run.yaml create mode 100644 tools/dev_env_setup/playbooks/kill_shell.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_dev_folder.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_jhbuild.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_other_tools.yaml create mode 100755 tools/dev_env_setup/setup_dev_machine.sh create mode 100644 tools/dev_env_setup/templates/.jhbuildrc-auth.j2 create mode 100644 tools/dev_env_setup/templates/add_dev_tools_folder.py create mode 100644 tools/dev_env_setup/templates/known_hosts diff --git a/ansible/.gitignore b/ansible/.gitignore deleted file mode 100644 index cc324a5..0000000 --- a/ansible/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.swp -hosts -*~ -*.log diff --git a/ansible/README.md b/ansible/README.md deleted file mode 100644 index bc2c0e2..0000000 --- a/ansible/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# 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 .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/ansible/ansible.cfg b/ansible/ansible.cfg deleted file mode 100644 index 3289d8e..0000000 --- a/ansible/ansible.cfg +++ /dev/null @@ -1,140 +0,0 @@ -# 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 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/ansible/default_variables.yaml b/ansible/default_variables.yaml deleted file mode 100644 index ed97d53..0000000 --- a/ansible/default_variables.yaml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/ansible/install.sh b/ansible/install.sh deleted file mode 100755 index 1f3ac90..0000000 --- a/ansible/install.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/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 @" - -sudo -u $SUDO_USER ansible all -m ping diff --git a/ansible/keys/id_rsa b/ansible/keys/id_rsa deleted file mode 100644 index 75a3eaf..0000000 --- a/ansible/keys/id_rsa +++ /dev/null @@ -1,51 +0,0 @@ ------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 -1xltG7VuB7Je7Z1VbNExGhGXz83lJ6gqZcIegH19TvAkZehc28HBoY/1MWSARqZO -hOxwtcF0q4Jm765CCc3e5vwo1re5p2jqpJucKze5dt6khQFLed5H4V4P40UCAwEA -AQKCAgEAlxRVnvl3D2/M61ni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GVhrOGK/Br7jBwAIxU2mYrEt -SBnGZuzqDXXWoFmJxRJoXb9ljeDLITUJdWHyVrvgJZBeYHNZypVjyYNrVq17fPgy -2OSKOlqbs7TSARoCGWTdi4cv6b5KK/stMHK0U769j1DaoO1jsa3WdtYsdDsyPqOZ -40sChCh6vYiLIQUwe9QxeLD841LOQz2N2eftbKOpDPcgVTBr4E696qP+Ysb41/7P -QGBRr/Tu6/7I8/Hxp1TBLSrxMtSFmHfU9YSXXFxeCCsB9KGokOI2DrQyDs7TIQ== ------END RSA PRIVATE KEY----- diff --git a/ansible/keys/id_rsa.pub b/ansible/keys/id_rsa.pub deleted file mode 100644 index 7c0aba6..0000000 --- a/ansible/keys/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -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/ansible/playbooks/install_jhbuild_deps.yaml b/ansible/playbooks/install_jhbuild_deps.yaml deleted file mode 100644 index c802950..0000000 --- a/ansible/playbooks/install_jhbuild_deps.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# 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/ansible/playbooks/jhbuild_run.yaml b/ansible/playbooks/jhbuild_run.yaml deleted file mode 100644 index ff9d290..0000000 --- a/ansible/playbooks/jhbuild_run.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# 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/ansible/playbooks/kill_shell.yaml b/ansible/playbooks/kill_shell.yaml deleted file mode 100644 index 408caa6..0000000 --- a/ansible/playbooks/kill_shell.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# 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/ansible/playbooks/setup_default_ssh_key.yaml b/ansible/playbooks/setup_default_ssh_key.yaml deleted file mode 100644 index 32434da..0000000 --- a/ansible/playbooks/setup_default_ssh_key.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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/ansible/playbooks/setup_dev_folder.yaml b/ansible/playbooks/setup_dev_folder.yaml deleted file mode 100644 index 950a588..0000000 --- a/ansible/playbooks/setup_dev_folder.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# 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/ansible/playbooks/setup_dev_machine_root.yaml b/ansible/playbooks/setup_dev_machine_root.yaml deleted file mode 100644 index 731fdf9..0000000 --- a/ansible/playbooks/setup_dev_machine_root.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# 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/ansible/playbooks/setup_jhbuild.yaml b/ansible/playbooks/setup_jhbuild.yaml deleted file mode 100644 index 45a9df7..0000000 --- a/ansible/playbooks/setup_jhbuild.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -# 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/ansible/playbooks/setup_other_tools.yaml b/ansible/playbooks/setup_other_tools.yaml deleted file mode 100644 index b9f05c1..0000000 --- a/ansible/playbooks/setup_other_tools.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -# 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/ansible/setup_dev_machine.sh b/ansible/setup_dev_machine.sh deleted file mode 100755 index 3e22394..0000000 --- a/ansible/setup_dev_machine.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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/ansible/templates/.jhbuildrc-auth.j2 b/ansible/templates/.jhbuildrc-auth.j2 deleted file mode 100644 index 67d2e1e..0000000 --- a/ansible/templates/.jhbuildrc-auth.j2 +++ /dev/null @@ -1,4 +0,0 @@ -# -*- mode: python -*- -# -*- coding: utf-8 -*- - -repos['endlessm'] = 'https://{{ api_key }}@github.com/endlessm/' diff --git a/ansible/templates/add_dev_tools_folder.py b/ansible/templates/add_dev_tools_folder.py deleted file mode 100644 index d90d797..0000000 --- a/ansible/templates/add_dev_tools_folder.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/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/ansible/templates/known_hosts b/ansible/templates/known_hosts deleted file mode 100644 index fdfd483..0000000 --- a/ansible/templates/known_hosts +++ /dev/null @@ -1,2 +0,0 @@ -|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== 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 .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 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 @" + +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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SXXFxeCCsB9KGokOI2DrQyDs7TIQ== +-----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== -- cgit v1.2.3 From 71df5f953c999f8a9e5a28e53227c07312b6104c Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Thu, 16 Jan 2014 21:57:37 -0600 Subject: Updated the README [endlessm/eos-sdk#1620] --- tools/dev_env_setup/README.md | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/tools/dev_env_setup/README.md b/tools/dev_env_setup/README.md index bc2c0e2..1207dca 100644 --- a/tools/dev_env_setup/README.md +++ b/tools/dev_env_setup/README.md @@ -38,27 +38,4 @@ logged on ostree.endlessm.com and publishes logged on obs-repository. - 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 +- setup_dev_env.sh - Installs the dev environment on the VM -- cgit v1.2.3 From 3981165dc79d4c64daa92c9cf68885c0b5f5143c Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 17 Jan 2014 17:01:46 -0600 Subject: Removed the apply in desktop update script since it wasn't needed [endlessm/eos-sdk#1620] --- tools/dev_env_setup/templates/add_dev_tools_folder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/dev_env_setup/templates/add_dev_tools_folder.py b/tools/dev_env_setup/templates/add_dev_tools_folder.py index d90d797..03ee041 100644 --- a/tools/dev_env_setup/templates/add_dev_tools_folder.py +++ b/tools/dev_env_setup/templates/add_dev_tools_folder.py @@ -36,7 +36,6 @@ def get_settings_string(layout): print "Setting the value" settings.set_value("icon-grid-layout", root) print "Syncing" - settings.apply() settings.sync() print root -- cgit v1.2.3 From b960fb054cd8bf1ed3acc60b8d3da0b844f788b4 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 21 Jan 2014 19:54:54 -0600 Subject: Renamed setup_other_tools script as it could be ambiguous [endlessm/eos-sdk#1620] --- .../playbooks/setup_dev_machine_root.yaml | 2 +- .../dev_env_setup/playbooks/setup_other_tools.yaml | 24 ---------------------- .../dev_env_setup/playbooks/setup_tools_root.yaml | 24 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 tools/dev_env_setup/playbooks/setup_other_tools.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_tools_root.yaml diff --git a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml index 731fdf9..24114e9 100644 --- a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml +++ b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml @@ -14,7 +14,7 @@ - "../default_variables.yaml" tasks: - - include: setup_other_tools.yaml + - include: playbooks/setup_tools_root.yaml - name: "Setting default personality" shell: executable=/bin/bash eos-select-personality default diff --git a/tools/dev_env_setup/playbooks/setup_other_tools.yaml b/tools/dev_env_setup/playbooks/setup_other_tools.yaml deleted file mode 100644 index b9f05c1..0000000 --- a/tools/dev_env_setup/playbooks/setup_other_tools.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -# 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/playbooks/setup_tools_root.yaml b/tools/dev_env_setup/playbooks/setup_tools_root.yaml new file mode 100644 index 0000000..b9f05c1 --- /dev/null +++ b/tools/dev_env_setup/playbooks/setup_tools_root.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 -- cgit v1.2.3 From 2b14911667321d895ec3e1b7343fc5dfa85bcfdb Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 21 Jan 2014 19:57:14 -0600 Subject: Moved copying of desktop links to a separate script [endlessm/eos-sdk#1620] --- tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml | 8 ++++++++ tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml | 2 ++ tools/dev_env_setup/playbooks/setup_tools_root.yaml | 6 ------ 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml diff --git a/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml new file mode 100644 index 0000000..f09d21f --- /dev/null +++ b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml @@ -0,0 +1,8 @@ +--- +# vim:ff=unix ts=2 sw=2 ai expandtab + +- 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/playbooks/setup_dev_machine_root.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml index 24114e9..41e0c6d 100644 --- a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml +++ b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml @@ -16,5 +16,7 @@ tasks: - include: playbooks/setup_tools_root.yaml + - include: playbooks/create_eos_app_shortcuts.yaml + - name: "Setting default personality" shell: executable=/bin/bash eos-select-personality default diff --git a/tools/dev_env_setup/playbooks/setup_tools_root.yaml b/tools/dev_env_setup/playbooks/setup_tools_root.yaml index b9f05c1..126a68b 100644 --- a/tools/dev_env_setup/playbooks/setup_tools_root.yaml +++ b/tools/dev_env_setup/playbooks/setup_tools_root.yaml @@ -16,9 +16,3 @@ - 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 -- cgit v1.2.3 From ce5a91b83397d581f0e22fc954329cc09e6608bc Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Tue, 21 Jan 2014 19:30:57 -0800 Subject: Cleaned the scripts up to not be split by sudo prefix by using sudo variable per task [endlessm/eos-sdk#1620] --- .../playbooks/create_eos_app_shortcuts.yaml | 10 +++- .../playbooks/install_jhbuild_deps.yaml | 16 ++---- tools/dev_env_setup/playbooks/jhbuild_run.yaml | 21 +++----- tools/dev_env_setup/playbooks/kill_shell.yaml | 18 ------- .../playbooks/setup_default_ssh_key.yaml | 5 +- .../dev_env_setup/playbooks/setup_dev_folder.yaml | 18 +++---- .../dev_env_setup/playbooks/setup_dev_machine.yaml | 25 ++++++++++ .../playbooks/setup_dev_machine_root.yaml | 22 -------- tools/dev_env_setup/playbooks/setup_jhbuild.yaml | 58 ++++++++++++++-------- tools/dev_env_setup/setup_dev_machine.sh | 7 +-- 10 files changed, 95 insertions(+), 105 deletions(-) delete mode 100644 tools/dev_env_setup/playbooks/kill_shell.yaml create mode 100644 tools/dev_env_setup/playbooks/setup_dev_machine.yaml delete mode 100644 tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml diff --git a/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml index f09d21f..3776298 100644 --- a/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml +++ b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml @@ -1,8 +1,16 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab +- name: "Setting default personality" + shell: executable=/bin/bash eos-select-personality default + +- name: "Creating ~/.local/share/applications directory" + file: path=~/.local/share/applications state=directory + sudo: False + - name: "Creating EOS links for various apps" - shell: cp /usr/share/applications/$item.desktop /usr/share/applications/eos-app-$item.desktop + shell: cp /usr/share/applications/$item.desktop ~/.local/share/applications/eos-app-$item.desktop with_items: - gnome-terminal - devhelp + sudo: False diff --git a/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml b/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml index c802950..a8161be 100644 --- a/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml +++ b/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml @@ -1,16 +1,8 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab -- - hosts: dev_machine - sudo: True +- name: "Creating /opt/gnome directory" +file: path=/opt/gnome state=directory mode=777 - 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 +- 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 index ff9d290..744af74 100644 --- a/tools/dev_env_setup/playbooks/jhbuild_run.yaml +++ b/tools/dev_env_setup/playbooks/jhbuild_run.yaml @@ -1,19 +1,14 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab -- - hosts: dev_machine +- name: "Installing jhbuild dependencies - this may take a very long time" + shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install 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: "Installing auth key" + template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth + sudo: False - - 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 +- 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 + sudo: False diff --git a/tools/dev_env_setup/playbooks/kill_shell.yaml b/tools/dev_env_setup/playbooks/kill_shell.yaml deleted file mode 100644 index 408caa6..0000000 --- a/tools/dev_env_setup/playbooks/kill_shell.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# 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 index 32434da..32e7cd8 100644 --- a/tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml +++ b/tools/dev_env_setup/playbooks/setup_default_ssh_key.yaml @@ -3,12 +3,15 @@ - name: "Creating ssh directory" file: path=~/.ssh state=directory mode=700 + sudo: False - name: "Copying default ssh keys" - copy: src=../keys/$item dest=~/.ssh/ + copy: src=../keys/$item dest=~/.ssh/ mode=700 with_items: - id_rsa - id_rsa.pub + sudo: False - name: "Adding default known_hosts file" copy: src=../templates/known_hosts dest=~/.ssh/ + sudo: False diff --git a/tools/dev_env_setup/playbooks/setup_dev_folder.yaml b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml index 950a588..3328f99 100644 --- a/tools/dev_env_setup/playbooks/setup_dev_folder.yaml +++ b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml @@ -1,16 +1,12 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab -- - hosts: dev_machine - +- name: "Copying python file for desktop generation" + copy: src=../templates/add_dev_tools_folder.py dest=~/ mode=755 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 + sudo: False - - name: "Creating development tools folder" - shell: executable=/bin/bash export DISPLAY=:0; ~/add_dev_tools_folder.py &> ~/add_dev_tools_folder.log +- name: "Setting default personality" + service: name=gdm state=restarted diff --git a/tools/dev_env_setup/playbooks/setup_dev_machine.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine.yaml new file mode 100644 index 0000000..11f0783 --- /dev/null +++ b/tools/dev_env_setup/playbooks/setup_dev_machine.yaml @@ -0,0 +1,25 @@ +--- +# 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_tools_root.yaml + + - include: create_eos_app_shortcuts.yaml + + - include: setup_dev_folder.yaml + + - include: setup_default_ssh_key.yaml + + - include: setup_jhbuild.yaml diff --git a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml deleted file mode 100644 index 41e0c6d..0000000 --- a/tools/dev_env_setup/playbooks/setup_dev_machine_root.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# 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: playbooks/setup_tools_root.yaml - - - include: playbooks/create_eos_app_shortcuts.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 index 45a9df7..a8749a6 100644 --- a/tools/dev_env_setup/playbooks/setup_jhbuild.yaml +++ b/tools/dev_env_setup/playbooks/setup_jhbuild.yaml @@ -1,34 +1,50 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab -- - hosts: dev_machine +- 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 + sudo: False + +- name: "Cloning jhbuild" + git: repo=git://git.gnome.org/jhbuild + dest=~/checkout/jhbuild + sudo: False + +- name: "Installing jhbuild - autogen" + shell: cd ~/checkout/jhbuild && ./autogen.sh + sudo: False + +- name: "Installing jhbuild - make" + shell: cd ~/checkout/jhbuild && make sudo: False - vars_files: - - "../default_variables.yaml" +- name: "Installing jhbuild - make install" + shell: cd ~/checkout/jhbuild && make install + sudo: False - tasks: - - name: "Ensuring that git is installed" - apt: name=git update_cache=true cache_valid_time=259200 +- name: "Creating glib schemas dir" + file: path=~/install/share/glib-2.0/schemas state=directory mode=755 + sudo: False - - 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: "Creating /opt/gnome directory" + file: path=/opt/gnome state=directory mode=777 - - name: "Installing jhbuild - autogen" - shell: cd ~/checkout/jhbuild && ./autogen.sh +- name: "Updating apt-file cache" + shell: apt-file update - - name: "Installing jhbuild - make" - shell: cd ~/checkout/jhbuild && make - - name: "Installing jhbuild - make install" - shell: cd ~/checkout/jhbuild && make install +- name: "Installing jhbuild dependencies - this may take a very long time" + shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install + sudo: False - - name: "Creating glib schemas dir" - file: path=~/install/share/glib-2.0/schemas state=directory mode=755 +- name: "Installing auth key" + template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth + sudo: False - - include: setup_default_ssh_key.yaml +- 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 + sudo: False diff --git a/tools/dev_env_setup/setup_dev_machine.sh b/tools/dev_env_setup/setup_dev_machine.sh index 3e22394..f886748 100755 --- a/tools/dev_env_setup/setup_dev_machine.sh +++ b/tools/dev_env_setup/setup_dev_machine.sh @@ -47,11 +47,6 @@ cat << EOF > $tmp_inventory 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" +ansible-playbook -i $tmp_inventory playbooks/setup_dev_machine.yaml --extra-vars "api_key=$API_KEY" echo "Repos are cloned. You should be able to run 'jhbuild build' on the target" -- cgit v1.2.3 From 17ed20e3f1dafdd85c421b39a9e75bc04d7ebf72 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Wed, 22 Jan 2014 18:12:36 -0800 Subject: Applied a better implementation of setting the dev folder on the desktop [endlessm/eos-sdk#1620] --- tools/dev_env_setup/playbooks/setup_dev_folder.yaml | 12 ++++++------ tools/dev_env_setup/setup_dev_machine.sh | 2 +- tools/dev_env_setup/templates/add_dev_tools_folder.py | 2 -- tools/dev_env_setup/templates/run_app_in_context_of.sh | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 tools/dev_env_setup/templates/run_app_in_context_of.sh diff --git a/tools/dev_env_setup/playbooks/setup_dev_folder.yaml b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml index 3328f99..562fd9b 100644 --- a/tools/dev_env_setup/playbooks/setup_dev_folder.yaml +++ b/tools/dev_env_setup/playbooks/setup_dev_folder.yaml @@ -1,12 +1,12 @@ --- # vim:ff=unix ts=2 sw=2 ai expandtab -- name: "Copying python file for desktop generation" - copy: src=../templates/add_dev_tools_folder.py dest=~/ mode=755 +- name: "Copying files for desktop generation" + copy: src=../templates/$item dest=~/ mode=755 + with_items: + - add_dev_tools_folder.py + - run_app_in_context_of.sh sudo: False - name: "Creating development tools folder" - shell: executable=/bin/bash export DISPLAY=:0; ~/add_dev_tools_folder.py &> ~/add_dev_tools_folder.log + shell: executable=/bin/bash ~/run_app_in_context_of.sh eos-shell ~/add_dev_tools_folder.py &> ~/add_dev_tools_folder.log sudo: False - -- name: "Setting default personality" - service: name=gdm state=restarted diff --git a/tools/dev_env_setup/setup_dev_machine.sh b/tools/dev_env_setup/setup_dev_machine.sh index f886748..0033e50 100755 --- a/tools/dev_env_setup/setup_dev_machine.sh +++ b/tools/dev_env_setup/setup_dev_machine.sh @@ -7,7 +7,7 @@ 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 " - sshpass and latest Ansible installed on the local machine" echo read -p "Press [Enter] to continue..." diff --git a/tools/dev_env_setup/templates/add_dev_tools_folder.py b/tools/dev_env_setup/templates/add_dev_tools_folder.py index 03ee041..3e8df1b 100644 --- a/tools/dev_env_setup/templates/add_dev_tools_folder.py +++ b/tools/dev_env_setup/templates/add_dev_tools_folder.py @@ -39,8 +39,6 @@ def get_settings_string(layout): settings.sync() print root - time.sleep(20) - if __name__ == "__main__": layout = get_default_layout() write_folder_data() diff --git a/tools/dev_env_setup/templates/run_app_in_context_of.sh b/tools/dev_env_setup/templates/run_app_in_context_of.sh new file mode 100644 index 0000000..ae9facb --- /dev/null +++ b/tools/dev_env_setup/templates/run_app_in_context_of.sh @@ -0,0 +1,14 @@ +#!/bin/bash +PID="$(pgrep -o -f -u $(id -u) $1)" +[ -z "$PID" ] && echo "No such process" > /dev/stderr && exit 1 + +eval `strings /proc/$PID/environ | while read line; do + KEY="$(echo $line | sed -n 's/\([[:upper:]_]*\)=.*/\1/p')" + VALUE="$(echo $line | sed -n 's/[[:upper:]_]*=\([^"]*\)/\1/p')" + [ -z "$KEY" ] && continue; + [ -z "$VALUE" ] && continue; + echo "export $KEY='$VALUE'" +done` + +echo "Now in same session as $PID. Running $2" +$2 -- cgit v1.2.3 From fc28fc348faf73a585d5b0581702c6cd4aedf51d Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 24 Jan 2014 14:52:37 -0800 Subject: Removed obsolete files [endlessm/eos-sdk#1620] --- tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml | 8 -------- tools/dev_env_setup/playbooks/jhbuild_run.yaml | 14 -------------- 2 files changed, 22 deletions(-) delete mode 100644 tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml delete mode 100644 tools/dev_env_setup/playbooks/jhbuild_run.yaml diff --git a/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml b/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml deleted file mode 100644 index a8161be..0000000 --- a/tools/dev_env_setup/playbooks/install_jhbuild_deps.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# vim:ff=unix ts=2 sw=2 ai expandtab - -- 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 deleted file mode 100644 index 744af74..0000000 --- a/tools/dev_env_setup/playbooks/jhbuild_run.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# vim:ff=unix ts=2 sw=2 ai expandtab - -- name: "Installing jhbuild dependencies - this may take a very long time" - shell: executable=/bin/bash echo -e "y\n" | ~/.local/bin/jhbuild sysdeps --install - sudo: False - -- name: "Installing auth key" - template: src=../templates/.jhbuildrc-auth.j2 dest=~/.jhbuildrc-auth - sudo: False - -- 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 - sudo: False -- cgit v1.2.3 From bb946ad9b44d8113aae1b20a981b5e0c0dbc3b21 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 24 Jan 2014 14:53:33 -0800 Subject: Changed the remote cache dir to be more standard [endlessm/eos-sdk#1620] --- tools/dev_env_setup/ansible.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dev_env_setup/ansible.cfg b/tools/dev_env_setup/ansible.cfg index 3289d8e..8e4b3a3 100644 --- a/tools/dev_env_setup/ansible.cfg +++ b/tools/dev_env_setup/ansible.cfg @@ -19,7 +19,7 @@ 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 +remote_tmp = $HOME/.cache/ansible # Disable deprecation warnings deprecation_warnings=False -- cgit v1.2.3 From d3284ec9fa80f64bb2a777840d1c5c2312ed648d Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 24 Jan 2014 14:54:21 -0800 Subject: Instead of softlinking ansible-playbook, we copy it into bin [endlessm/eos-sdk#1620] --- tools/dev_env_setup/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dev_env_setup/install.sh b/tools/dev_env_setup/install.sh index 1f3ac90..e56ff35 100755 --- a/tools/dev_env_setup/install.sh +++ b/tools/dev_env_setup/install.sh @@ -42,7 +42,7 @@ fi if [[ ! $(which ansible-playbook) ]]; then echo "Installing playbook script softlink" - ln -fs ${HOME}/apps/ansible/build/scripts-2.7/ansible-playbook /usr/bin/ + sudo cp ${HOME}/apps/ansible/build/scripts-2.7/ansible-playbook /usr/bin/ fi echo "Checking if this user has a ssh key" -- cgit v1.2.3 From 856f06f67e1aba7505542912213749cf35124246 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 24 Jan 2014 15:37:56 -0800 Subject: Removed need for bash on setting the personality [endlessm/eos-sdk#1620] --- tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml index 3776298..b641e74 100644 --- a/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml +++ b/tools/dev_env_setup/playbooks/create_eos_app_shortcuts.yaml @@ -2,7 +2,7 @@ # vim:ff=unix ts=2 sw=2 ai expandtab - name: "Setting default personality" - shell: executable=/bin/bash eos-select-personality default + shell: eos-select-personality default - name: "Creating ~/.local/share/applications directory" file: path=~/.local/share/applications state=directory -- cgit v1.2.3 From d5697c2531ae8f6e4ad8a462f0483aca47ae0665 Mon Sep 17 00:00:00 2001 From: Srdjan Grubor Date: Fri, 24 Jan 2014 15:38:54 -0800 Subject: Added automatic install of eos-dev if it's not on the VM [endlessm/eos-sdk#1620] --- tools/dev_env_setup/playbooks/install_eos_dev_package.yaml | 9 +++++++++ tools/dev_env_setup/playbooks/setup_dev_machine.yaml | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 tools/dev_env_setup/playbooks/install_eos_dev_package.yaml diff --git a/tools/dev_env_setup/playbooks/install_eos_dev_package.yaml b/tools/dev_env_setup/playbooks/install_eos_dev_package.yaml new file mode 100644 index 0000000..f69c31a --- /dev/null +++ b/tools/dev_env_setup/playbooks/install_eos_dev_package.yaml @@ -0,0 +1,9 @@ +--- +# vim:ff=unix ts=2 sw=2 ai expandtab + +- name: "Ensuring that we can call apt from our scripts" + raw: "apt-get install -y --force-yes python-apt python" + +- name: "Ensuring that eos-dev is installed. If not, this operation will take a signifficant amount of time" + apt: name=eos-dev force=yes update_cache=true cache_valid_time=259200 + diff --git a/tools/dev_env_setup/playbooks/setup_dev_machine.yaml b/tools/dev_env_setup/playbooks/setup_dev_machine.yaml index 11f0783..e87b827 100644 --- a/tools/dev_env_setup/playbooks/setup_dev_machine.yaml +++ b/tools/dev_env_setup/playbooks/setup_dev_machine.yaml @@ -14,6 +14,8 @@ - "../default_variables.yaml" tasks: + - include: install_eos_dev_package.yaml + - include: setup_tools_root.yaml - include: create_eos_app_shortcuts.yaml -- cgit v1.2.3