-
Notifications
You must be signed in to change notification settings - Fork 2
/
Template.yml
91 lines (80 loc) · 3.5 KB
/
Template.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
---
- hosts: all
tasks:
- name: setup packages for RHEL
include: Template-Packages-RHEL.yml
- name: setup packages for Debian/Ubuntu
include: Template-Packages-Debian.yml
- name: setup packages for SUSE
include: Template-Packages-SUSE.yml
- name: setup packages for FreeBSD
include: Template-Packages-FreeBSD.yml
- name: disable sysklogd (if present)
service: name=syslog enabled=no
ignore_errors: true
- name: enable rsyslog (if not)
when: ansible_os_family != "FreeBSD"
service: name=rsyslog enabled=yes
ignore_errors: true
- name: enable rsyslog (if not)
when: ansible_os_family == "FreeBSD"
service: name=rsyslogd enabled=yes
ignore_errors: true
- name: remove cloud user
user: name=cloud state=absent
- name: set root password to "cloudstack" (in case init scripts fail)
user: name=root update_password=always password=$6$hIuIfYHMi8Vd$QCoX.nOo551xKqhIPjdc/aUhtSTpKf3kR0q5MjXrwOgP5Iu9G.MVojQZfvdK2hPqimnY16htsgLktuYhUehNQ0
- name: add CloudStack login splash (Ubuntu)
template: src=templates/Generic/motd.j2 dest=/etc/motd.tail
when: ansible_distribution == "Ubuntu"
- name: add CloudStack login spash (Others)
template: src=templates/Generic/motd.j2 dest=/etc/motd
when: ansible_distribution != "Ubuntu"
- name: create ssh directory
file: state=directory mode=0700 path=/root/.ssh
- name: create directory to store cloudstack client scripts
file: state=directory mode=0755 path=/usr/share/cloudstack
- name: register init system variables
include: Template-Test-Init-System.yml
- name: setup common functions for init scripts
include: Template-Cloud-Functions.yml
- name: setup cloudstack-set-guest-password
include: Template-Cloud-Password.yml
- name: setup cloudstack-set-guest-sshkey
include: Template-Cloud-SSH-Key.yml
- name: setup cloudstack-run-userdata
include: Template-Cloud-Userdata.yml
- name: setup cloudstack-firstboot
include: Template-Cloud-Firstboot.yml
- name: register upstart services
when: upstart.stat.exists == true and systemd.stat.exists == false
shell: initctl reload-configuration
- name: register systemd services
when: upstart.stat.exists == false and systemd.stat.exists == true
shell: systemctl daemon-reload
- name: enable cloudstack-password service
service: name=cloudstack-set-guest-password enabled=yes
- name: enable cloudstack-sshkey service
service: name=cloudstack-set-guest-sshkey enabled=yes
- name: enable cloudstack-userdata service
service: name=cloudstack-run-userdata enabled=yes
- name: enable firstboot-cloudstack service
service: name=cloudstack-firstboot enabled=yes
- name: setup networking
include: Template-Networking.yml
- name: remove upstart overrides (if present)
file: path=/etc/init/firstboot-cloudstack.override state=absent
- name: remove userdata lock (if present)
file: path=/var/lib/cloud/user-data.ran state=absent
- name: remove userdata history
shell: rm -Rf /var/lib/cloud/instances/*
- name: remove dhcp history
shell: rm -f /var/lib/dhc*/dhcl*leas*
- name: cleanup logs
include: Template-Clean-Logs.yml
- name: remove shell history
shell: rm -f /root/.*history*
- name: remove authorized keys
file: path=/root/.ssh/authorized_keys state=absent
- name: remove ssh keys
shell: rm -f /etc/ssh/*host*key*