2017-09-22 11:04:05 -05:00
|
|
|
- hosts: all
|
2017-10-18 11:19:25 -04:00
|
|
|
roles:
|
|
|
|
- role: fetch-zuul-cloner
|
|
|
|
destination: "/usr/zuul-env/bin/zuul-cloner"
|
|
|
|
repo_src_dir: "/home/zuul/src/git.openstack.org"
|
2018-02-09 08:02:11 +01:00
|
|
|
- legacy-copy-jenkins-scripts
|
2017-10-18 11:19:25 -04:00
|
|
|
|
2017-09-22 11:04:05 -05:00
|
|
|
tasks:
|
|
|
|
- name: Create nodepool directory
|
|
|
|
file:
|
|
|
|
path: /etc/nodepool
|
|
|
|
state: directory
|
2017-10-09 11:42:59 +00:00
|
|
|
- name: Create nodepool sub_nodes file
|
|
|
|
copy:
|
|
|
|
dest: /etc/nodepool/sub_nodes
|
|
|
|
content: ""
|
|
|
|
- name: Create nodepool sub_nodes_private file
|
2017-09-22 11:04:05 -05:00
|
|
|
copy:
|
|
|
|
dest: /etc/nodepool/sub_nodes_private
|
|
|
|
content: ""
|
2017-10-06 13:54:27 -05:00
|
|
|
- name: Populate nodepool sub_nodes file
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/nodepool/sub_nodes
|
|
|
|
line: "{{ hostvars[item]['nodepool']['public_ipv4'] }}"
|
|
|
|
with_items: "{{ groups['subnodes'] }}"
|
|
|
|
when: groups['subnodes'] is defined
|
|
|
|
- name: Populate nodepool sub_nodes_private file
|
2017-09-22 11:04:05 -05:00
|
|
|
lineinfile:
|
|
|
|
path: /etc/nodepool/sub_nodes_private
|
|
|
|
line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}"
|
|
|
|
with_items: "{{ groups['subnodes'] }}"
|
|
|
|
when: groups['subnodes'] is defined
|
|
|
|
- name: Create nodepool primary file
|
|
|
|
copy:
|
|
|
|
dest: /etc/nodepool/primary_node_private
|
|
|
|
content: "{{ hostvars['primary']['nodepool']['private_ipv4'] }}"
|
2017-09-26 15:20:19 -05:00
|
|
|
when: hostvars['primary'] is defined
|
2017-10-06 13:54:27 -05:00
|
|
|
- name: Create nodepool node_private for this node
|
|
|
|
copy:
|
|
|
|
dest: /etc/nodepool/node_private
|
|
|
|
content: "{{ nodepool.private_ipv4 }}"
|
2017-09-22 11:04:05 -05:00
|
|
|
- name: Copy ssh keys to nodepool directory
|
|
|
|
command: "cp .ssh/{{ item }} /etc/nodepool/{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- id_rsa
|
|
|
|
- id_rsa.pub
|
2017-09-28 16:24:32 -05:00
|
|
|
|
|
|
|
- name: Add sudoers role for zuul-sudo-grep.sh
|
|
|
|
copy:
|
|
|
|
dest: /etc/sudoers.d/zuul-sudo-grep
|
2017-09-28 17:57:43 -05:00
|
|
|
content: "zuul ALL = NOPASSWD:/usr/local/jenkins/slave_scripts/zuul-sudo-grep.sh\n"
|
2017-09-28 16:24:32 -05:00
|
|
|
mode: 0440
|
|
|
|
become: true
|
|
|
|
|
2017-09-28 17:57:43 -05:00
|
|
|
- name: Validate sudoers config after edits
|
|
|
|
command: "/usr/sbin/visudo -c"
|
|
|
|
become: true
|
|
|
|
|
2017-10-02 16:34:36 -05:00
|
|
|
- name: Show the environment passed in to job shell scripts
|
|
|
|
shell:
|
|
|
|
cmd: |
|
|
|
|
env
|
|
|
|
executable: /bin/bash
|
|
|
|
environment: '{{ zuul | zuul_legacy_vars }}'
|