forked from daniellawrence/ansible-puppetmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.yaml
121 lines (99 loc) · 3.93 KB
/
install.yaml
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
113
114
115
116
117
118
119
120
121
- hosts: all
gather_facts: yes
vars:
puppet_download: http://apt.puppetlabs.com/puppetlabs-release-pc1
puppet_name: puppetlabes-release.deb
download_folder: /var/tmp
puppet_archive: "{{download_folder}}/{{puppet_name}}.deb"
java_Xms: 1g
java_Xmx: 1g
tasks:
- name: Update apt-cache [apt]
apt: "update_cache=yes"
become: yes
when: ansible_os_family == "Debian"
- name: Download the Puppet repo package
get_url: url={{ puppet_download }}-{{ ansible_distribution_release }}.deb dest={{ puppet_archive }}
when: ansible_os_family == "Debian"
- name: Install the puppet repo package [apt]
apt: "deb={{ puppet_archive }}"
become: yes
when: ansible_os_family == "Debian"
- name: Install the puppet repo package [yum]
yum: "name=http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"
become: yes
when: ansible_os_family == "RedHat" or ansible_os_family == "Centos"
- name: Update apt-cache
apt: "update_cache=yes"
become: yes
when: ansible_os_family == "Debian"
- name: Install all the required packaes for a puppetmaster [apt]
apt: "pkg={{item}} state=present"
become: yes
with_items: [
"puppetserver",
# "puppetdb",
"puppet-agent",
# "puppetdb-termini",
"git"
]
when: ansible_os_family == "Debian"
- name: Install all the required packaes for a puppetmaster [yum]
yum: "name={{item}} state=present"
become: yes
with_items: [
"puppetserver",
# "puppetdb",
"puppet-agent",
# "puppetdb-termini",
"git"
]
when: ansible_os_family == "RedHat" or ansible_os_family == "Centos"
# - name: install r10k
# command: /opt/puppetlabs/puppet/bin/gem install --verbose r10k creates="/opt/puppetlabs/puppet/bin/r10k"
# become: yes
- name: Change Java heap size
template: src=puppetserver.j2 dest=/etc/default/puppetserver owner=root group=root mode=0644
# command: sed -i 's/-Xms2g -Xmx2g/-Xms1g -Xmx1g/g' /etc/default/puppetserver
become: yes
- name: Start the puppetmaster service
service: "name=puppetserver state=started"
become: yes
- name: Set puppet to start on boot
command: /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
- name: puppet agent --test
command: /opt/puppetlabs/bin/puppet agent --test --server {{ansible_fqdn}} creates="/var/lib/puppet/ssl/certs/{{ ansible_fqdn }}"
become: yes
# - name: puppetdb ssl-setup
# command: /opt/puppetlabs/bin/puppetdb ssl-setup creates="/etc/puppetlabs/puppetdb/ssl"
# become: yes
# - name: Install default hiera.conf
# template: src=hiera.conf.j2 dest=/etc/puppetlabs/puppet/hiera.conf owner=root group=root mode=0644
# become: yes
# - name: Install default puppet.conf
# template: src=puppet.conf.j2 dest=/etc/puppetlabs/puppet/puppet.conf owner=root group=root mode=0644
# become: yes
# - name: Install default puppetdb.conf
# template: src=puppetdb.conf.j2 dest=/etc/puppetlabs/puppet/puppetdb.conf owner=root group=root mode=0644
# become: yes
# - name: Install default routes.yaml
# template: src=routes.yaml.j2 dest=/etc/puppetlabs/puppet/routes.yaml owner=root group=root mode=0644
# become: yes
# - name: Install default r10k.yaml
# template: src=r10k.yaml.j2 dest=/etc/r10k.yaml owner=root group=root mode=0644
# become: yes
# - name: r10k deploy
# command: r10k deploy environment creates="/etc/puppetlabs/puppet/environments/master"
# become: yes
- name: install puppet-lint
command: /opt/puppetlabs/puppet/bin/gem install --verbose puppet-lint creates="/opt/puppetlabs/puppet/bin/puppet-lint"
become: yes
- name: Start all the services.
service: "name={{item}} state=restarted"
become: yes
with_items: [
"puppetserver",
# "puppetdb",
]
- name: Set puppet server to start on boot
command: /opt/puppetlabs/bin/puppet resource service puppetserver ensure=running enable=true