Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
fdb97c0f
Commit
fdb97c0f
authored
Apr 04, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made interface input 'playbook' into a list
parent
fb8231a1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
184 deletions
+33
-184
application_example_provisioned.yaml
TOSCA/application_example_provisioned.yaml
+6
-3
lifeWatch_vre1.yaml
TOSCA/lifeWatch_vre1.yaml
+11
-11
interfaces.yml
TOSCA/types/interfaces.yml
+3
-3
nodes.yaml
TOSCA/types/nodes.yaml
+10
-3
install_k8s.yml
ansible_playbooks/install_k8s.yml
+0
-139
inventory.yaml
ansible_playbooks/inventory.yaml
+0
-13
ansible_service.py
deployer/service/ansible_service.py
+3
-9
deploy_service.py
deployer/service/deploy_service.py
+0
-3
No files found.
TOSCA/application_example_provisioned.yaml
View file @
fdb97c0f
...
...
@@ -63,13 +63,16 @@ topology_template:
Standard
:
configure
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/k8s_dashboard.yaml"
repository
:
https://github.com/skoulouzis/playbooks.git
playbook
:
"
k8s_dashboard.yaml"
create
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yaml"
playbook
:
"
install_k8s.yaml"
repository
:
https://github.com/skoulouzis/playbooks.git
delete
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/k8s_delete.yaml"
playbook
:
"
k8s_delete.yaml"
repository
:
https://github.com/skoulouzis/playbooks.git
type
:
"
tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
topology
:
properties
:
...
...
TOSCA/lifeWatch_vre1.yaml
View file @
fdb97c0f
...
...
@@ -29,15 +29,15 @@ topology_template:
repository
:
docker_hub
#
topology:
#
type: tosca.nodes.ARTICONF.VM.topology
#
interfaces:
#
CloudsStorm:
#
provision:
#
inputs:
#
code_type: SEQ
#
object_type: SubTopology
#
properties:
#
domain: UvA (Amsterdam, The Netherlands) XO Rack
#
provider: ExoGENI
topology
:
type
:
tosca.nodes.ARTICONF.VM.topology
interfaces
:
CloudsStorm
:
provision
:
inputs
:
code_type
:
SEQ
object_type
:
SubTopology
properties
:
domain
:
UvA (Amsterdam, The Netherlands) XO Rack
provider
:
ExoGENI
TOSCA/types/interfaces.yml
View file @
fdb97c0f
...
...
@@ -68,7 +68,7 @@ interface_types:
inventory_file
:
type
:
string
required
:
false
playbook
:
playbook
s
:
type
:
string
required
:
false
repository
:
...
...
@@ -84,8 +84,8 @@ interface_types:
repository
:
type
:
string
required
:
false
playbook
:
type
:
string
playbook
s
:
type
:
list
required
:
false
replicas
:
type
:
integer
...
...
TOSCA/types/nodes.yaml
View file @
fdb97c0f
...
...
@@ -135,15 +135,22 @@ node_types:
create
:
inputs
:
repository
:
https://github.com/skoulouzis/playbooks.git
playbook
:
install_k8s.yaml
playbooks
:
-
install_packages.yaml
-
mount.yaml
-
install_docker.yaml
-
install_k8s.yaml
configure
:
inputs
:
repository
:
https://github.com/skoulouzis/playbooks.git
playbook
:
k8s_dashboard.yaml
playbooks
:
-
create_k8s_cluster.yaml
-
create_k8s_dashboard.yaml
delete
:
inputs
:
repository
:
https://github.com/skoulouzis/playbooks.git
playbook
:
k8s_delete.yaml
playbooks
:
-
k8s_delete.yaml
tosca.nodes.ARTICONF.VM.topology
:
...
...
ansible_playbooks/install_k8s.yml
deleted
100644 → 0
View file @
fb8231a1
-
hosts
:
all
become
:
yes
tasks
:
#- name: replace DNS
#shell: sed -i "s/nameserver.*/nameserver 8.8.8.8/g" /etc/resolv.conf
#- name: replace DNS
#lineinfile:
#path: /etc/resolv.conf
#regexp: 'nameserver.*'
#line: nameserver 8.8.8.8
-
name
:
Wait for automatic system updates
shell
:
while sudo fuser /var/lib/dpkg/{{ item }} >/dev/null 2>&1; do sleep 3; done;
with_items
:
-
lock
-
lock-frontend
-
name
:
Update and upgrade apt packages
apt
:
upgrade
:
yes
update_cache
:
yes
-
name
:
Install aptitude using apt
apt
:
name=aptitude state=latest update_cache=yes force_apt_get=yes
-
name
:
Install required of packages
apt
:
name
:
"
{{
packages
}}"
update_cache
:
yes
vars
:
packages
:
-
ca-certificates
-
apt-transport-https
-
curl
-
gnupg2
-
software-properties-common
-
python3-pip
-
python-pip
-
virtualenv
-
name
:
Check that the /dev/xvdh exists
stat
:
path
:
/dev/xvdh
register
:
mount_volume
-
debug
:
msg
:
"
/dev/xvdh
exists"
when
:
mount_volume.stat.exists
-
name
:
Create a xfs
filesystem
:
fstype
:
xfs
dev
:
/dev/xvdh
when
:
mount_volume.stat.exists == True
-
name
:
Creates directory
file
:
path
:
/data
state
:
directory
when
:
mount_volume.stat.exists == True
-
name
:
Mount
mount
:
path
:
/data
src
:
/dev/xvdh
state
:
present
fstype
:
xfs
when
:
mount_volume.stat.exists == True
-
name
:
check Mount
command
:
mountpoint -q /data
register
:
volume_stat
failed_when
:
False
changed_when
:
False
-
debug
:
msg
:
volume_stat.rc {{ volume_stat.rc }}
when
:
mount_volume.stat.exists
-
name
:
Mount manualy
shell
:
'
mount
/dev/xvdh
/data'
when
:
mount_volume.stat.exists
ignore_errors
:
yes
-
name
:
Add Docker GPG apt Key
apt_key
:
url
:
https://download.docker.com/linux/ubuntu/gpg
state
:
present
-
name
:
Add Docker Repository
apt_repository
:
repo
:
deb https://download.docker.com/linux/ubuntu bionic stable
state
:
present
-
name
:
Update apt and install docker-ce
apt
:
update_cache=yes name=docker-ce state=latest
-
name
:
Update and upgrade apt packages
apt
:
upgrade
:
yes
update_cache
:
yes
-
name
:
Add the Kubernetes signing key
apt_key
:
url
:
https://packages.cloud.google.com/apt/doc/apt-key.gpg
state
:
present
-
name
:
Add Docker Repository
apt_repository
:
repo
:
deb http://apt.kubernetes.io/ kubernetes-xenial main
state
:
present
-
name
:
Update apt and install docker-ce
apt
:
update_cache=yes name=kubeadm state=latest
-
name
:
Change data-root location in /etc/docker/daemon.json
shell
:
|
echo '{"data-root": "/data"}' > /etc/docker/daemon.json
when
:
mount_volume.stat.exists == True
-
name
:
Restart service docker, in all cases
service
:
name
:
docker
state
:
restarted
ignore_errors
:
yes
when
:
mount_volume.stat.exists == True
ansible_playbooks/inventory.yaml
deleted
100644 → 0
View file @
fb8231a1
all
:
vars
:
ansible_ssh_user
:
ubunut
host_key_checking
:
False
children
:
k8-master
:
hosts
:
192.168.1.10
:
worker
:
hosts
:
192.168.1.11
:
192.168.1.12
:
192.168.1.13
:
deployer/service/ansible_service.py
View file @
fdb97c0f
...
...
@@ -62,17 +62,10 @@ class AnsibleService:
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
==
'success'
:
task_id
=
self
.
run_task
(
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
)
pass
def
build_yml_inventory
(
self
,
vms
):
# loader = DataLoader()
# inventory = InventoryManager(loader=loader)
# variable_manager = VariableManager()
# with open(r'/home/alogo/Downloads/inventory.yaml') as file:
# # The FullLoader parameter handles the conversion from YAML
# # scalar values to Python the dictionary format
# data = yaml.load(file)
inventory
=
{}
all
=
{}
vars
=
{
'ansible_ssh_common_args'
:
'-o StrictHostKeyChecking=no'
}
...
...
@@ -82,12 +75,13 @@ class AnsibleService:
attributes
=
vm
.
node_template
.
attributes
role
=
attributes
[
'role'
]
public_ip
=
attributes
[
'public_ip'
]
if
role
not
in
children
:
hosts
=
{}
else
:
hosts
=
children
[
role
]
hosts
[
public_ip
]
=
vars
host
=
{}
host
[
public_ip
]
=
vars
hosts
[
'hosts'
]
=
host
children
[
role
]
=
hosts
# inventory.add_group(role)
# inventory.add_host(public_ip,group=role)
...
...
deployer/service/deploy_service.py
View file @
fdb97c0f
...
...
@@ -21,7 +21,4 @@ class DeployService:
if
interface_types
and
'Standard'
in
interface_types
:
ansible_service
=
AnsibleService
(
self
.
semaphore_base_url
,
self
.
semaphore_username
,
self
.
semaphore_password
)
ansible_service
.
execute
(
nodes_pair
)
# print(source)
# print(target)
return
None
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment