Skip to content

Instantly share code, notes, and snippets.

@PFortin93
Created April 3, 2017 21:27
Show Gist options
  • Select an option

  • Save PFortin93/3848fdb91d2a555e0bed02b4cabdfb77 to your computer and use it in GitHub Desktop.

Select an option

Save PFortin93/3848fdb91d2a555e0bed02b4cabdfb77 to your computer and use it in GitHub Desktop.
Ansible setup script for Elastic node configured against Spacewalk
---
- hosts: spacewalk_register
tasks:
- name: Install Spacewalk Client Repo
yum: name=http://yum.spacewalkproject.org/2.5-client/RHEL/6/x86_64/spacewalk-client-repo-2.5-3.el6.noarch.rpm state=present
ignore_errors: yes
- name: Install rhn client tools
yum: name=rhn-client-tools state=present
ignore_errors: yes
- name: Install rhn check
yum: name=rhn-check state=present
ignore_errors: yes
- name: Install rhn setup
yum: name=rhn-setup state=present
ignore_errors: yes
- name: Install rhnsd
yum: name=rhnsd state=present
ignore_errors: yes
- name: Install osad
yum: name=osad state=present
ignore_errors: yes
- name: Install m2crypto
yum: name=m2crypto state=present
ignore_errors: yes
- name: Install yum rhn plugin
yum: name=yum-rhn-plugin state=present
ignore_errors: yes
- name: Install redhat config tool
yum: name=rhncfg-client state=present
ignore_errors: yes
- name: Install redhat config actions
yum: name=rhncfg-actions state=present
ignore_errors: yes
- name: Install redhat config manager
yum: name=rhncfg-management state=present
ignore_errors: yes
- name: Install Spacewalk Cert
yum: name=http://spacewalk.DOMAIN.com/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm state=present
ignore_errors: yes
- name: Join to spacewalk server Spacewalk
shell: rhnreg_ks --serverUrl=https://spacewalk.DOMAIN.com/XMLRPC --activationkey=1-smashfly-elastic --force
sudo: yes
- name: Start Spacewalk Daemon
service: name=rhnsd state=started enabled=yes
sudo: yes
- name: Create cronjob to check in with
cron: name="RHN checkin" minute="0" hour="*" job="/usr/sbin/rhn_check >/dev/null 2>&1"
sudo: yes
- name: Check in with RHN
shell: /usr/sbin/rhn_check
sudo: yes
- name: Remove Spacewalk Client Repo
shell: /bin/rpm -e spacewalk-client-repo-2.5-3.el6.noarch
ignore_errors: yes
- name: Check in with RHN
shell: /usr/bin/rhn-actions-control --enable-all
sudo: yes
- name: Chown var elastic
shell: /bin/chown -R elasticsearch:root /var/elasticsearch
sudo: yes
- name: set autostart on Elastic
shell: /sbin/chkconfig elasticsearch on
sudo: yes
- name: Install elasticsearch-HQ monitoring plugin
shell: /usr/share/elasticsearch/bin/plugin install royrusso/elasticsearch-HQ
sudo: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment