错误消息:在可播放的剧本中无法获取CSRF

时间:2018-09-14 10:45:18

标签: jenkins ansible jenkins-plugins

我试图通过在localhost(http://localhost:8080/)上创建Jenkins作业来安装Jenkins插件。在这项工作中,我编写了一个shell命令,

ansible-playbook -K scripts/ansible/setup.yml

它会为每个要安装的插件提供错误消息。

我的Yaml文件包含以下代码:

---
- hosts: localhost
  become: false
  tasks:
  - name: Install plugin
    set_fact:
      jenkins_admin_password: "XXXXXXXXXXX"
      no_log: True

  - name: Download current plugin updates from Jenkins update site
    get_url:
      url: http://updates.jenkins-ci.org/update-center.json
      dest: "/var/lib/jenkins/updates/default.json"
      owner: jenkins
      group: jenkins
      mode: 0440

  - name: Remove first and last line from json file
    replace:
      path: "/var/lib/jenkins/updates/default.json"
      regexp: "1d;$d"

  - name: Install Jenkins plugins using password.
    jenkins_plugin:
      name: "{{ item }}"
      jenkins_home: "/var/lib/jenkins/"
      url_username: "Test"
      url_password: "XXXXXXXXXXX"
      timeout: "30"
      updates_expiration: "86400"
      url: "http://localhost:8080"
      with_dependencies: "yes"
    with_items:
      - "git"
      - "copyArtifacts"
      - "github-branch-source"
      - "github"
    when: jenkins_admin_password != ""
    notify: restart jenkins

我怎么了?

0 个答案:

没有答案