-
Notifications
You must be signed in to change notification settings - Fork 3
/
deployserver.yml
114 lines (89 loc) · 3.84 KB
/
deployserver.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
- hosts: all
sudo: True
roles:
- { role: elnappoo.apt-cacher-ng, apt_cacher_ng_setup_ufw: False }
tasks:
- name: install vlan module
apt: name=vlan
environment:
http_proxy: "{{ apt_url }}"
- name: load vlan module
modprobe: name=8021q
- name: update /etc/modules
lineinfile: dest=/etc/modules line='8021q' state=present
- name: configure network interfaces
copy: src=interfaces.deployserver dest=/etc/network/interfaces
notify:
- shutdown all ints
- bring up all ints
- name: flush stuff
meta: flush_handlers
# install the vlan package for bridging support
# install lldp to verify connectivity to switch VM
# install bridge-utils so that brctl works
# install git for cloning OSAD repo
# install pip for running pip requirements
- name: install prereq packages
apt: name={{ item }} update_cache=yes cache_valid_time=10000
with_items:
- vlan
- lldpd
- bridge-utils
- python-pip
- git
- vim
- tmux
- name: copy ssh folder from vagrant to root. OSAD needs this
command: cp -r /home/vagrant/.ssh /root/ creates=/root/.ssh
- name: git clone osad repo
git:
repo: 'https://github.com/stackforge/os-ansible-deployment.git'
dest: '/root/osad'
version: "{{ openstack_release }}"
ignore_errors: yes
- name: run bootstrap ansible script
shell: /root/osad/scripts/bootstrap-ansible.sh
args:
creates: /usr/local/bin/openstack-ansible
chdir: '/root/osad'
- name: copy openstack_deploy to /etc folder as recommended by Readme
shell: cp -r /root/osad/etc/openstack_deploy /etc/ creates=/etc/openstack_deploy
- name: set the password for various openstack components to be password123
replace:
dest: '/etc/openstack_deploy/user_secrets.yml'
regexp: '(.*password:\s*\n)'
replace: '\1 password123\n'
backup: 'yes'
- name: set the tokens auth keys for various openstack components
shell: ./scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
args:
chdir: /root/osad
- name: generate root ssh key for OSAD deployment
user: name=root generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=/root/.ssh/id_rsa
- name: copy deploy ssh key to ansible server
fetch: src=/root/.ssh/id_rsa.pub dest=./deploy_key_id_rsa.pub flat=yes
- name: copy openstack_user_config.yml from vagrant folder to deployment host
copy: src=files/openstack_user_config.yml dest=/etc/openstack_deploy/
- name: append caching apt repo lines for containers to use
lineinfile: dest=/root/osad/playbooks/inventory/group_vars/hosts.yml line="{{item}}"
with_items:
- '# Apt repo for openstack containers to use'
- "lxc_container_template_main_apt_repo: {{ ubuntu_repo }} "
- "lxc_container_template_security_apt_repo: {{ ubuntu_repo }} "
- name: increase ssh delay to help prevent ssh timeouts
lineinfile: 'dest="/etc/openstack_deploy/user_variables.yml" line="ssh_delay: 20"'
- name: disable keepalived in haproxy - not needed in vagrant setup
lineinfile:
dest: "/etc/openstack_deploy/user_variables.yml"
regexp: "haproxy_use_keepalived"
line: "haproxy_use_keepalived: False"
- name: update vagrant bashrc to login as root when vagrant ssh deployserver is entered
lineinfile: dest=/home/vagrant/.bashrc line="sudo su -- root" owner=vagrant
- name: update root bashrc to switch to the osad directory after ssh using vagrant ssh
lineinfile: dest=/root/.bashrc line="cd /root/osad/playbooks" owner=root
handlers:
- name: shutdown all ints
command: "/sbin/ifdown -X lo -X eth0 -a"
- name: bring up all ints
command: "/sbin/ifup -X lo -X eth0 -a"