From 9ed5a0ceecfaf346cffb2a08606b473300fb072a Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 9 Jan 2018 14:35:30 +1100 Subject: [PATCH] ansible: new centos6 machines, updated & fixed centos6 config --- ansible/inventory.yml | 6 ++--- .../tasks/partials/repo/centos6.yml | 25 +++++++++---------- ansible/roles/baselayout/vars/main.yml | 4 +++ .../bootstrap/tasks/partials/centos6.yml | 21 ++++++++++++++++ .../files/{centos5.monitrc => centos.monitrc} | 0 ansible/roles/jenkins-worker/tasks/monit.yml | 2 +- .../tasks/partials/tap2junit/centos6.yml | 2 +- .../jenkins-worker/templates/centos.initd.j2 | 9 ++++--- 8 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 ansible/roles/bootstrap/tasks/partials/centos6.yml rename ansible/roles/jenkins-worker/files/{centos5.monitrc => centos.monitrc} (100%) diff --git a/ansible/inventory.yml b/ansible/inventory.yml index f24e40ab2..8b69bb6d9 100644 --- a/ansible/inventory.yml +++ b/ansible/inventory.yml @@ -52,7 +52,7 @@ hosts: - softlayer: centos5-x86-1: {ip: 50.23.85.253} - centos6-x64-1: {ip: 50.97.245.10} + centos6-x64-1: {ip: 169.62.77.228} - linuxonecc: rhel72-s390x-1: {ip: 148.100.110.65} @@ -215,8 +215,8 @@ hosts: - softlayer: centos5-x64-1: {ip: 50.23.85.252} centos5-x64-2: {ip: 173.193.25.109} - centos6-x64-1: {ip: 50.23.85.251} - centos6-x64-2: {ip: 184.173.120.137} + centos6-x64-1: {ip: 169.61.75.51} + centos6-x64-2: {ip: 169.61.75.58} centos7-x64-1: {ip: 50.23.85.250} debian8-x86-1: {ip: 169.44.16.126} ubuntu1404-x64-1: {ip: 50.97.245.5} diff --git a/ansible/roles/baselayout/tasks/partials/repo/centos6.yml b/ansible/roles/baselayout/tasks/partials/repo/centos6.yml index feac8043a..858913f2e 100644 --- a/ansible/roles/baselayout/tasks/partials/repo/centos6.yml +++ b/ansible/roles/baselayout/tasks/partials/repo/centos6.yml @@ -4,19 +4,18 @@ # centos6 - almost getting there # -- name: "repo : add scl devtoolset" - yum_repository: - baseurl: http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo - gpgkey: http://ftp.scientificlinux.org/linux/scientific/5x/{{ ansible_architecture }}/RPM-GPG-KEYs/RPM-GPG-KEY-cern - gpgcheck: yes +- name: "repo : add devtoolset-2" + get_url: + url: http://people.centos.org/tru/devtools-2/devtools-2.repo + dest: /etc/yum.repos.d/devtoolset-2.repo + mode: 0440 -- name: "repo : add scl" - yum_repository: - baseurl: http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo - gpgkey: http://ftp.scientificlinux.org/linux/scientific/5x/{{ ansible_architecture }}/RPM-GPG-KEYs/RPM-GPG-KEY-cern - gpgcheck: yes - -- name: install epel +- name: "repo : add epel" yum: - name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm" + name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm + state: present + +- name: "repo : add epel key" + rpm_key: + key: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }} state: present diff --git a/ansible/roles/baselayout/vars/main.yml b/ansible/roles/baselayout/vars/main.yml index 8f4c26235..6d17f1f22 100644 --- a/ansible/roles/baselayout/vars/main.yml +++ b/ansible/roles/baselayout/vars/main.yml @@ -54,6 +54,10 @@ packages: { 'git', ], + centos6: [ + 'devtoolset-2-toolchain', + ], + centos7: [ 'gcc-c++', ], diff --git a/ansible/roles/bootstrap/tasks/partials/centos6.yml b/ansible/roles/bootstrap/tasks/partials/centos6.yml new file mode 100644 index 000000000..6751c4bb7 --- /dev/null +++ b/ansible/roles/bootstrap/tasks/partials/centos6.yml @@ -0,0 +1,21 @@ +--- + +# +# a centos6 bootstrap - copied from fedora +# + +- name: check for python + raw: stat /usr/bin/python + register: has_python + failed_when: has_python.rc > 1 + +- name: check for libselinux-python bindings + raw: yum info libselinux-python | grep Installed + register: has_libselinux + failed_when: has_libselinux.rc > 1 + +- name: install libselinux-python bindings + raw: yum install -y libselinux-python + +- name: disable selinux + selinux: state=disabled diff --git a/ansible/roles/jenkins-worker/files/centos5.monitrc b/ansible/roles/jenkins-worker/files/centos.monitrc similarity index 100% rename from ansible/roles/jenkins-worker/files/centos5.monitrc rename to ansible/roles/jenkins-worker/files/centos.monitrc diff --git a/ansible/roles/jenkins-worker/tasks/monit.yml b/ansible/roles/jenkins-worker/tasks/monit.yml index 2f0ce0fb0..b88606b15 100644 --- a/ansible/roles/jenkins-worker/tasks/monit.yml +++ b/ansible/roles/jenkins-worker/tasks/monit.yml @@ -11,7 +11,7 @@ copy: args: src: "{{ monitrc }}" - dest: "/etc/monitrc" + dest: "/etc/monit.d/jenkins" mode: 0440 loop_control: loop_var: monitrc diff --git a/ansible/roles/jenkins-worker/tasks/partials/tap2junit/centos6.yml b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/centos6.yml index fbfc72f2a..734d330f3 100644 --- a/ansible/roles/jenkins-worker/tasks/partials/tap2junit/centos6.yml +++ b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/centos6.yml @@ -13,5 +13,5 @@ - python-argparse - name: install tap2junit - raw: easy_install tap2junit + raw: easy_install --index-url https://pypi.python.org/pypi tap2junit diff --git a/ansible/roles/jenkins-worker/templates/centos.initd.j2 b/ansible/roles/jenkins-worker/templates/centos.initd.j2 index 864bb666f..886133a7a 100644 --- a/ansible/roles/jenkins-worker/templates/centos.initd.j2 +++ b/ansible/roles/jenkins-worker/templates/centos.initd.j2 @@ -17,11 +17,12 @@ PIDFILE=/var/run/jenkins/$NAME.pid JENKINS_SLAVE_USER="iojs" JENKINS_SLAVE_JAR="/home/{{ server_user }}/slave.jar" JENKINS_SLAVE_LOG="/home/{{ server_user }}/$NAME.log" -JENKINS_SLAVE_ARGS="-Xmx{{ server_ram|default('128m') }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp -secret {{ secret }}" +JENKINS_JAVA_ARGS="-Xmx{{ server_ram|default('128m') }}" +JENKINS_SLAVE_ARGS="-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp -secret {{ secret }}" JENKINS_ENV="JOBS={{ ansible_processor_vcpus }} \ HOME=/home/{{ server_user }} \ - DESTCPU={{ ansible_architecture }} \ - ARCH={{ ansible_architecture }} \ + DESTCPU={{ server_arch | default(ansible_architecture) }} \ + ARCH={{ server_arch | default(ansible_architecture) }} \ JOBS={{ server_jobs | default(ansible_processor_vcpus) }} \ OSTYPE=linux-gnu \ NODE_TEST_DIR=$HOME/tmp \ @@ -43,7 +44,7 @@ slave_start() { mkdir `dirname $PIDFILE` > /dev/null 2>&1 || true chown $JENKINS_SLAVE_USER `dirname $PIDFILE` - runuser -m -l $JENKINS_SLAVE_USER -c "$JENKINS_ENV PATH=$JENKINS_PATH $JAVA -jar $JENKINS_SLAVE_JAR $JENKINS_SLAVE_ARGS > $JENKINS_SLAVE_LOG 2>&1 &" + runuser -m -l $JENKINS_SLAVE_USER -c "$JENKINS_ENV PATH=$JENKINS_PATH $JAVA $JENKINS_JAVA_ARGS -jar $JENKINS_SLAVE_JAR $JENKINS_SLAVE_ARGS > $JENKINS_SLAVE_LOG 2>&1 &" pgrep -f -u $JENKINS_SLAVE_USER $JENKINS_SECRET > $PIDFILE RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCK_FILE