101 Commits

Author SHA1 Message Date
Paul Belanger
edb0e245d5 Expose puppet_timeout variable
It is possible we want our puppet role to run longer then 30mins,
expose the ability for a user to change it.

Change-Id: Id42ba80a5118a9f93e45619ac6ecc5baa774549a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-01-12 14:14:56 -05:00
James E. Blair
8d0f0bfd0a Set facts type to dict
With newer versions of ansible, module arguments are assumed to
be strings unless otherwise specified.  Our 'facts' argument is
expected to be a dictionary, so tell ansible that.

Without this, the argument will arrive as a string and be written
to the facter file inside string quotes.  Facter will produce the
following error:

  undefined method `each' for #<String:0x000000016ee640>

Change-Id: Iea626466d0920349f434f678fe2f71cbee259383
2017-01-12 09:55:37 -08:00
Jenkins
3fe078c070 Merge "Update README with info about puppet apply" 2016-10-21 15:16:58 +00:00
Monty Taylor
d666d6c0e6 Update README with info about puppet apply
The README currently says you have to pass puppetmaster, but this is
untrue for puppet apply installs. Add an example playbook to run puppet
without a puppet master.

Change-Id: I6dfb5b97cbca42b83f790310b12a3d49f7dae8a0
2016-10-20 15:48:40 -07:00
James E. Blair
117fd2ed43 Revert "Remove basemodulepath from environment config"
This reverts commit e7a06ed55aeac0c09e09bbdade010b9c45c855ce.

This caused the ansible apply test to fail (and therefore
potentially puppet runs from our puppetmaster).

Change-Id: I0db01d128258f78e9b196354799a80774f6c6808
2016-10-04 22:36:16 +00:00
Monty Taylor
e7a06ed55a
Remove basemodulepath from environment config
We want the env specific modules to be used first then fall back onto
the normal base module path for any modules missing from the
environment. This means you can test local changes without having a
complete set of modules in your env.

Change-Id: I2f0311400a8cf76b9793f50453e818ed4dd7e5a2
2016-10-01 08:11:13 -07:00
Monty Taylor
1c69c305e7
Sync puppet module changes from upstream ansible
We keep a local copy of this file for operational purposes, but the
upstream one has grown a few things. Sync to make it easier to submit
our local changes upstream.

Change-Id: I84927750fce1a7c6101e8d5c131c0b13020bb6aa
2016-10-01 08:11:13 -07:00
James E. Blair
e8632f41a4
Don't set detailed-exitcodes when noop
Change-Id: I3819ad5920a0a88b0b52ecb9b77a58c6d588fbdc
2016-10-01 08:11:13 -07:00
James E. Blair
fccf47a713
Add debug argument
To run puppet in debug mode.

Change-Id: I00baef254db2f9eaee23fb9eacded8efc5a2afc4
2016-10-01 08:11:13 -07:00
Clark Boylan
8cc1cd9126
Simplify puppet cmd generation
We were copy pastaing code in the puppet cmd generation for noop and
environment handling. Collapse that to make code easier to read and
hopefully avoid future bugs where only one side is edited.

Local testing shows that puppet parses commands like:

  puppet apply test.pp --noop

just fine.

Change-Id: Ie7665f72b9327b6b834d358699addf2c60a95ec0
2016-10-01 08:11:12 -07:00
James E. Blair
b4f591b72d
Add noop argument
check_mode causes other things that we may want to actually happen
(such as setting up hiera) not to run.  This way we can do all of
those but still run puppet in noop.

Change-Id: I32f07a032d28f5c5d04e9eeb50b94f7c0a57ce53
2016-10-01 08:11:12 -07:00
James E. Blair
1a20bc89eb
Allow any logdest
Puppet's logdest option can also point to a file, so allow any
string through here.

Change-Id: I36fc99fa7e6169463acd24a5a6f4b54cf23849b7
2016-10-01 08:11:12 -07:00
Monty Taylor
e46f449ca5
Pass environment to puppet module
Change-Id: I6be88234eab32844f395df7658952b1cef944bd8
2016-10-01 08:11:12 -07:00
Monty Taylor
a3cc1c5c9a
Make sure environment winds up in basemodulepath
Change-Id: I7a80158fef3fd764000f7d57a56ebf0df83347ea
2016-10-01 08:11:12 -07:00
Jenkins
ede55a8691 Merge "Honor show-diff options with puppet apply" 2016-08-05 20:03:36 +00:00
Jenkins
77bde8611e Merge "Remove connection: localhost" 2016-07-25 19:27:16 +00:00
Jeremy Stanley
10e657d56d Correct AnsibleModule string type names to str
The valid type names can be found in
AnsibleModule._CHECK_ARGUMENT_TYPES_DISPATCHER, and any deviation
from those causes us to no longer be able to puppet any hosts. The
type name for strings is, courtesy of Ansible's implementation being
Python, "str".

Change-Id: Ia4d4cde9926f7506a864739b1b616438c5fe6f43
2016-07-23 22:53:06 +00:00
Ramy Asselin
92737dfe27 Honor show-diff options with puppet apply
puppet apply ignores the show-diff option.
Update the code so that both puppet apply and puppet agent
support the show-diff option.

Change-Id: I5b59b8ba8e50a44458d01ec97113a2ce313c1d9a
2016-07-19 09:18:39 -07:00
Paul Belanger
b8e3bdd1fd
Be explicit with AnsibleModule types
When moving to ansible 2.1.0.0, we'll need to be more explicity about
our AnsibleModule parameters. Ansible now defaults them to strings.

This will ensure groups is a list.

Change-Id: Ic126c200a432277c0ef406d4406f527d6a3c9fa7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-07-18 14:35:12 -04:00
Jenkins
b5fc21ca37 Merge "Call main() from a conditional" 2016-06-06 13:02:06 +00:00
Jenkins
44b95feb54 Merge "Update .gitreview to ansible-role-puppet" 2016-06-04 06:55:40 +00:00
Jenkins
7f32a9eeaf Merge "Remove dead code" 2016-06-03 15:08:59 +00:00
Monty Taylor
9f5baf0528
Update .gitreview to ansible-role-puppet
Depends-On: I889399813748919ce1788ad18ce84c3894e12ab1
Change-Id: I5998b0ec44bf634f85ab53f262242c8fca95b6c2
2016-06-02 10:48:25 +03:00
Paul Belanger
b6ebba9545
Call main() from a conditional
See ansible docs[1] for more information.

[1] http://docs.ansible.com/ansible/developing_modules.html

Change-Id: I21062e1eb47632ac39e35d7267dab96b62500743
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-05-26 13:31:11 -04:00
Paul Belanger
330bfde495 Remove connection: localhost
We are running into OOM issues on puppetmaster.o.o and our current
thought process is because we are using connection: local, this is
causing ansible to fork many times over, which is an expensive task.

Change-Id: I3f2646765f0b442f7533aa7be44fc42b1916f172
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-05-02 17:36:05 +00:00
Jenkins
f20c52a44b Merge "Don't post reports if there are no reports to post" 2016-03-09 16:42:03 +00:00
Monty Taylor
3408a8f0f5 Don't post reports if there are no reports to post
If we don't produce any reports, don't post them.

Change-Id: I06f0bf47a1761f90118ad45a99e33f112699a4c7
2016-03-09 10:23:45 -06:00
Clark Boylan
642add61b3 Always puppetboard upload if puppetboard defined
We should always upload to puppetboard (even when puppet fails) if the
puppetboard server is defined. This allows puppetboard to learn of both
successful and failed puppet runs.

Change-Id: I62a78200052443997baf549256c78b38bd37f63e
2016-03-07 21:40:11 -08:00
Jenkins
d351b3e07e Merge "Safely fail when logs cannot be found" 2016-03-02 17:56:44 +00:00
Jenkins
403053534b Merge "Force interpreting to boolean in manage_config" 2016-02-26 01:38:04 +00:00
Yolanda Robla
139ca911ab Safely fail when logs cannot be found
On first runs, this logfile is not going to be found. This
is causing ansible to crash and stop applying puppet in consecutive
nodes.

Add a condition to safely fail, and abort play if no files can
be found.

Change-Id: I22a5ebbcaa603b25920fd638211f3663e81e09b0
2016-02-26 01:59:49 +01:00
Jenkins
54fabcffd1 Merge "Fix hiera paths when configuring puppet" 2016-02-25 22:28:19 +00:00
Yolanda Robla
28d495af61 Add extra path for our own puppet modules in environment
Change-Id: Ic501a34f79325bd2032c43f7ca36f19cae16e3e5
2016-02-25 23:07:22 +01:00
Yolanda Robla
a0faab2306 Force interpreting to boolean in manage_config
If not, it is picking a False value as string, and
is applying to all instances.

Change-Id: I0a102bcdfe59a9a9426ff46d2c164e15de6288fd
2016-02-25 22:58:20 +01:00
Yolanda Robla
8255eecc9b Fix hiera paths when configuring puppet
The path to hiera was wrong, as long with the subdirectories

Change-Id: I66873aa63fe6bb4ab68b5be7ae14a06479c5bfbc
2016-02-25 22:39:55 +01:00
Jenkins
ec4e488890 Merge "Fix deprecation warning" 2016-02-25 21:12:02 +00:00
Jenkins
9a2978476c Merge "Conditionally manage puppet config files" 2016-02-25 19:31:07 +00:00
Monty Taylor
af32021ef2 Fix deprecation warning
Bare variables are deprecated in Ansible now, we should wrap them
in jinja stuff so that the deprecation warning goes away.

Change-Id: Ib2bd6ae508eacaa274c16e08fe3ef384e4700776
2016-02-25 11:10:50 -06:00
Jenkins
5af0d99453 Merge "The default for logdest needs to not be a list" 2016-02-24 19:37:51 +00:00
Monty Taylor
fdc43c9f8a The default for logdest needs to not be a list
There are three possible values - none of them are a list.

Change-Id: Iade056998eeccb1845aa6232ea803073567add2f
2016-02-24 12:57:39 -06:00
Monty Taylor
0545b55d8d Report as puppet_report_as instead of fqdn
We want to report as the puppetmaster, not as the host in question.

Change-Id: I0462a898502ad709e046be76c19c9e11f4617335
Depends-On: I290ad569283390bac2a74a9991331c9e86821ab7
2016-02-24 11:47:43 -06:00
Monty Taylor
42c28a7456 Stop posting non-facter facts
No idea if these are breaking things, but maybe they are.

Change-Id: Id9492d901439407a9ffe9976be1fc26afc035b45
2016-02-24 10:42:37 -06:00
Monty Taylor
36916f8622 Return useful error messages on requests exception
We need to be able to debug this.

Change-Id: Ie20bc1293d80bbbd45479c12dd65314b27c61e40
2016-02-24 10:42:33 -06:00
Monty Taylor
c64119b530 Sync with upstream ansible-modules-extras
The --show-diff option to puppet agent is show-diff, not show_diff.
Also, there is a doc string about which version logdest was added in.

These are not important for Infra. However, keeping in sync makes it
easier to track changes that might actually matter.

Change-Id: Id16b9d7510efa4b8f3645997617cd00ee870e83a
2016-02-24 08:57:45 -06:00
Jenkins
54064729df Merge "Make puppet logout destination configurable" 2016-02-24 14:53:11 +00:00
Jenkins
3eb76ec392 Merge "Remove some problematic facts" 2016-02-24 00:22:01 +00:00
Spencer Krum
952ffbe9be Remove some problematic facts
For reasons, ansible adds to hostvars some large blobs. The size of
these blobs causes issues with puppetdb. Removing the two largest and
useless ones until the general solution is solved.

Change-Id: I5800cf1990fc4f97828fa158094e242f8f197d99
2016-02-23 16:05:43 -08:00
Spencer Krum
9c526e11ce Ansible-puppet must create the reports dir
Previously the puppetmaster was creating reports directories. Now that
ansible is in charge, it must do it.

Change-Id: I26e1e2ebd45f0c7d75652f9acb9999aee8a3e40c
2016-02-23 15:11:00 -08:00
Spencer Krum
ffeeba25a4 Variables enter ansible modules as p['thing']
Change-Id: Ifc61e8d37d296a2c9f334ce2bc8ef18fb1d67874
2016-02-23 13:49:44 -08:00
Spencer Krum
1f32232b7f Allow post_puppetdb to fail to post facts
This prevents failure of the module when puppetdb has a belly ache.

Change-Id: Ief2dbb740ed358d977c3656feda1f3932d5d5e08
2016-02-23 13:22:56 -08:00