Commit 9b7ee87e authored by Rafael Monnerat's avatar Rafael Monnerat

Merge branch 'master' into 'master'

Improvemnts for Centos

See merge request !7
parents 23ff603b a56f07e3
......@@ -3,7 +3,7 @@
connection: local
roles:
- vm-bootstrap
- { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp
- { role: vm-disks, vd_disk: b, data_n: 1 }
- { role: vm-disks, vd_disk: c, data_n: 2 }
......
......@@ -3,6 +3,6 @@
connection: local
roles:
- vm-bootstrap
- { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp
- vm-cloudera-manager
{{ lookup('file', 'roles/install-script/files/function-common') }}
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
# XXX a bit brutal but otherwise it cannot work, without tty enabled.
sed -i "/requiretty/d" /etc/sudoers
# Include Additional Functions
function download_playbook {
if [ ! -f /etc/opt/slapcache.cfg ]; then
......@@ -92,6 +94,7 @@ EOF
fi
if is_fedora && [[ $DISTRO == "rhel6" ]]; then
sed -i "/requiretty/d" /etc/sudoers
if sudo yum repolist enabled epel | grep -q 'epel'; then
uninstall_package epel-release || true
fi
......
---
- name: Install ntp
apt: name=ntp state=latest
apt: name=ntp state=latest update_cache=no
when: ansible_os_family == "Debian"
- name: Install ntp
yum: name=ntp state=latest
yum: name=ntp state=latest update_cache=no
when: ansible_os_family == "RedHat"
- name: ensure ntp is runing
......@@ -13,4 +13,4 @@
- name: ensure ntp is runing (RedHat)
service: name=ntpd state=running enabled=yes
when: ansible_os_family == "RedHat"
\ No newline at end of file
when: ansible_os_family == "RedHat"
---
- name: restart ssh
service: name=ssh state=restarted
- name: restart ssh
service: name=ssh state=restarted
when: ansible_os_family == "Debian"
- name: restart sshd
service: name=sshd state=restarted
when: ansible_os_family == "RedHat"
......@@ -23,3 +23,4 @@
- include: user.yml
- include: sudo.yml
- include: ssh.yml
- include: rerun.yml
---
- name: Add startup script
template: src=start-script.j2 dest=/usr/local/bin/vm-bootstrap-update mode=755
- name: Add a periodical update on the VM
cron: name="Update vm bootstrap"
minute="*/12"
job="/usr/local/bin/vm-bootstrap-update"
- name: Check if /opt/slapos.playbook already exists
file: path=/opt/slapos.playbook/ state=directory
- name: check if playbook is there
stat: path=/opt/slapos.playbook/playbook.tar.gz
register: playbook_archive
- name: Download playbook
shell: slapcache-download --destination=playbook.tar.gz
when: playbook_archive.stat.exists == False
args:
chdir: /opt/slapos.playbook
- name: Copy slapos.playbook
shell: tar -xzvf /opt/slapos.playbook/playbook.tar.gz
when: playbook_archive.stat.exists == False
args:
chdir: /opt/slapos.playbook
......@@ -25,8 +25,10 @@
lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (?!no)" line="PermitRootLogin no"
notify:
- restart ssh
- restart sshd
- name: update /etc/ssh/sshd_config
lineinfile: dest=/etc/ssh/sshd_config line="PermitRootLogin no"
notify:
- restart ssh
- restart sshd
#!/bin/bash
# Reruns the ansible playbook, does nothing else
cd /opt/slapos.playbook
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
......@@ -19,10 +19,10 @@
raw: "apt-get install -y python-apt"
- name: install sudo
apt: name=sudo state=latest
apt: name=sudo state=latest update_cache=no
- name: install tree
apt: name=tree state=latest
apt: name=tree state=latest update_cache=no
- name: install curl
apt: name=curl state=latest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment