From: Andrew Schoen Date: Tue, 26 Apr 2016 15:44:10 +0000 (-0500) Subject: rename slave.yml.j2 to slave.yml X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=114528930337f5c35625610960a4ad3f77d268ca;p=ceph-build.git rename slave.yml.j2 to slave.yml There is no need to have two different playbooks anymore now that we're not using mako templating in prado. Signed-off-by: Andrew Schoen --- diff --git a/ansible/slave.yml b/ansible/slave.yml index a818e7c9..4aa5efe4 100644 --- a/ansible/slave.yml +++ b/ansible/slave.yml @@ -5,17 +5,23 @@ user: ubuntu vars: - jenkins_user: 'jenkins-build' - - exclusive: true + # jenkins API credentials: + - api_user: 'ceph-jenkins' + - token: '{{ token }}' + - api_uri: 'https://jenkins.ceph.com' + - nodename: '{{ nodename }}' + - labels: '{{ labels }}' + tasks: - name: create a {{ jenkins_user }} user - user: name={{ jenkins_user }} comment="Jenkins Build Slave User" home="/home/{{ jenkins_user }}" + user: name={{ jenkins_user }} comment="Jenkins Build Slave User" - name: Create .ssh directory file: path=/home/{{ jenkins_user }}/.ssh state=directory - name: set the authorized keys - authorized_key: user={{ jenkins_user }} key="{{ lookup('file', 'files/ssh/keys/jenkins_build.pub') }}" + authorized_key: user={{ jenkins_user }} key="{{ lookup('file', 'playbook/files/ssh/keys/jenkins_build.pub') }}" - name: ensure {{ jenkins_user }} can sudo without a prompt sudo: yes @@ -28,6 +34,9 @@ - name: ensure the build dir exists file: path=/home/{{ jenkins_user }}/build state=directory owner={{ jenkins_user }} + - name: ensure the build dir has the right owner permissions + file: path=/home/{{ jenkins_user }}/build state=directory owner={{ jenkins_user }} + - name: Install RPM requirements sudo: yes yum: name={{ item }} state=present @@ -36,17 +45,28 @@ - epel-release - java-1.7.0-openjdk - git + - python-pip + - python-virtualenv + - libtool #- rpm-sign + - autoconf + - redhat-lsb-core + - automake + - binutils + - bison + - flex + - gcc + - gcc-c++ + - gettext + - libtool + - make + - patch + - pkgconfig + - redhat-rpm-config + - rpm-build - rpmdevtools when: ansible_pkg_mgr == "yum" - - name: ensure the rpmmacros file exists to fix centos builds - template: - src: files/rpmmacros.j2 - dest: "/home/{{ jenkins_user }}/.rpmmacros" - owner: "{{ jenkins_user }}" - when: ansible_pkg_mgr == "yum" - # Run the equivalent of "apt-get update" as a separate step - apt: update_cache=yes when: ansible_pkg_mgr == "apt" @@ -68,6 +88,9 @@ - python-dev - python-pip - python-virtualenv + - libtool + - autotools-dev + - automake # jenkins-job-builder job: - libyaml-dev # ceph-docs job: @@ -86,18 +109,33 @@ (ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'precise') or (ansible_distribution == 'Debian' and ansible_distribution_release == 'wheezy') + - name: ensure the rpmmacros file exists to fix centos builds + file: path="/home/{{ jenkins_user }}/.rpmmacros" owner="{{ jenkins_user }}" state=touch + + - name: write the rpmmacros needed in centos + lineinfile: + dest: "/home/{{ jenkins_user }}/.rpmmacros" + regexp: '^%dist' + line: '%dist .el{{ ansible_distribution_major_version }}' + when: ansible_pkg_mgr == "yum" + + - name: install six, latest one + sudo: true + pip: name=six state=latest - name: install python-jenkins sudo: true - pip: name=python-jenkins + # https://bugs.launchpad.net/python-jenkins/+bug/1500898 + pip: name=python-jenkins version=0.4.7 - name: add github.com host key sudo: true known_hosts: path: '/etc/ssh/ssh_known_hosts' - name: 'github.com' + # we need to use 'host' here because prado currently uses ansible-playbook==1.9.1 + host: 'github.com' # github.com.pub is the output of `ssh-keyscan github.com` - key: "{{ lookup('file', 'files/ssh/hostkeys/github.com.pub') }}" + key: "{{ lookup('file', 'playbook/files/ssh/hostkeys/github.com.pub') }}" - name: register the new slave to jenkins master jenkins-node: @@ -114,4 +152,4 @@ remoteFS: '/home/{{ jenkins_user }}/build' # XXX this should be configurable, not all nodes should have one executor executors: 1 - exclusive: "{{ exclusive }}" + exclusive: true diff --git a/ansible/slave.yml.j2 b/ansible/slave.yml.j2 deleted file mode 100644 index 4aa5efe4..00000000 --- a/ansible/slave.yml.j2 +++ /dev/null @@ -1,155 +0,0 @@ ---- - -- hosts: all - sudo: true - user: ubuntu - vars: - - jenkins_user: 'jenkins-build' - # jenkins API credentials: - - api_user: 'ceph-jenkins' - - token: '{{ token }}' - - api_uri: 'https://jenkins.ceph.com' - - nodename: '{{ nodename }}' - - labels: '{{ labels }}' - - tasks: - - name: create a {{ jenkins_user }} user - user: name={{ jenkins_user }} comment="Jenkins Build Slave User" - - - name: Create .ssh directory - file: path=/home/{{ jenkins_user }}/.ssh - state=directory - - - name: set the authorized keys - authorized_key: user={{ jenkins_user }} key="{{ lookup('file', 'playbook/files/ssh/keys/jenkins_build.pub') }}" - - - name: ensure {{ jenkins_user }} can sudo without a prompt - sudo: yes - lineinfile: - dest: /etc/sudoers - regexp: '^{{ jenkins_user }} ALL' - line: '{{ jenkins_user }} ALL=(ALL:ALL) NOPASSWD:ALL' - validate: 'visudo -cf %s' - - - name: ensure the build dir exists - file: path=/home/{{ jenkins_user }}/build state=directory owner={{ jenkins_user }} - - - name: ensure the build dir has the right owner permissions - file: path=/home/{{ jenkins_user }}/build state=directory owner={{ jenkins_user }} - - - name: Install RPM requirements - sudo: yes - yum: name={{ item }} state=present - with_items: - - createrepo - - epel-release - - java-1.7.0-openjdk - - git - - python-pip - - python-virtualenv - - libtool - #- rpm-sign - - autoconf - - redhat-lsb-core - - automake - - binutils - - bison - - flex - - gcc - - gcc-c++ - - gettext - - libtool - - make - - patch - - pkgconfig - - redhat-rpm-config - - rpm-build - - rpmdevtools - when: ansible_pkg_mgr == "yum" - - # Run the equivalent of "apt-get update" as a separate step - - apt: update_cache=yes - when: ansible_pkg_mgr == "apt" - - - name: Install DEB requirements - sudo: yes - apt: name={{ item }} state=present - with_items: - - git - - fakeroot - - fakeroot-ng - - debhelper - - reprepro - - dchroot - - devscripts - - pbuilder - - pkg-config - - openjdk-7-jre - - python-dev - - python-pip - - python-virtualenv - - libtool - - autotools-dev - - automake - # jenkins-job-builder job: - - libyaml-dev - # ceph-docs job: - - doxygen - - ditaa - - ant - # teuthology-docs job: - - libmysqlclient-dev - - libevent-dev - - libffi-dev - when: ansible_pkg_mgr == "apt" - - - name: correct java version selected - alternatives: name=java path=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java - when: - (ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'precise') or - (ansible_distribution == 'Debian' and ansible_distribution_release == 'wheezy') - - - name: ensure the rpmmacros file exists to fix centos builds - file: path="/home/{{ jenkins_user }}/.rpmmacros" owner="{{ jenkins_user }}" state=touch - - - name: write the rpmmacros needed in centos - lineinfile: - dest: "/home/{{ jenkins_user }}/.rpmmacros" - regexp: '^%dist' - line: '%dist .el{{ ansible_distribution_major_version }}' - when: ansible_pkg_mgr == "yum" - - - name: install six, latest one - sudo: true - pip: name=six state=latest - - - name: install python-jenkins - sudo: true - # https://bugs.launchpad.net/python-jenkins/+bug/1500898 - pip: name=python-jenkins version=0.4.7 - - - name: add github.com host key - sudo: true - known_hosts: - path: '/etc/ssh/ssh_known_hosts' - # we need to use 'host' here because prado currently uses ansible-playbook==1.9.1 - host: 'github.com' - # github.com.pub is the output of `ssh-keyscan github.com` - key: "{{ lookup('file', 'playbook/files/ssh/hostkeys/github.com.pub') }}" - - - name: register the new slave to jenkins master - jenkins-node: - username: "{{ api_user }}" - uri: "{{ api_uri }}" - password: "{{ token }}" - # relies on a convention to set a unique name that allows a reverse - # mapping from Jenkins back to whatever service created the current - # node - name: "{{ ansible_default_ipv4.address }}+{{ nodename }}" - labels: "{{ labels }}" - host: "{{ ansible_default_ipv4.address }}" - credentialsId: '39fa150b-b2a1-416e-b334-29a9a2c0b32d' - remoteFS: '/home/{{ jenkins_user }}/build' - # XXX this should be configurable, not all nodes should have one executor - executors: 1 - exclusive: true