Commit 3dca0ff0 authored by Rafael Monnerat's avatar Rafael Monnerat

Includes re6st-conf, slapos node register and imt config

parent 33d4a8dd
......@@ -17,7 +17,7 @@ GetDistro
# Warn users who aren't on an explicitly supported distro, but allow them to
# override check and attempt installation with ``export FORCE=yes``
if [[ ! ${DISTRO} =~ (wheezy) ]]; then
if [[ ! ${DISTRO} =~ (wheezy|trusty|rhel7) ]]; then
echo "WARNING: this script has not been tested on $DISTRO"
if [[ "$FORCE" != "yes" ]]; then
die $LINENO "If you wish to run this script anyway run with FORCE=yes"
......@@ -66,6 +66,11 @@ fi
is_package_installed ansible || install_package ansible
if is_ubuntu && [[ $DISTRO == "trusty" ]]; then
is_package_installed python-apt || install_package python-apt
is_package_installed python-pycurl || install_package python-pycurl
fi
exit
rm -rf /tmp/$PLAYBOOK_FILENAME /tmp/$PLAYBOOK_BASE_FOLDER
wget $PLAYBOOK_REPOSITORY_URL -O /tmp/$PLAYBOOK_FILENAME
......
- name: a play that runs entirely on the ansible host
hosts: 127.0.0.1
connection: local
roles:
- repository
- package
- re6stnet
- slapos
vars:
re6st_registry_url: http://re6stnet.imt.vifib.com/
base_open_build_url: http://download.opensuse.org/repositories/home:/VIFIBnexedi/
package_dict:
re6st-node: latest
slapos-node: latest
slapos_master_url: https://slap.imt.vifib.com/
slapos_web_master_url: https://imt.vifib.com/
vars_prompt:
- name: "re6sttoken"
prompt: "If you have re6st token if you have (ignore if you already have a configured re6st):"
private: no
default: "notoken"
- name: "computer_name"
prompt: "What is this computer name? (ignore if you already have a configured re6st and slapos):"
private: no
default: "noname"
- name: "slapostoken"
prompt: "If you have slapos token if you have (ignore if you already have a configured slapos):"
private: no
default: "notoken"
- name: Install slapos-node on Debian
apt: name=slapos-node state=present update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian"
- name: Install re6stnet on Debian
apt: name=re6stnet state=present update_cache=yes cache_valid_time=3600
- name: Install packages using apt
apt: name={{ item.key }} state={{ item.value }} update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian"
with_dict: package_dict
- name: Install re6stnet on CentOS
yum: name=re6st-node state=present
when: ansible_os_family == "RedHat"
- name: Install slapos on CentOS
yum: name=slapos-node state=present
yum: name={{ item }} state={{ item.value.state }}
when: ansible_os_family == "RedHat"
with_dict: package_dict
- name: Check if configuration exists already
stat: path=/etc/re6stnet/re6stnet.conf
register: re6stnet_conf
- name: Configure Re6st with re6st-conf
shell: "re6st-conf --registry {{ re6st_registry_url }} --token {{ re6sttoken }} -r title {{ computer_name }} -d /etc/re6stnet"
when: re6stnet_conf.stat.exists == False and "{{ re6sttoken }}" != "notoken" and "{{ computer_name }}" != "noname"
- name: Start re6st-node service
service: name=re6st-node state=started enabled=yes
when: re6stnet_conf.stat.exists == True
......@@ -15,10 +15,18 @@
apt_repository: repo='deb {{ base_open_build_url }}/Debian_6.0/ ./' state=present
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "6"
- name: Install Ubuntu 14.04 repository key
apt_key: url={{ base_open_build_url }}/xUbuntu_14.04/Release.key state=present
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04"
- name: Install Ubuntu 14.04 repository
apt_repository: repo='deb {{ base_open_build_url }}/xUbuntu_14.04/ ./' state=present
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04"
- name: Install CentOS 7 Repository
get_url: url=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_7/home:VIFIBnexedi.repo dest=/etc/yum.repos.d/slapos.repo mode=0440
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
- name: Install CentOS 7 RPM Key
rpm_key: state=present key=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_CentOS-6/repodata/repomd.xml.key
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
\ No newline at end of file
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
- name: Check if configuration exists already
stat: path=/etc/opt/slapos/slapos.cfg
register: slapos_cfg
- name: Configure SlapOS with slapos node register
shell: "slapos node register --token {{ slapostoken }} --master-url {{ slapos_master_url }} --master-url-web {{ slapos_web_master_url }} {{ computer_name }}"
when: slapos_cfg.stat.exists == False and "{{ slapostoken }}" != "notoken" and "{{ computer_name }}" != "noname"
- name: Run slapos format for initial bootstrap
service: "slapos node format --now"
when: slapos_cfg.stat.exists == False and "{{ slapostoken }}" != "notoken" and "{{ computer_name }}" != "noname"
......@@ -4,4 +4,22 @@
roles:
- repository
- package
- re6stnet
vars:
re6st_registry_url: https://re6stnet.nexedi.com/
base_open_build_url: http://download.opensuse.org/repositories/home:/VIFIBnexedi/
package_list:
- re6st-node
- slapos-node
vars_prompt:
- name: "re6sttoken"
prompt: "If you have re6st token if you have (ignore if you already have a configured re6st):"
private: no
default: "notoken"
- name: "computer_name"
prompt: "What is this computer name? (ignore if you already have a configured re6st and slapos):"
private: no
default: "noname"
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