From 719a6ab2054fe30c386bbab3a755e7d7bcc12526 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Fri, 15 May 2020 09:36:32 -0400 Subject: [PATCH] Support OpenSUSE Leap static slaves too These variables should be passed on the command line when configuring or reconfiguring a static Jenkins slave. Signed-off-by: David Galloway --- ansible/examples/slave_static.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ansible/examples/slave_static.yml b/ansible/examples/slave_static.yml index 70717b7f..f32f7f4c 100644 --- a/ansible/examples/slave_static.yml +++ b/ansible/examples/slave_static.yml @@ -28,6 +28,8 @@ - nodename: '{{ ansible_hostname }}' - labels: '{{ labels }}' - use_jnlp: true + - osc_user: 'username' + - osc_pass: 'password' tasks: - name: create a {{ jenkins_user }} user @@ -79,6 +81,29 @@ - name: ensure the build dir exists file: path=/home/{{ jenkins_user }}/build state=directory owner={{ jenkins_user }} + - name: Create .config/osc directory + file: + path: "/home/{{ jenkins_user }}/.config/osc" + state: directory + owner: "{{ jenkins_user }}" + when: ansible_pkg_mgr == "zypper" + + - name: Add oscrc file + blockinfile: + create: yes + block: | + [general] + apiurl = https://api.opensuse.org + #build-root = /var/tmp/build-root/%(repo)s-%{arch)s + + [https://api.opensuse.org] + user = {{ osc_user }} + pass = {{ osc_pass }} + + path: "/home/{{ jenkins_user }}/.config/osc/oscrc" + become_user: "{{ jenkins_user }}" + when: ansible_pkg_mgr == "zypper" + - name: ensure the home dir has the right owner permissions file: path=/home/{{ jenkins_user }} state=directory owner={{ jenkins_user }} group={{ jenkins_user }} recurse=yes follow=no -- 2.39.5