From 5cf27e411f8a161c2f8206233ab5c046c01e8e54 Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Thu, 27 Aug 2015 10:30:43 +0200 Subject: [PATCH] Refactor common and bootstrap_puppet_infra_node roles Moving the setup of Puppetlabs apt repo and installation of puppet packages to common role. The bootstrap_puppet_infra_node now only configures puppet.conf and enables the puppet agent. --- common.yml | 2 +- roles/bootstrap_puppet_infra_node/tasks/main.yml | 14 -------------- roles/common/tasks/main.yml | 11 ++++++++++- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/common.yml b/common.yml index 91859b8..9f0d624 100644 --- a/common.yml +++ b/common.yml @@ -1,7 +1,7 @@ --- # file: common.yml - hosts: infra - gather_facts: no + gather_facts: yes user: ubuntu sudo: true roles: diff --git a/roles/bootstrap_puppet_infra_node/tasks/main.yml b/roles/bootstrap_puppet_infra_node/tasks/main.yml index 8664f64..754bdb3 100644 --- a/roles/bootstrap_puppet_infra_node/tasks/main.yml +++ b/roles/bootstrap_puppet_infra_node/tasks/main.yml @@ -1,15 +1,4 @@ --- -- name: Get deb package for Puppetlabs repository - get_url: > - url=https://apt.puppetlabs.com/puppetlabs-release-{{ansible_distribution_release}}.deb - dest=/tmp/puppetlabs-release-{{ansible_distribution_release}}.deb - -- name: Install Puppetlabs repository deb package - apt: deb=/tmp/puppetlabs-release-{{ansible_distribution_release}}.deb - -- name: Install Puppet package after updating cache - apt: name=puppet update_cache=yes - - name: Deploy /etc/puppet.conf template template: src=puppet.conf.j2 dest=/etc/puppet/puppet.conf @@ -18,6 +7,3 @@ - name: Enable puppet agent, as it is disabled upon installation command: puppet agent --enable - -- name: Run puppet agent to apply configuration - puppet: diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index af1e6b6..c3561db 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,9 +1,18 @@ --- +- name: Get deb package for Puppetlabs repository + get_url: > + url=https://apt.puppetlabs.com/puppetlabs-release-{{ansible_distribution_release}}.deb + dest=/tmp/puppetlabs-release-{{ansible_distribution_release}}.deb + +- name: Install Puppetlabs repository deb package + apt: deb=/tmp/puppetlabs-release-{{ansible_distribution_release}}.deb + - name: Update packages apt: update_cache=yes -- name: Install git package +- name: Install Puppet and other required packages apt: name={{ item }} state=installed with_items: - git - python-pip + - puppet