Skip to content

Instantly share code, notes, and snippets.

@elyezer
Created July 5, 2017 15:43
Show Gist options
  • Save elyezer/12224782aa9f79af82223188214b1905 to your computer and use it in GitHub Desktop.
Save elyezer/12224782aa9f79af82223188214b1905 to your computer and use it in GitHub Desktop.
- name: Create nodepool group.
group:
name: nodepool
- name: Create nodepool user.
user:
createhome: yes
group: nodepool
home: /var/lib/nodepool
name: nodepool
- name: Install required packages.
package:
name: "{{ item }}"
state: installed
with_items:
- gcc
- gcc-c++
- libffi-devel
- libselinux-python
- libxml2-devel
- libxslt-devel
- openssl-devel
- postgresql-server
- python-devel
- python-pip
- python-psycopg2
- redhat-rpm-config
- zlib-devel
- zookeeper
# TODO: setup and configure Zookeeper
- name: Enable postgresql-server service.
systemd:
enabled: yes
name: postgresql
state: started
- name: Initialize postgresql.
command: postgresql-setup initdb
args:
creates: /var/lib/pgsql/data/
- name: Create nodepool database.
become_user: postgres
postgresql_db:
name: nodepool
- name: Create nodepool database role.
become_user: postgres
postgresql_user:
db: nodepool
name: nodepool
- name: Create zookeeper configuration file.
copy:
dest: /etc/zookeeper/zoo.cfg
mode: 0644
remote_src: yes
src: /etc/zookeeper/zoo_sample.cfg
- name: Enable zookeeper service.
systemd:
enabled: yes
name: zookeeper
state: started
- name: Install nodepool using pip.
pip:
name: nodepool
- name: Create required directories.
file:
group: nodepool
owner: nodepool
path: "{{ item }}"
state: directory
with_items:
- /etc/nodepool
- /opt/nodepool/images
- /opt/nodepool/tmp
- /var/log/nodepool
- /var/log/nodepool/images
- name: Install nodepool configuration.
copy:
dest: /etc/nodepool/nodepool.yaml
group: nodepool
mode: 0644
owner: nodepool
src: nodepool.yaml
register: nodepool_file_nodepool_yaml
- name: Install nodepool secure configuration.
copy:
dest: /etc/nodepool/secure.conf
group: nodepool
mode: 0600
owner: nodepool
src: secure.conf
register: nodepool_file_secure_conf
- name: Install builder logging configuration file.
copy:
dest: /etc/nodepool/builder-logging.conf
group: nodepool
mode: 0644
owner: nodepool
src: builder-logging.conf
register: nodepool_file_builder_logging_conf
- name: Install nodepoold logging configuration file.
copy:
dest: /etc/nodepool/nodepoold-logging.conf
group: nodepool
mode: 0644
owner: nodepool
src: nodepoold-logging.conf
register: nodepool_file_nodepoold_logging_conf
- name: Install nodepool-builder service script into place.
copy:
dest: /etc/systemd/system/nodepool-builder.service
group: root
mode: 0644
owner: root
src: nodepool-builder.service
register: nodepool_file_nodepool_builder_service
- name: Install nodepoold service script into place.
copy:
dest: /etc/systemd/system/nodepoold.service
group: root
mode: 0644
owner: root
src: nodepoold.service
register: nodepool_file_nodepoold_service
- name: Enable nodepool-builder service.
systemd:
daemon_reload: yes
enabled: yes
name: nodepool-builder
state: started
register: nodepool_service_nodepool_builder
- name: Enable nodepoold service.
systemd:
daemon_reload: yes
enabled: yes
name: nodepoold
state: started
register: nodepool_service_nodepoold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment