]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
teuthology: manage teuthology system users 147/head
authorZack Cerza <zack@redhat.com>
Tue, 29 Sep 2015 19:45:03 +0000 (13:45 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 2 Oct 2015 15:44:28 +0000 (09:44 -0600)
'teuthology' for scheduling and 'teuthworker' for execution

This is intended to mirror our existing setups

Signed-off-by: Zack Cerza <zack@redhat.com>
roles/teuthology/README.rst [new file with mode: 0644]
roles/teuthology/defaults/main.yml [new file with mode: 0644]
roles/teuthology/tasks/apt_systems.yml [new file with mode: 0644]
roles/teuthology/tasks/main.yml [new file with mode: 0644]
roles/teuthology/tasks/setup_users.yml [new file with mode: 0644]
roles/teuthology/tasks/yum_systems.yml [new file with mode: 0644]
roles/teuthology/vars/apt_systems.yml [new file with mode: 0644]
roles/teuthology/vars/yum_systems.yml [new file with mode: 0644]

diff --git a/roles/teuthology/README.rst b/roles/teuthology/README.rst
new file mode 100644 (file)
index 0000000..d836973
--- /dev/null
@@ -0,0 +1,21 @@
+Teuthology
+==========
+
+This role is used to manage the main teuthology node in a lab, e.g.
+``teuthology.front.sepia.ceph.com``.
+
+It currently depends on the ``sudo`` and ``users`` roles. 
+
+It also does the following:
+
+- Install dependencies required for ``teuthology``
+- Create the ``teuthology`` and ``teuthworker`` users which are used for
+  scheduling and executing tests, respectively
+- Clone ``teuthology`` repos into ``~/src/teuthology_master`` under those user accounts
+- Run ``teuthology``'s ``bootstrap`` script
+
+It currently does NOT do these things:
+
+- Manage crontab entries
+- Manage ``teuthology-worker`` processes
+- Run ``teuthology-nuke --stale``
diff --git a/roles/teuthology/defaults/main.yml b/roles/teuthology/defaults/main.yml
new file mode 100644 (file)
index 0000000..430055f
--- /dev/null
@@ -0,0 +1,8 @@
+---
+teuthology_users:
+  # for scheduling tests
+  - teuthology
+  # for executing tests
+  - teuthworker
+
+teuthology_repo: https://github.com/ceph/teuthology.git
diff --git a/roles/teuthology/tasks/apt_systems.yml b/roles/teuthology/tasks/apt_systems.yml
new file mode 100644 (file)
index 0000000..fb70380
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- name: Include package type specific vars.
+  include_vars: "apt_systems.yml"
+  tags:
+    - always
+
+- name: Install packages via apt
+  apt:
+    name: "{{ item }}"
+    state: latest
+    update_cache: yes
+    cache_valid_time: 600
+  with_items: "{{ teuthology_extra_packages }}"
+  tags:
+    - packages
diff --git a/roles/teuthology/tasks/main.yml b/roles/teuthology/tasks/main.yml
new file mode 100644 (file)
index 0000000..a4bc92a
--- /dev/null
@@ -0,0 +1,10 @@
+---
+- include: apt_systems.yml
+  when: ansible_pkg_mgr == "apt"
+
+# Yum systems support is not implemented yet.
+- include: yum_systems.yml
+  when: ansible_pkg_mgr == "yum"
+
+# Set up the different users that teuthology uses
+- include: setup_users.yml
diff --git a/roles/teuthology/tasks/setup_users.yml b/roles/teuthology/tasks/setup_users.yml
new file mode 100644 (file)
index 0000000..620a306
--- /dev/null
@@ -0,0 +1,43 @@
+---
+- name: Create users
+  user:
+    name: "{{ item }}"
+    state: present
+    shell: /bin/bash
+  with_items: "{{ teuthology_users }}"
+  tags:
+    - user
+
+- name: Clone the teuthology repo
+  git:
+    repo: "{{ teuthology_repo }}"
+    dest: /home/{{ item }}/src/teuthology_master
+  sudo_user: "{{ item }}"
+  with_items: "{{ teuthology_users }}"
+  tags:
+    - repos
+
+- name: Run bootstrap
+  shell: NO_CLOBBER=true ./bootstrap
+  args:
+    chdir: /home/{{ item }}/src/teuthology_master/
+  sudo_user: "{{ item }}"
+  with_items: "{{ teuthology_users }}"
+  register: bootstrap
+  changed_when: bootstrap.stdout_lines[-1]|length > 60
+  
+- name: Add teuthology scripts to PATH
+  lineinfile:
+    dest: /home/{{ item }}/.profile
+    regexp: teuthology_master
+    line: 'PATH="$HOME/src/teuthology_master/virtualenv/bin:$PATH"'
+  sudo_user: "{{ item }}"
+  with_items: "{{ teuthology_users }}"
+
+- name: Ensure teuthology is usable
+  shell: "./teuthology --version"
+  args:
+    chdir: /home/{{ item }}/src/teuthology_master/virtualenv/bin/
+  sudo_user: "{{ item }}"
+  with_items: "{{ teuthology_users }}"
+  changed_when: false
diff --git a/roles/teuthology/tasks/yum_systems.yml b/roles/teuthology/tasks/yum_systems.yml
new file mode 100644 (file)
index 0000000..78a6710
--- /dev/null
@@ -0,0 +1,3 @@
+---
+- fail:
+    msg: "yum systems are not supported at this time"
diff --git a/roles/teuthology/vars/apt_systems.yml b/roles/teuthology/vars/apt_systems.yml
new file mode 100644 (file)
index 0000000..5711d6f
--- /dev/null
@@ -0,0 +1,15 @@
+---
+teuthology_extra_packages:
+  # The following packages are requirements for bootstrapping teuthology
+  - git-all
+  - python-dev
+  - python-pip
+  - python-virtualenv
+  - libevent-dev
+  - python-libvirt
+  - beanstalkd
+  # The following packages are requirements for running teuthology
+  - libmysqlclient-dev
+  - libffi-dev
+  - libssl-dev
+  - libyaml-dev
diff --git a/roles/teuthology/vars/yum_systems.yml b/roles/teuthology/vars/yum_systems.yml
new file mode 100644 (file)
index 0000000..ed97d53
--- /dev/null
@@ -0,0 +1 @@
+---