forked from jasodeep/ansible-lamp-stack-playbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
site.yml
103 lines (85 loc) · 2.41 KB
/
site.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
- hosts: localhost
vars:
connection: local
become: true
gather_facts: false
pre_tasks:
- name: Load Secret Keys
include_vars: keys.yml
- name: Load Information from Customer (for development)
include_vars: customer.yml
- name: Install python
become: true
apt: pkg={{ item }} state=installed update_cache=true
with_items:
- python-minimal
- python-pip
- virtualenv
- pip:
name: dopy
state: present
tasks:
# - name: Ensure ssh key exists
# user: name={{ ansible_user_id }} generate_ssh_key=yes ssh_key_file=.ssh/id_rsa
# - name: Ensure key exists at DigitalOcean
# digital_ocean:
# state: present
# command: ssh
# name: "{{ do_provision_ssh_key }}"
# ssh_pub_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
# api_token: "{{ do_token }}"
# register: ssh_key
- name: "Create new Droplet client-{{ customer_dns }}"
digital_ocean:
state: present
command: droplet
name: "client-{{ customer_dns }}"
api_token: "{{ do_token }}"
#ssh_key_ids: "{{ ssh_key.ssh_key.id }}"
ssh_key_ids: 17973516
unique_name: yes
size_id: 1gb
region_id: fra1
image_id: ubuntu-17-10-x64
ipv6: true
wait_timeout: 600
register: do
# Bug reported for digital_ocean_tag
# - name: "Tag the new droplet"
# digital_ocean_tag:
# api_token: "{{ do_token }}"
# resource_id: "{{ do.droplet.id }}"
# name: client
# - name: Add server IP to DNS
# ovh:
# service: dns
# domain: "{{ custom_dns }}"
# ip: "{{ do.droplet.ip_address }}"
# name: internal.bar
# - name: Refresh domain
# ovh: service='dns' name='refresh' domain='{{ domain }}'
- name: Add new host to our inventory.
add_host:
name: "{{ do.droplet.ip_address }}"
groups: do
when: do.droplet is defined
- hosts: do
remote_user: root
gather_facts: false
pre_tasks:
- name: Load Secret Keys
include_vars: keys.yml
- name: Load Information from Customer (for development)
include_vars: customer.yml
- name: Wait for port 22 to become available.
local_action: "wait_for port=22 host={{ inventory_hostname }}"
roles:
- common
- mysql
- apache2
- asterisk
- wordpress
- vtiger
- prestashop
- ldap
- ldapaccountmanager