system-config/playbooks/roles/nodepool-base/tasks/main.yaml

48 lines
1.4 KiB
YAML

- name: Add the nodepool group
group:
name: nodepool
state: present
- name: Add the nodepool user
user:
name: nodepool
group: nodepool
home: /home/nodepool
create_home: yes
shell: /bin/bash
# NOTE(ianw) : A note on testing; we have some configurations for
# system-config-run-nodepool test hosts committed to project-config.
# Since this is a protected repo we can't speculatively test, which is
# why we're just cloning from opendev.org master and not a local
# checkout here. We don't expect the configs to change so this is OK.
- name: Clone the project-config repo for configs
git:
repo: 'https://opendev.org/openstack/project-config'
dest: /opt/project-config
force: yes
- name: Create nodepool config dir
file:
name: /etc/nodepool
state: directory
owner: nodepool
group: nodepool
mode: 0755
- name: Look for a host specific config file
stat:
path: /opt/project-config/nodepool/{{ inventory_hostname }}.yaml
register: host_config_file
- name: Set config file symlink
file:
state: link
src: '{{ host_config_file.stat.exists | ternary(host_config_file.stat.path, "/opt/project-config/nodepool/nodepool.yaml") }}'
dest: /etc/nodepool/nodepool.yaml
- name: Symlink in elements from project-config repo
file:
state: link
src: /opt/project-config/nodepool/elements
dest: /etc/nodepool/elements