Commit 8908a173 authored by John Hackett's avatar John Hackett

TiDB credential creation and oned database creation succeed on first run,...

TiDB credential creation and oned database creation succeed on first run, likewise sunstone starting.
parent 32cb0c2f
......@@ -85,8 +85,8 @@ LISTEN_ADDRESS = "0.0.0.0"
DB = [ BACKEND = "mysql",
SERVER = "127.0.0.1",
PORT = "4000",
USER = "root",
PASSWD = "oneadmin",
USER = "oneadmin",
PASSWD = "password",
DB_NAME = "opennebula" ]
VNC_PORTS = [
......
......@@ -2,6 +2,14 @@
- hosts: all
become: true
tasks:
- name: set local ip for use in templates
set_fact:
ansible_control_host_address: "{{ hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] }}"
delegate_to: 127.0.0.1
# - name: template file with ansible control host IP
# template:
# src: /path/to/template.j2
# dest: /path/to/destination/file
- name: install opennebula key
apt_key: url=http://downloads.opennebula.org/repo/Debian/repo.key state=present
- name: install opennebula repo
......@@ -87,27 +95,16 @@
name: opennebula
image: pingcap/tidb:latest
state: started
# recreate: yes
exposed_ports:
- 4000
published_ports:
- 4000:4000
# - mysql_user:
# name: "root"
# password: "oneadmin"
# login_host: 127.0.0.1
# login_port: 4000
# update_password: always
# state: present
- name: set mysql password
shell: mysql -h 127.0.0.1 -P 4000 -u root --password= -e "SET PASSWORD FOR root = 'oneadmin';FLUSH PRIVILEGES;" || true
- name: start services
systemd:
state: started
name: "{{ item }}"
with_items:
- opennebula
- opennebula-sunstone
- name: sleep long enough for TiDB to start
wait_for:
port: 4000
delay: 5
- name: set TiDB password
shell: mysql -h 127.0.0.1 -P 4000 -u root --password= -e "CREATE USER IF NOT EXISTS 'oneadmin'@'%' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON *.* TO 'oneadmin'@'%';FLUSH PRIVILEGES;"
- name: ssh authorized_keys
shell: "ssh-keygen -y -f /var/lib/one/.ssh/id_rsa > /var/lib/one/.ssh/authorized_keys"
become_user: oneadmin
......@@ -125,10 +122,27 @@
with_items:
- libvirt-daemon
- libvirt-clients
- name: start oned
systemd:
state: started
name: "{{ item }}"
with_items:
- libvirtd
- opennebula
- name: sleep long enough for oned to start
wait_for:
port: 2633
delay: 5
- name: start sunstone
systemd:
state: started
name: "{{ item }}"
with_items:
- opennebula-sunstone
- name: sleep long enough for sunstone to start
wait_for:
port: 9869
delay: 5
delay: 1
- name: add hosts
command: "onehost create 127.0.0.1 -i kvm -v kvm"
become_user: oneadmin
......
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