1
0
mirror of https://github.com/krislamo/pup-tests synced 2025-09-07 15:29:29 +00:00

Setup Puppet Environment

Ansible sets up a puppet master and puppet agent on two virtual
machines with a hello world puppet application.
This commit is contained in:
2019-01-09 15:48:17 -05:00
commit 7f818e3c31
11 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
- name: Install Puppet Agent
apt: name=puppet state=present
register: agent_install
- name: Deploy puppet.conf
template:
src: puppet.conf.j2
dest: /etc/puppet/puppet.conf
- name: Start Puppet
service: name=puppet state=started
- name: Wait for Puppet Master
wait_for:
host: puppet
port: 8140
delay: 10
when: agent_install.changed
- name: Request Puppet Master
command: puppet agent -t
register: send_csr
failed_when: send_csr.rc > 1
when: agent_install.changed
become_user: vagrant

View File

@@ -0,0 +1,6 @@
[main]
ssldir = /var/lib/puppet/ssl
[agent]
server = puppet

View File

@@ -0,0 +1,14 @@
# vi uses elvis-tiny on Debian. vim is better.
- name: Install VIM
apt: name=vim state=present
- name: Lock Puppet Version
template:
src: 00-puppet.pref.j2
dest: /etc/apt/preferences.d/00-puppet.pref
- name: Deploy hosts file
template:
src: hosts.j2
dest: /etc/hosts

View File

@@ -0,0 +1,4 @@
Package: puppet puppetmaster
Pin: version 4.8*
Pin-Priority: 501

View File

@@ -0,0 +1,11 @@
127.0.0.1 localhost
127.0.1.1 {{ ansible_hostname }}
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.121.100 puppet
192.168.121.101 webserver

View File

@@ -0,0 +1,22 @@
- name: Install Puppet Master
apt: name=puppetmaster state=present
register: pup_install
- name: Install NTP
apt: name=ntp state=present
register: ntp_status
- name: Restart NTP
service: name=ntp state=restarted
when: ntp_status.changed
- name: Wait for Webserver Key
wait_for:
path: /var/lib/puppet/ssl/ca/requests/webserver.pem
when: pup_install.changed
- name: Sign Webserver Key
command: puppet cert sign webserver
args:
removes: /var/lib/puppet/ssl/ca/requests/webserver.pem