From 842f2416183778a4c0052edc338708fb180d1941 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 9 Feb 2018 08:02:11 +0100 Subject: [PATCH] Consolidate legacy scripts Create new role legacy-copy-jenkins-scripts to populate /usr/local/jenkins/slave_scripts. Move existing scripts from playbooks/legacy to the files directory of the new role. Use the new role instead of a task. Change-Id: I2dcfdf46f0d953afa8100557488a393962dba9bb --- playbooks/legacy/pre.yaml | 11 +---------- roles/legacy-copy-jenkins-scripts/README.rst | 4 ++++ .../files}/install-distro-packages.sh | 0 .../files}/zuul-sudo-grep.sh | 0 roles/legacy-copy-jenkins-scripts/tasks/main.yaml | 10 ++++++++++ 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 roles/legacy-copy-jenkins-scripts/README.rst rename {playbooks/legacy => roles/legacy-copy-jenkins-scripts/files}/install-distro-packages.sh (100%) rename {playbooks/legacy => roles/legacy-copy-jenkins-scripts/files}/zuul-sudo-grep.sh (100%) create mode 100644 roles/legacy-copy-jenkins-scripts/tasks/main.yaml diff --git a/playbooks/legacy/pre.yaml b/playbooks/legacy/pre.yaml index ebc41509..684f20a2 100644 --- a/playbooks/legacy/pre.yaml +++ b/playbooks/legacy/pre.yaml @@ -3,6 +3,7 @@ - role: fetch-zuul-cloner destination: "/usr/zuul-env/bin/zuul-cloner" repo_src_dir: "/home/zuul/src/git.openstack.org" + - legacy-copy-jenkins-scripts tasks: - name: Create nodepool directory @@ -44,16 +45,6 @@ - id_rsa - id_rsa.pub - - name: Copy files to the script dir on the node - copy: - dest: '/usr/local/jenkins/slave_scripts/{{ item }}' - src: '{{ item }}' - mode: 0755 - with_items: - - install-distro-packages.sh - - zuul-sudo-grep.sh - become: true - - name: Add sudoers role for zuul-sudo-grep.sh copy: dest: /etc/sudoers.d/zuul-sudo-grep diff --git a/roles/legacy-copy-jenkins-scripts/README.rst b/roles/legacy-copy-jenkins-scripts/README.rst new file mode 100644 index 00000000..9f48684c --- /dev/null +++ b/roles/legacy-copy-jenkins-scripts/README.rst @@ -0,0 +1,4 @@ +Copy scripts to ``/usr/jenkins/slave_scripts`` directory on remote hosts. + +.. note:: This role is deprecated and only exists for transition purposes. + It should not be used for new jobs. diff --git a/playbooks/legacy/install-distro-packages.sh b/roles/legacy-copy-jenkins-scripts/files/install-distro-packages.sh similarity index 100% rename from playbooks/legacy/install-distro-packages.sh rename to roles/legacy-copy-jenkins-scripts/files/install-distro-packages.sh diff --git a/playbooks/legacy/zuul-sudo-grep.sh b/roles/legacy-copy-jenkins-scripts/files/zuul-sudo-grep.sh similarity index 100% rename from playbooks/legacy/zuul-sudo-grep.sh rename to roles/legacy-copy-jenkins-scripts/files/zuul-sudo-grep.sh diff --git a/roles/legacy-copy-jenkins-scripts/tasks/main.yaml b/roles/legacy-copy-jenkins-scripts/tasks/main.yaml new file mode 100644 index 00000000..6861eddb --- /dev/null +++ b/roles/legacy-copy-jenkins-scripts/tasks/main.yaml @@ -0,0 +1,10 @@ +- name: Copy files to the slave_script dir on the node + copy: + # Ansible will create this folder automatically + dest: '/usr/local/jenkins/slave_scripts/' + src: '{{ item }}' + mode: 0755 + with_items: + - install-distro-packages.sh + - zuul-sudo-grep.sh + become: true