Commit 5a3e62b4 authored by Florian Kempenich's avatar Florian Kempenich
Browse files

Fix glances installation

parent 1c114dad
################################################
## This playbook has 3 steps:
## This playbook has 2 steps:
## 1) Create Droplet on DigitalOcean & Update inventory / ssh config
## 2) Create new User account on Droplet
## 3) Install Software w/ new User account
##
##
## These steps are run on different machines w/ different users:
......@@ -12,9 +11,6 @@
## 2) Create new User account ...
## -> Runs on: Newly Created Droplet
## -> as: root
## 3) Install Software ...
## -> Runs on: Newly Created Droplet
## -> as: Newly Created User
#####################################################################
......@@ -132,6 +128,13 @@
vars:
swapfile_size: "{{ droplet_specs.swap }}"
- name: "Install Glances Webserver as a service"
include_role:
name: glances
- name: "Enable advanced metrics on DigitalOcean"
shell: "curl -sSL https://agent.digitalocean.com/install.sh | sh"
- name: "Create new sudo user w/ default password"
include_role:
name: create-new-sudo-user
......@@ -140,37 +143,6 @@
default_password: "{{ user_to_create_default_password }}"
authorized_ssh_key: "{{ ssh_pub_key_to_load_on_droplet }}"
#####################################################################
### STEP 3 ##
### Install Software w/ new User account ##
### ##
### Host: Newly Created Droplet ##
### SSH User: Newly Created User ##
#####################################################################
- hosts: "{{ droplet_name }}"
gather_facts: False
vars:
# If using `remote_user` at the same level as `hosts`, it would
# not override the `ansible_user` variable from the inventory
ansible_user: "{{ user_to_create_username }}"
ansible_become_pass: "{{ user_to_create_default_password }}"
tasks:
- name: Try Block
block:
# TODO: Fix Glances installation (or remove, but be sure to re-locate the daemon part!!)
# TODO: Fix Glances installation (or remove, but be sure to re-locate the daemon part!!)
# TODO: Fix Glances installation (or remove, but be sure to re-locate the daemon part!!)
# - name: "Install Glances Webserver as a service"
# include_role:
# name: glances
- name: "Enable advanced metrics on DigitalOcean"
shell: "curl -sSL https://agent.digitalocean.com/install.sh | sh"
become: yes
- debug:
msg:
- "Droplet '{{ droplet_name }}' succesfuly created"
......@@ -178,12 +150,7 @@
- "IP = {{ ansible_default_ipv4.address }}"
- "User = {{ user_to_create_username }}"
- "Password = {{ user_to_create_default_password }}"
- "Glance server running at: http://138.68.100.84:61208"
- ""
- "You can now ssh to the droplet with `ssh {{ droplet_name }}`"
- "Don't forget to change the default password!"
rescue:
- debug:
msg:
- "Problem during setup!"
- "Is it the first time this is ran?"
- "If not, did you change the sudo password for the default user?"
\ No newline at end of file
......@@ -3,7 +3,7 @@ Description=Glances Webserver on port 61208
[Service]
After=network.target
ExecStart=/usr/local/bin/glances -w
ExecStart=/root/.local/bin/glances -w
Restart=on-abort
[Install]
......
- name: "Ensure running as Root"
assert:
that:
- "{{ ansible_user_uid }} == 0"
msg: "Please run this role as root!"
- name: "Install Glances"
block:
- name: "Install `pip3`"
......@@ -5,32 +11,25 @@
name: python3-pip
state: latest
update_cache: yes
become: yes
- name: "Upgrade `pip3`"
pip:
name: pip
executable: pip3
state: latest
become: yes
- name: "Install `glances`"
pip:
name: glances
executable: pip3
state: latest
become: yes
- name: "Install `glances` optional dependencies"
- name: "Install `glances` and `glances` optional dependencies"
pip:
name: "{{ item }}"
executable: pip3
state: latest
become: yes
extra_args: --user
with_items:
- glances
- docker
- bottle
- name: "Start Glances Web server as Daemon"
block:
- name: "Copy `glances.service` file"
......
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