Skip to content
Snippets Groups Projects
Commit 1c9bdbbd authored by Andreas Hamacher's avatar Andreas Hamacher Committed by Jafar Lie
Browse files

Ubuntu20cicd

parent 0e90e605
No related branches found
No related tags found
No related merge requests found
variables:
GIT_SUBMODULE_STRATEGY: recursive
STACKNAME: CICD_${CI_PROJECT_NAME}_$CI_COMMIT_REF_NAME
STACKNAME: CICD-${CI_PROJECT_NAME}-$CI_COMMIT_REF_NAME
NECTAR_ALLOCATION: HPCCICD
ANSIBLE_HOST_KEY_CHECKING: "False"
DEFAULT_PATH: "CICD"
......
......@@ -3,13 +3,12 @@ heat_template_version: 2013-05-23
description: "A simple template to boot a cluster of desktops (LoginNode, ManagementNodes and Desktop Nodes)"
# avz parameters disabled. they are working but I want just more options than monash-02. I would like to have a parameter that says "I don't care"
#This requires gc_secgroups to be called beforehand
parameters:
ubuntu_1804_image_id:
ubuntu_2004_image_id:
type: string
label: Image ID
description: Ubuntu Image
default: 99d9449a-084f-4901-8bd8-c04aebd589ca
default: f8b79936-6616-4a22-b55d-0d0a1d27bceb
centos_7_image_id:
type: string
label: Image ID
......@@ -149,7 +148,7 @@ resources:
type: My::Server::MgmtNode
properties:
#avz: { get_param: avz }
image: { get_param: ubuntu_1804_image_id }
image: { get_param: ubuntu_2004_image_id }
ansible_ssh_user: ubuntu
ansible_host_groups: [ ManagementNodes, UbuntuNodes ]
mynodename:
......@@ -188,7 +187,7 @@ resources:
properties:
#availability_zone: { get_param: avz }
flavor: m3.xsmall
image: { get_param: ubuntu_1804_image_id }
image: { get_param: ubuntu_2004_image_id }
key_name: { get_param: ssh_key }
name:
list_join: [ '-', [ { get_param: "OS::stack_name" }, 'loginU%index%' ]]
......@@ -230,7 +229,7 @@ resources:
properties:
#availability_zone: { get_param: avz }
flavor: m3.xsmall
image: { get_param: ubuntu_1804_image_id }
image: { get_param: ubuntu_2004_image_id }
key_name: { get_param: ssh_key }
name:
list_join: [ '-', [ { get_param: "OS::stack_name" }, 'computeU%index%' ]]
......@@ -272,7 +271,7 @@ resources:
properties:
#availability_zone: { get_param: avz }
flavor: mon.c10r35.gpu-k2
image: { get_param: ubuntu_1804_image_id }
image: { get_param: ubuntu_2004_image_id }
key_name: { get_param: ssh_key }
name:
list_join: [ '-', [ { get_param: "OS::stack_name" }, 'gpudesktopu%index%' ]]
......
#!/usr/bin/python3
import sys
import json
import socket
filename = sys.argv[1]
try:
domain = sys.argv[2]
except IndexError:
domain = None
f=open(filename,'r')
s=f.read()
d=json.loads(s)
f.close()
hosts={}
for group in list(d['groups'].keys()):
i=0
for h in d['groups'][group]:
name = d['hostvars'][h]['ansible_hostname']
name = h
if not domain:
hosts[h] = [name]
else:
hosts[h] = ['%s.%s %s'%(name,domain,name)]
for h in sorted(hosts.keys()):
if h in d['hostvars']:
for addr in d['hostvars'][h]['ansible_all_ipv4_addresses']:
if "172.16.200" in addr:
string="%s"%addr
for name in hosts[h]:
string=string+" %s"%(name)
print(string)
for h in sorted(hosts.keys()):
if h in d['hostvars']:
string="%s"%(d['hostvars'][h]['ansible_default_ipv4']['address'])
for name in hosts[h]:
string=string+" %s"%(name)
print(string)
for h in sorted(hosts.keys()):
if h in d['hostvars']:
if 'ansible_tun0' in d['hostvars'][h]:
string="%s"%(d['hostvars'][h]['ansible_tun0']['ipv4']['address'])
string=string+" %s-vpn"%h
print(string)
......@@ -4,6 +4,11 @@
- name: copy script
copy: src=makehosts.py dest=/tmp/makehosts.py mode=755
when: ansible_os_family == "RedHat"
- name: copy script
copy: src=makehostsp3.py dest=/tmp/makehosts.py mode=755
when: ansible_os_family == "Debian"
- name: make hosts data
command: /tmp/makehosts.py /tmp/groups {{ domain }}
......
......@@ -61,3 +61,7 @@
mysql_user: name={{ mysql_user_name }} host={{ item }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
with_items: "{{ mysql_user_hosts_group }}"
when: mysql_user_hosts_group is defined
- name: "Giving priviliges to user with item.domain"
mysql_user: name={{ mysql_user_name }} host="{{ item }}.{{ domain }}" password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present
with_items: "{{ mysql_user_hosts_group }}"
......@@ -9,14 +9,25 @@
become: true
when: ansible_os_family == "RedHat"
- name: install deps in control node
apt: name={{ item }} state=present
- name: install deps in control node ubuntu18
package:
name:
- mysql-client
- libmysqlclient-dev
- python-mysqldb # remove 3 for Ubuntu 18
state: present
become: true
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "18"
- name: install deps in control node ubuntu 20
package:
name:
- mysql-client
- libmysqlclient-dev
- python3-mysqldb # remove 3 for Ubuntu 18
state: present
become: true
with_items:
- mysql-client
- libmysqlclient-dev
- python-mysqldb
when: ansible_os_family == "Debian"
when: ansible_os_family == "Debian" and ansible_distribution_major_version == "20"
- name: make sure config dir exists
file: path="{{ slurm_dir }}/etc" state=directory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment