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 @@ ...@@ -3,7 +3,7 @@
connection: local connection: local
roles: roles:
- vm-bootstrap - { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp - ntp
- { role: vm-disks, vd_disk: b, data_n: 1 } - { role: vm-disks, vd_disk: b, data_n: 1 }
- { role: vm-disks, vd_disk: c, data_n: 2 } - { role: vm-disks, vd_disk: c, data_n: 2 }
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
connection: local connection: local
roles: roles:
- vm-bootstrap - { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp - ntp
- vm-cloudera-manager - vm-cloudera-manager
{{ lookup('file', 'roles/install-script/files/function-common') }} {{ lookup('file', 'roles/install-script/files/function-common') }}
export PATH=$PATH:/usr/local/bin:/usr/local/sbin 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 # Include Additional Functions
function download_playbook { function download_playbook {
if [ ! -f /etc/opt/slapcache.cfg ]; then if [ ! -f /etc/opt/slapcache.cfg ]; then
...@@ -92,6 +94,7 @@ EOF ...@@ -92,6 +94,7 @@ EOF
fi fi
if is_fedora && [[ $DISTRO == "rhel6" ]]; then if is_fedora && [[ $DISTRO == "rhel6" ]]; then
sed -i "/requiretty/d" /etc/sudoers
if sudo yum repolist enabled epel | grep -q 'epel'; then if sudo yum repolist enabled epel | grep -q 'epel'; then
uninstall_package epel-release || true uninstall_package epel-release || true
fi fi
......
--- ---
- name: Install ntp - name: Install ntp
apt: name=ntp state=latest apt: name=ntp state=latest update_cache=no
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Install ntp - name: Install ntp
yum: name=ntp state=latest yum: name=ntp state=latest update_cache=no
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: ensure ntp is runing - name: ensure ntp is runing
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
- name: ensure ntp is runing (RedHat) - name: ensure ntp is runing (RedHat)
service: name=ntpd state=running enabled=yes service: name=ntpd state=running enabled=yes
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
\ No newline at end of file
--- ---
- name: restart ssh - name: restart ssh
service: name=ssh state=restarted 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 @@ ...@@ -23,3 +23,4 @@
- include: user.yml - include: user.yml
- include: sudo.yml - include: sudo.yml
- include: ssh.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 @@ ...@@ -25,8 +25,10 @@
lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (?!no)" line="PermitRootLogin no" lineinfile: dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (?!no)" line="PermitRootLogin no"
notify: notify:
- restart ssh - restart ssh
- restart sshd
- name: update /etc/ssh/sshd_config - name: update /etc/ssh/sshd_config
lineinfile: dest=/etc/ssh/sshd_config line="PermitRootLogin no" lineinfile: dest=/etc/ssh/sshd_config line="PermitRootLogin no"
notify: notify:
- restart ssh - 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 @@ ...@@ -19,10 +19,10 @@
raw: "apt-get install -y python-apt" raw: "apt-get install -y python-apt"
- name: install sudo - name: install sudo
apt: name=sudo state=latest apt: name=sudo state=latest update_cache=no
- name: install tree - name: install tree
apt: name=tree state=latest apt: name=tree state=latest update_cache=no
- name: install curl - name: install curl
apt: name=curl state=latest 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