-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstall.yaml
99 lines (96 loc) · 3.36 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
- hosts: all
gather_facts: yes
vars:
puppet_download: http://apt.puppetlabs.com/puppetlabs-release
puppet_name: puppetlabes-release
download_folder: /var/tmp
puppet_archive: "{{download_folder}}/{{puppet_name}}.deb"
tasks:
- name: Update apt-cache [apt]
apt: "update_cache=yes"
sudo: yes
when: ansible_os_family == "Debian"
- name: Install wget [apt]
apt: "pkg=wget"
when: ansible_os_family == "Debian"
- name: Download the Puppet repo package
command: "wget -q -O {{puppet_archive}} {{puppet_download}}-{{ansible_distribution_release}} creates={{puppet_archive}}"
when: ansible_os_family == "Debian"
- name: Install the puppet repo package [apt]
apt: "deb={{ puppet_archive }}"
sudo: 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"
sudo: yes
when: ansible_os_family == "RedHat" or ansible_os_family == "Centos"
- name: Update apt-cache
apt: "update_cache=yes"
sudo: yes
when: ansible_os_family == "Debian"
- name: Install all the required packaes for a puppetmaster [apt]
apt: "pkg={{item}} state=present"
sudo: yes
with_items: [
"puppetmaster",
"puppetdb",
"hiera",
"facter",
"puppetdb-terminus",
"git"
]
when: ansible_os_family == "Debian"
- name: Install all the required packaes for a puppetmaster [yum]
yum: "name={{item}} state=present"
sudo: yes
with_items: [
"puppet-server",
"puppetdb",
"hiera",
"facter",
"puppetdb-terminus",
"git"
]
when: ansible_os_family == "RedHat" or ansible_os_family == "Centos"
- name: install r10k
command: gem install --verbose r10k creates="/usr/bin/r10k"
sudo: yes
- name: Start the puppetmaster service
service: "name=puppetmaster state=restarted"
sudo: yes
#- name: "puppetmaster must have a /etc/hosts entry"
#lineinfile: dest=/etc/hosts line="127.0.0.1 puppet puppetmaster" state=present
- name: puppet agent --test
command: puppet agent --test --server {{ansible_fqdn}} creates="/var/lib/puppet/ssl/certs/{{ ansible_fqdn }}"
sudo: yes
- name: puppetdb ssl-setup
command: puppetdb ssl-setup creates="/etc/puppetdb/ssl"
sudo: yes
- name: Install default hiera.conf
template: src=hiera.conf.j2 dest=/etc/puppet/hiera.conf owner=root group=root mode=0644
sudo: yes
- name: Install default puppet.conf
template: src=puppet.conf.j2 dest=/etc/puppet/puppet.conf owner=root group=root mode=0644
sudo: yes
- name: Install default puppetdb.conf
template: src=puppetdb.conf.j2 dest=/etc/puppet/puppetdb.conf owner=root group=root mode=0644
sudo: yes
- name: Install default routes.yaml
template: src=routes.yaml.j2 dest=/etc/puppet/routes.yaml owner=root group=root mode=0644
sudo: yes
- name: Install default r10k.yaml
template: src=r10k.yaml.j2 dest=/etc/r10k.yaml owner=root group=root mode=0644
sudo: yes
- name: r10k deploy
command: r10k deploy environment creates="/etc/puppet/environments/master"
sudo: yes
- name: install puppet-lint
gem: name=puppet-lint
sudo: yes
- name: Start all the services.
service: "name={{item}} state=restarted"
sudo: yes
with_items: [
"puppetmaster",
"puppetdb",
]