From: David Galloway Date: Thu, 3 Aug 2017 15:35:48 +0000 (-0400) Subject: ansible: Rename ansible-reserved port var to jenkins_port X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3dded47f6790cf797fc5f4ea3ec9a3d004d03de3;p=ceph-build.git ansible: Rename ansible-reserved port var to jenkins_port Signed-off-by: David Galloway --- diff --git a/ansible/examples/master.yml b/ansible/examples/master.yml index 6f3a792f..6216f9a8 100644 --- a/ansible/examples/master.yml +++ b/ansible/examples/master.yml @@ -36,7 +36,7 @@ - 'postbuildscript' - 'jobConfigHistory' - - port: 8080 + - jenkins_port: 8080 - prefix: '/build' - xmx: 8192 # Email support diff --git a/ansible/roles/ansible-jenkins/defaults/main.yml b/ansible/roles/ansible-jenkins/defaults/main.yml index c8e3ee83..92034a07 100644 --- a/ansible/roles/ansible-jenkins/defaults/main.yml +++ b/ansible/roles/ansible-jenkins/defaults/main.yml @@ -1,6 +1,6 @@ --- placeholder: 'placeholder' -port: 8080 +jenkins_port: 8080 # plugins: # - 'ldap' # - 'github' diff --git a/ansible/roles/ansible-jenkins/handlers/main.yml b/ansible/roles/ansible-jenkins/handlers/main.yml index 6ea5b8f3..759b833a 100644 --- a/ansible/roles/ansible-jenkins/handlers/main.yml +++ b/ansible/roles/ansible-jenkins/handlers/main.yml @@ -1,6 +1,6 @@ # Safe-restart Jenkins - name: restart jenkins - command: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ port }} safe-restart + command: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ jenkins_port }} safe-restart - name: restart nginx service: diff --git a/ansible/roles/ansible-jenkins/tasks/config.yml b/ansible/roles/ansible-jenkins/tasks/config.yml index efdc8fad..4dec5628 100644 --- a/ansible/roles/ansible-jenkins/tasks/config.yml +++ b/ansible/roles/ansible-jenkins/tasks/config.yml @@ -4,7 +4,7 @@ lineinfile: dest: '{{ jenkins.apt.config_file }}' regexp: ^HTTP_PORT= - line: HTTP_PORT={{port}} + line: HTTP_PORT={{jenkins_port}} backrefs: yes register: config_changed @@ -73,7 +73,7 @@ - name: "{{ startup_delay_s | default(10) }}s delay while starting Jenkins" wait_for: host: localhost - port: '{{ port }}' + port: '{{ jenkins_port }}' delay: '{{ startup_delay_s | default(10) }}' when: jenkins_install.changed or config_changed.changed @@ -84,7 +84,7 @@ - name: Get Jenkins CLI get_url: - url: http://localhost:{{ port }}/jnlpJars/jenkins-cli.jar + url: http://localhost:{{ jenkins_port }}/jnlpJars/jenkins-cli.jar dest: '{{ jenkins.cli_dest }}' mode: 0440 register: jenkins_local_cli @@ -103,7 +103,7 @@ register: jenkins_updates - name: Update-center Jenkins - shell: "cat {{ jenkins.updates_dest }} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:{{ port }}/updateCenter/byId/default/postBack" + shell: "cat {{ jenkins.updates_dest }} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://localhost:{{ jenkins_port }}/updateCenter/byId/default/postBack" when: jenkins_updates.changed notify: - 'restart jenkins' diff --git a/ansible/roles/ansible-jenkins/tasks/plugins.yml b/ansible/roles/ansible-jenkins/tasks/plugins.yml index af68e6d9..0077aa01 100644 --- a/ansible/roles/ansible-jenkins/tasks/plugins.yml +++ b/ansible/roles/ansible-jenkins/tasks/plugins.yml @@ -1,22 +1,22 @@ --- - name: List plugins - shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ port }} list-plugins | cut -f 1 -d ' ' + shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ jenkins_port }} list-plugins | cut -f 1 -d ' ' when: plugins is defined register: plugins_installed - name: Install/update plugins - shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ port }} install-plugin {{ item }} + shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ jenkins_port }} install-plugin {{ item }} when: plugins_installed.changed and plugins_installed.stdout.find('{{ item }}') == -1 with_items: plugins notify: - 'restart jenkins' - name: List plugins to be updated - shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ port }} list-plugins | grep ')$' | cut -f 1 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' + shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ jenkins_port }} list-plugins | grep ')$' | cut -f 1 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' register: plugins_updates - name: Update plugins - shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ port }} install-plugin {{ item }} + shell: java -jar {{ jenkins.cli_dest }} -s http://localhost:{{ jenkins_port }} install-plugin {{ item }} with_items: plugins_updates.stdout.split() when: plugins_updates.stdout != '' ignore_errors: yes