Ansible job definitions for OpenStack projects CI systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pre.yaml 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. - hosts: all
  2. roles:
  3. - role: fetch-zuul-cloner
  4. destination: "/usr/zuul-env/bin/zuul-cloner"
  5. repo_src_dir: "/home/zuul/src/opendev.org"
  6. - legacy-copy-jenkins-scripts
  7. tasks:
  8. - name: Create nodepool directory
  9. file:
  10. path: /etc/nodepool
  11. state: directory
  12. - name: Create nodepool sub_nodes file
  13. copy:
  14. dest: /etc/nodepool/sub_nodes
  15. content: ""
  16. - name: Create nodepool sub_nodes_private file
  17. copy:
  18. dest: /etc/nodepool/sub_nodes_private
  19. content: ""
  20. - name: Populate nodepool sub_nodes file
  21. lineinfile:
  22. path: /etc/nodepool/sub_nodes
  23. line: "{{ hostvars[item]['nodepool']['public_ipv4'] }}"
  24. with_items: "{{ groups['subnodes'] }}"
  25. when: groups['subnodes'] is defined
  26. - name: Populate nodepool sub_nodes_private file
  27. lineinfile:
  28. path: /etc/nodepool/sub_nodes_private
  29. line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}"
  30. with_items: "{{ groups['subnodes'] }}"
  31. when: groups['subnodes'] is defined
  32. - name: Create nodepool primary file
  33. copy:
  34. dest: /etc/nodepool/primary_node_private
  35. content: "{{ hostvars['primary']['nodepool']['private_ipv4'] }}"
  36. when: hostvars['primary'] is defined
  37. - name: Create nodepool node_private for this node
  38. copy:
  39. dest: /etc/nodepool/node_private
  40. content: "{{ nodepool.private_ipv4 }}"
  41. - name: Copy ssh keys to nodepool directory
  42. command: "cp .ssh/{{ item }} /etc/nodepool/{{ item }}"
  43. with_items:
  44. - id_rsa
  45. - id_rsa.pub
  46. - name: Add sudoers role for zuul-sudo-grep.sh
  47. copy:
  48. dest: /etc/sudoers.d/zuul-sudo-grep
  49. content: "zuul ALL = NOPASSWD:/usr/local/jenkins/slave_scripts/zuul-sudo-grep.sh\n"
  50. mode: 0440
  51. become: true
  52. - name: Validate sudoers config after edits
  53. command: "/usr/sbin/visudo -c"
  54. become: true
  55. - name: Show the environment passed in to job shell scripts
  56. shell:
  57. cmd: |
  58. env
  59. executable: /bin/bash
  60. environment: '{{ zuul | zuul_legacy_vars }}'